From a390d6a9ad62019c7ca3d3689184fd3ce6afd57c Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 12 Aug 2019 18:51:01 +0200 Subject: Incorrect NCName in docbook citations In a bibtex reference it is possible to have a colon as the id, but in docbook this will result in: ``` docbook/citelist.xml:5: validity error : xml:id : attribute value _citelist_1CITEREF_pre:post is not an NCName [1] ``` So the id has to be translated. A colon in an id can only happen in case the names is provided from the outside. --- src/docbookvisitor.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index ce3a845..83c34e7 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -36,6 +36,7 @@ #include "htmlentity.h" #include "emoji.h" #include "plantuml.h" +#include "growbuf.h" #if 0 #define DB_VIS_C DB_VIS_C1(m_t) @@ -49,6 +50,25 @@ #define DB_VIS_C2a(x,y) #endif +static QCString filterId(const char *s) +{ + static GrowBuf growBuf; + growBuf.clear(); + if (s==0) return ""; + const unsigned char *p=(const unsigned char *)s; + char c; + while ((c=*p++)) + { + switch (c) + { + case ':': growBuf.addStr("_1"); break; + default: growBuf.addChar(c); break; + } + } + growBuf.addChar(0); + return growBuf.get(); +} + void DocbookDocVisitor::visitCaption(const QList &children) { QListIterator cli(children); @@ -374,7 +394,7 @@ void DocbookDocVisitor::visit(DocAnchor *anc) { DB_VIS_C if (m_hide) return; - m_t << "file()) << "_1" << anc->anchor() << "\"/>"; + m_t << "file()) << "_1" << filterId(anc->anchor()) << "\"/>"; } void DocbookDocVisitor::visit(DocInclude *inc) @@ -550,7 +570,7 @@ void DocbookDocVisitor::visit(DocCite *cite) { DB_VIS_C if (m_hide) return; - if (!cite->file().isEmpty()) startLink(cite->file(),cite->anchor()); + if (!cite->file().isEmpty()) startLink(cite->file(),filterId(cite->anchor())); filter(cite->text()); if (!cite->file().isEmpty()) endLink(); } -- cgit v0.12 From def222ab7fa1ad9e51dff1b11b610c9e1e4af067 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 27 Aug 2019 19:06:59 +0200 Subject: issue #7228 Using markdown causes wrong error and warning line numbers - v. 1.8.16 Sacrificing some readability of the debug `-d markdown` output for a better approximation of the line numbers by keeping the rows of a markdown table on one line when translating to a HTML table. --- src/markdown.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 2cbdcb5..888f161 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -1828,7 +1828,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) } - out.addStr("\n"); + out.addStr("
"); QCString cellTag("th"), cellClass("class=\"markdownTableHead"); for (unsigned row = 0; row < tableContents.size(); row++) { @@ -1836,16 +1836,16 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) { if (row % 2) { - out.addStr("\n"); + out.addStr(""); } else { - out.addStr("\n"); + out.addStr(""); } } else { - out.addStr(" \n"); + out.addStr(" "); } for (int c = 0; c < columns; c++) { @@ -1900,7 +1900,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) } // need at least one space on either side of the cell text in // order for doxygen to do other formatting - out.addStr("> " + cellText + "\n\n"); + out.addStr("> " + cellText + ""); } cellTag = "td"; cellClass = "class=\"markdownTableBody"; -- cgit v0.12 From a3093ff24ec75b70d6d7dc37ca2c7e68f36161fe Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 29 Aug 2019 16:42:44 +0200 Subject: Problem with `
` in LaTeX multicolumn cell In case we have a `
` in a table cell then it is displayed as a horizontal line (in LaTeX) unless it is in a multicolumn cell. In the later case it throws an error: ``` ! You can't use `\hrule' here except with leaders. \DoxyHorRuler ... }{0ex plus 0ex minus 0ex}\hrule ``` We have to use use `\hrulefill` in a table but in combination with the table option of xcolor this gives some problems so a new command has to be defined for this. See also: - horizontal rule / line inside a multicolumn field (https://tex.stackexchange.com/questions/506211/horizontal-rule-line-inside-a-multicolumn-field) - interaction between \usepackage[table]{xcolor} and \hrulefill (https://tex.stackexchange.com/questions/506221/interaction-between-usepackagetablexcolor-and-hrulefill) --- src/latexdocvisitor.cpp | 5 ++++- templates/latex/doxygen.sty | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index a0bbf73..5e424b0 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -280,7 +280,10 @@ void LatexDocVisitor::visit(DocLineBreak *) void LatexDocVisitor::visit(DocHorRuler *) { if (m_hide) return; - m_t << "\\DoxyHorRuler\n"; + if (insideTable()) + m_t << "\\DoxyHorRuler{1}\n"; + else + m_t << "\\DoxyHorRuler{0}\n"; } void LatexDocVisitor::visit(DocStyleChange *s) diff --git a/templates/latex/doxygen.sty b/templates/latex/doxygen.sty index bf19901..d28554b 100644 --- a/templates/latex/doxygen.sty +++ b/templates/latex/doxygen.sty @@ -35,9 +35,19 @@ \endgroup% } -\newcommand{\DoxyHorRuler}{% +\makeatletter +\newcommand\hrulefilll{\leavevmode\leaders\hrule\hskip 0pt plus 1filll\kern\z@} +\makeatother + +\newcommand{\DoxyHorRuler}[1]{% \setlength{\parskip}{0ex plus 0ex minus 0ex}% - \hrule% + \ifthenelse{#1=0}% + {% + \hrule% + }% + {% + \hrulefilll% + }% } \newcommand{\DoxyLabelFont}{} \newcommand{\entrylabel}[1]{% -- cgit v0.12 From 416ee572ba35b4d0cf30ccca66f0691c658f2e53 Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 29 Aug 2019 18:06:51 +0200 Subject: Problem with `
` in LaTeX multicolumn cell Small problem with defining `\hrulefilll`, moved code. --- doc/doxygen_manual.tex | 5 +++++ src/latexgen.cpp | 5 +++++ templates/latex/doxygen.sty | 4 ---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/doxygen_manual.tex b/doc/doxygen_manual.tex index 8ff3c66..e350013 100644 --- a/doc/doxygen_manual.tex +++ b/doc/doxygen_manual.tex @@ -66,6 +66,11 @@ \usepackage{doxygen} \usepackage{manual} %% +%gave problems when in doxygen.sty +\makeatletter +\newcommand\hrulefilll{\leavevmode\leaders\hrule\hskip 0pt plus 1filll\kern\z@} +\makeatother +%% % unfortunately constructs like: % \renewcommand{\doxysection}[1]{\doxysubsection{##1}} % using values from book.cls (see also doxygen.sty) and redefining sections to correct level. diff --git a/src/latexgen.cpp b/src/latexgen.cpp index e6c6861..1792f15 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -623,6 +623,11 @@ static void writeDefaultHeaderPart1(FTextStream &t) "}\n" "\\makeatother\n" "\n"; + // + t << "\\makeatletter\n" + "\\newcommand\\hrulefilll{\\leavevmode\\leaders\\hrule\\hskip 0pt plus 1filll\\kern\\z@}\n" + "\\makeatother\n" + "\n"; // Headers & footers QGString genString; diff --git a/templates/latex/doxygen.sty b/templates/latex/doxygen.sty index d28554b..83891a5 100644 --- a/templates/latex/doxygen.sty +++ b/templates/latex/doxygen.sty @@ -35,10 +35,6 @@ \endgroup% } -\makeatletter -\newcommand\hrulefilll{\leavevmode\leaders\hrule\hskip 0pt plus 1filll\kern\z@} -\makeatother - \newcommand{\DoxyHorRuler}[1]{% \setlength{\parskip}{0ex plus 0ex minus 0ex}% \ifthenelse{#1=0}% -- cgit v0.12 From 4a72a9b07e805b4ba27560e8e921bcee0002ef4c Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 9 Sep 2019 13:28:28 +0200 Subject: issue #7248: Including external tag files with TOC produces a broken index.qhp Ignore automatically generated anchor names when importing a tag file. --- src/tagreader.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 56dbe7d..d79d9b5 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -494,6 +494,23 @@ class TagFileParser : public QXmlDefaultHandler void endDocAnchor() { + // Check whether or not the tag is automatically generate, in that case ignore the tag. + switch(m_state) + { + case InClass: + case InFile: + case InNamespace: + case InGroup: + case InPage: + case InMember: + case InPackage: + case InDir: + if (QString(m_curString).startsWith("autotoc_md")) return; + break; + default: + warn("Unexpected tag 'docanchor' found"); + return; + } switch(m_state) { case InClass: m_curClass->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; @@ -504,7 +521,7 @@ class TagFileParser : public QXmlDefaultHandler case InMember: m_curMember->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; case InPackage: m_curPackage->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; case InDir: m_curDir->docAnchors.append(new TagAnchorInfo(m_fileName,m_curString,m_title)); break; - default: warn("Unexpected tag 'docanchor' found"); break; + default: warn("Unexpected tag 'docanchor' found"); break; // Not really necessary anymore } } -- cgit v0.12 From 9b9c2c6101be61baefb73b0c414e93381070e21b Mon Sep 17 00:00:00 2001 From: "luz.paz" Date: Sat, 28 Sep 2019 11:14:28 -0400 Subject: Fix typos Found via ``` codespell -q 3 -S *.js,*.po,./src/translator*,*.eps,./doc/changelog.doc -L ang,ans,attribs,ba,behaviour,classe,colour,german,iff,initialise,nam,nd,que,russian,statics,te,tim,uint ``` --- src/context.cpp | 2 +- src/dotgraph.cpp | 2 +- src/doxygen.cpp | 2 +- src/fortrancode.l | 2 +- src/fortranscanner.l | 2 +- src/memberdef.h | 2 +- src/portable.cpp | 2 +- src/pycode.l | 4 ++-- src/pyscanner.l | 6 +++--- src/scanner.l | 2 +- src/sortdict.h | 12 ++++++------ src/vhdljjparser.cpp | 4 ++-- templates/latex/tabu_doxygen.sty | 10 +++++----- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index 1933d43..8b7643a 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -8446,7 +8446,7 @@ TemplateVariant NamespaceMembersIndexContext::get(const char *name) const //------------------------------------------------------------------------ -//%% struct InheritanceGraph: a connected graph reprenting part of the overall interitance tree +//%% struct InheritanceGraph: a connected graph reprenting part of the overall inheritance tree //%% { class InheritanceGraphContext::Private { diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index df64d66..bbffaf0 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -289,7 +289,7 @@ void DotGraph::writeGraphHeader(FTextStream &t,const QCString &title) { t << " // INTERACTIVE_SVG=YES\n"; } - t << " // LATEX_PDF_SIZE\n"; // write placeholder for LaTeX PDF bounding box size repacement + t << " // LATEX_PDF_SIZE\n"; // write placeholder for LaTeX PDF bounding box size replacement if (Config_getBool(DOT_TRANSPARENT)) { t << " bgcolor=\"transparent\";" << endl; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 953a5de..7fec2b6 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -2588,7 +2588,7 @@ static MemberDef *addVariableToFile( addMemberDocs(root,md,def,0,FALSE); md->setRefItems(root->sli); // if md is a variable forward declaration and root is the definition that - // turn md into the defintion + // turn md into the definition if (!root->explicitExternal && md->isExternal()) { md->setDeclFile(md->getDefFileName(),md->getDefLine(),md->getDefColumn()); diff --git a/src/fortrancode.l b/src/fortrancode.l index d372299..303bbfb 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -521,7 +521,7 @@ static bool getGenericProcedureLink(const ClassDef *cd, return FALSE; } -static bool getLink(UseSDict *usedict, // dictonary with used modules +static bool getLink(UseSDict *usedict, // dictionary with used modules const char *memberText, // exact member text CodeOutputInterface &ol, const char *text) diff --git a/src/fortranscanner.l b/src/fortranscanner.l index d75134a..eb798c9 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -1840,7 +1840,7 @@ static QCString extractFromParens(const QCString name) return extracted; } -/*! remove non usefull spaces from bind statement */ +/*! remove unuseful spaces from bind statement */ static QCString extractBind(const QCString name) { QCString parensPart = extractFromParens(name); diff --git a/src/memberdef.h b/src/memberdef.h index b200833..97bf819 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -239,7 +239,7 @@ class MemberDef : virtual public Definition virtual bool hasCallGraph() const = 0; virtual bool hasCallerGraph() const = 0; virtual bool visibleMemberGroup(bool hideNoHeader) const = 0; - // refrenced related members + // referenced related members virtual bool hasReferencesRelation() const = 0; virtual bool hasReferencedByRelation() const = 0; diff --git a/src/portable.cpp b/src/portable.cpp index 3d64638..c6e829d 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -457,7 +457,7 @@ bool portable_isAbsolutePath(const char *fileName) /** * Correct a possible wrong PATH variable * - * This routine was inspired by the cause for bug 766059 was that in the Windows path there were forward slahes. + * This routine was inspired by the cause for bug 766059 was that in the Windows path there were forward slashes. */ void portable_correct_path(void) { diff --git a/src/pycode.l b/src/pycode.l index a76129d..8cae0e2 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -1316,7 +1316,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT \\{B}\n { // line continuation codifyLines(yytext); } - \\. { // espaced char + \\. { // escaped char codify(yytext); } {STRINGPREFIX}?{TRIDOUBLEQUOTE} { // triple double quotes @@ -1339,7 +1339,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT \\{B}\n { // line continuation codifyLines(yytext); } - \\. { // espaced char + \\. { // escaped char codify(yytext); } {STRINGPREFIX}?{TRISINGLEQUOTE} { // triple single quotes diff --git a/src/pyscanner.l b/src/pyscanner.l index 2320bca..33e6867 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -1619,7 +1619,7 @@ STARTDOCSYMS "##" incLineNr(); docBlock += yytext; } - \\. { // espaced char + \\. { // escaped char docBlock += yytext; } . { @@ -1654,7 +1654,7 @@ STARTDOCSYMS "##" addToString(yytext); incLineNr(); } - \\. { // espaced char + \\. { // escaped char addToString(yytext); } "\"\"\"" { // triple double quotes @@ -1677,7 +1677,7 @@ STARTDOCSYMS "##" addToString(yytext); incLineNr(); } - \\. { // espaced char + \\. { // escaped char addToString(yytext); } "'''" { // triple single quotes diff --git a/src/scanner.l b/src/scanner.l index 07d5c71..1db7320 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2001,7 +2001,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); //printf("PHP: adding use relation: %s\n",current->name.data()); current->fileName = yyFileName; - // add a using declaraton + // add a using declaration current->section=Entry::USINGDECL_SEC; current_root->addSubEntry(current); current = new Entry(*current); diff --git a/src/sortdict.h b/src/sortdict.h index 52eccd3..0e0b5c1 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -128,7 +128,7 @@ class SDict /*! Appends an element to the dictionary. The element is owned by the * dictionary. - * \param key The unique key to use to quicky find the item later on. + * \param key The unique key to use to quickly find the item later on. * \param d The compound to add. * \sa find() */ @@ -146,7 +146,7 @@ class SDict /*! Prepends an element to the dictionary. The element is owned by the * dictionary. - * \param key The unique key to use to quicky find the item later on. + * \param key The unique key to use to quickly find the item later on. * \param d The compound to add. * \sa find() */ @@ -190,7 +190,7 @@ class SDict m_list->sort(); } /*! Inserts a compound into the dictionary in a sorted way. - * \param key The unique key to use to quicky find the item later on. + * \param key The unique key to use to quickly find the item later on. * \param d The compound to add. * \sa find() */ @@ -470,7 +470,7 @@ class SIntDict /*! Appends a compound to the dictionary. The element is owned by the * dictionary. - * \param key The unique key to use to quicky find the item later on. + * \param key The unique key to use to quickly find the item later on. * \param d The compound to add. * \sa find() */ @@ -488,7 +488,7 @@ class SIntDict /*! Prepend a compound to the dictionary. The element is owned by the * dictionary. - * \param key The unique key to use to quicky find the item later on. + * \param key The unique key to use to quickly find the item later on. * \param d The compound to add. * \sa find() */ @@ -521,7 +521,7 @@ class SIntDict } /*! Inserts a compound into the dictionary in a sorted way. - * \param key The unique key to use to quicky find the item later on. + * \param key The unique key to use to quickly find the item later on. * \param d The compound to add. * \sa find() */ diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index aeed048..47772f6 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -343,7 +343,7 @@ void VhdlParser::addCompInst(const char *n, const char* instName, const char* co { current->args=lastCompound->name; // architecture name } - current->includeName=comp; // component/enity/configuration + current->includeName=comp; // component/entity/configuration int u=genLabels.find("|",1); if (u>0) { @@ -584,7 +584,7 @@ void VhdlParser::addProto(const char *s1,const char *s2,const char *s3, * ..... * library * package - * enity zzz + * entity zzz * ..... * and so on.. */ diff --git a/templates/latex/tabu_doxygen.sty b/templates/latex/tabu_doxygen.sty index 3efcaf3..a5ab3dc 100755 --- a/templates/latex/tabu_doxygen.sty +++ b/templates/latex/tabu_doxygen.sty @@ -78,7 +78,7 @@ \TMP@EnsureCode 58 = 12 % : (for siunitx) \TMP@EnsureCode124 = 12 % | \TMP@EnsureCode 36 = 3 % $ = math shift -\TMP@EnsureCode 38 = 4 % & = tab alignmment character +\TMP@EnsureCode 38 = 4 % & = tab alignment character \TMP@EnsureCode 32 = 10 % space \TMP@EnsureCode 94 = 7 % ^ \TMP@EnsureCode 95 = 8 % _ @@ -840,7 +840,7 @@ }% \tabu@reset \def\tabu@setsave #1{\expandafter\tabu@sets@ve #1\@nil{#1}} \long\def\tabu@sets@ve #1\@nil #2{\@temptokena\expandafter{\the\@temptokena \def#2{#1}}} -%% The Rewritting Process ------------------------------------------- +%% The Rewriting Process ------------------------------------------- \def\tabu@newcolumntype #1{% \expandafter\tabu@new@columntype \csname NC@find@\string#1\expandafter\endcsname @@ -1056,7 +1056,7 @@ \else #2\tabucolX \fi }% \tabu@hsize -%% \usetabu and \preamble: rewritting process --------------------- +%% \usetabu and \preamble: rewriting process --------------------- \tabu@privatecolumntype \usetabu [1]{% \ifx\\#1\\\tabu@saveerr{}\else \@ifundefined{tabu@saved@\string#1} @@ -1072,7 +1072,7 @@ {\csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}% \fi }% \NC@rewrite@\preamble -%% Controlling the rewritting process ------------------------------- +%% Controlling the rewriting process ------------------------------- \tabu@newcolumntype \tabu@rewritefirst{% \iftabu@long \aftergroup \tabu@longpream % \else \aftergroup \tabu@pream @@ -2388,7 +2388,7 @@ \PackageWarning{tabu} {\string\@arrayright\space is missing from the \MessageBreak definition of \string\endarray. - \MessageBreak Comptability with delarray.sty is broken.}% + \MessageBreak Compatibility with delarray.sty is broken.}% \fi\fi }% \tabu@fix@arrayright \def\tabu@adl@xarraydashrule #1#2#3{% -- cgit v0.12 From 23d8bd36a5b8eb1f4d913b50db31a567a63ad994 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 30 Sep 2019 19:13:58 +0200 Subject: Nicer warning for missing parameter In case of just 1 missing parameter use the singular form (checking was already done, now we just count). --- src/docparser.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index da4cfb2..8f7c2d2 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -508,7 +508,7 @@ static void checkUnOrMultipleDocumentedParams() { ArgumentListIterator ali(*al); const Argument *a; - bool found=FALSE; + int notArgCnt=0; for (ali.toFirst();(a=ali.current());++ali) { int count = 0; @@ -523,7 +523,7 @@ static void checkUnOrMultipleDocumentedParams() } else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a->docs.isEmpty()) { - found = TRUE; + notArgCnt++; } else { @@ -544,14 +544,16 @@ static void checkUnOrMultipleDocumentedParams() " has multiple @param documentation sections"); } } - if (found) + if (notArgCnt>0) { bool first=TRUE; QCString errMsg= - "The following parameters of "+ + "The following parameter"; + errMsg+= (notArgCnt>1 ? "s" : ""); + errMsg+=" of "+ QCString(g_memberDef->qualifiedName()) + QCString(argListToString(al)) + - " are not documented:\n"; + (notArgCnt>1 ? " are" : " is") + " not documented:\n"; for (ali.toFirst();(a=ali.current());++ali) { QCString argName = g_memberDef->isDefine() ? a->type : a->name; -- cgit v0.12 From a872ee137c88b98c4d5ce2391c60e304d68faccb Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 2 Oct 2019 17:44:32 +0200 Subject: issue #7285 git executable required Test showed that the REQUIRED is not necessary for the doxygen build process. The git version available will not be available. --- cmake/git_watcher.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/git_watcher.cmake b/cmake/git_watcher.cmake index 6447b86..6a50476 100644 --- a/cmake/git_watcher.cmake +++ b/cmake/git_watcher.cmake @@ -69,7 +69,7 @@ CHECK_OPTIONAL_VARIABLE(GIT_WORKING_DIR "${CMAKE_SOURCE_DIR}") # Check the optional git variable. # If it's not set, we'll try to find it using the CMake packaging system. if(NOT DEFINED GIT_EXECUTABLE) - find_package(Git QUIET REQUIRED) + find_package(Git QUIET) endif() CHECK_REQUIRED_VARIABLE(GIT_EXECUTABLE) -- cgit v0.12 From d269f239d7af8d3bd762abfd6a8557cd2d898eab Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 5 Oct 2019 13:08:50 +0200 Subject: Incorrect warning for ALIASES In case we have an alias in the form: `mine_err(1)=\1` we get the warning: ``` error: Illegal alias format 'mine_err(1)=\1'. Use "name=value" or "name(n)=value", where n is the number of arguments ``` Note the round brackets in the explanation., these have to be curly brackets. --- src/configimpl.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configimpl.l b/src/configimpl.l index e657745..0cc5c88 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -1495,7 +1495,7 @@ void Config::checkAndCorrect() alias=alias.stripWhiteSpace(); if (alias.find(re1)!=0 && alias.find(re2)!=0) { - err("Illegal alias format '%s'. Use \"name=value\" or \"name(n)=value\", where n is the number of arguments\n", + err("Illegal alias format '%s'. Use \"name=value\" or \"name{n}=value\", where n is the number of arguments\n", alias.data()); } s=aliasList.next(); -- cgit v0.12 From 4ab73bb872b443ad798be384171c5ff222cb2ba2 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 6 Oct 2019 13:40:14 +0200 Subject: Textual error Correcting textual error --- doc/commands.doc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/commands.doc b/doc/commands.doc index 4e0a6f9..5c6d067 100644 --- a/doc/commands.doc +++ b/doc/commands.doc @@ -2277,8 +2277,8 @@ Commands for displaying examples The `option` `lineno` can be used to enable line numbers for the included code if desired. The `option` `doc` can be used to treat the file as documentation rather than code. - \note Some that when using the `{doc}` option, - commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with + \note When using the `{doc}` option, + some commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with this command due to the moment of parsing. \note The included documentation should not have comment signs in it as they will appear @@ -2409,8 +2409,8 @@ Commands for displaying examples The `option` `lineno` can be used to enable line numbers for the included code if desired. The `option` `doc` can be used to treat the file as documentation rather than code. - \note Some that when using the `{doc}` option, - commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with + \note When using the `{doc}` option, + some commands like \ref cmdcond "\\cond" and \ref cmdif "\\if" don't work with this command due to the moment of parsing. \note The included documentation should not have comment signs in it as they will appear -- cgit v0.12 From 2734b80f2dcaac9dc6be842969d42414c7a37447 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 6 Oct 2019 17:53:40 +0200 Subject: issue #7295 Doxygen documentation of C++17 nested namespace erroneous documentation has to be added to the "last" entry not to the "first" / "top" --- src/scanner.l | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/scanner.l b/src/scanner.l index 07d5c71..2a54121 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -3989,6 +3989,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (current->section == Entry::NAMESPACE_SEC && current->type == "namespace") { int split_point; + Entry *first_current = current; while ((split_point = current->name.find("::")) != -1) { Entry *new_current = new Entry(*current); @@ -4007,6 +4008,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current_root = current; current = new_current; } + // put documentation in the right entity + if (first_current!=current) + { + current->doc = first_current->doc; + current->docLine = first_current->docLine; + current->docFile = first_current->docFile; + current->brief = first_current->brief; + current->briefLine = first_current->briefLine; + current->briefFile = first_current->briefFile; + first_current->doc = ""; + first_current->docLine = 0; + first_current->docFile = ""; + first_current->brief = ""; + first_current->briefLine = 0; + first_current->briefFile = ""; + } } QCString &cn = current->name; QCString rn = current_root->name.copy(); -- cgit v0.12 From 3367058c49f85c3d8a86377db08e90ec9e601c60 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 6 Oct 2019 18:02:00 +0200 Subject: Bug 570798 - \\\< does not work for php constants Handle comment for define analogous to a normal php variable, the closing part is automatically done when the comment is finished (rule: `";"`). --- src/scanner.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scanner.l b/src/scanner.l index 07d5c71..316bb81 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2770,7 +2770,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->name += yytext ; addType( current ); } -";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { +";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { if (current->bodyLine==-1) { current->bodyLine=yyLineNr; -- cgit v0.12 From ae0a5ec2a10371adbcdb0df4f3ce536ed6b43840 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 7 Oct 2019 21:01:10 +0200 Subject: Use smartpointers to manage the lifetime of Entry objects --- src/commentscan.l | 18 +- src/docgroup.cpp | 15 + src/doxygen.cpp | 969 +++++++++++++++++++++++------------------------ src/entry.cpp | 82 ++-- src/entry.h | 38 +- src/fileparser.h | 2 +- src/fortranscanner.h | 2 +- src/fortranscanner.l | 240 +++++------- src/groupdef.cpp | 12 +- src/groupdef.h | 16 +- src/markdown.cpp | 11 +- src/markdown.h | 2 +- src/parserintf.h | 4 +- src/pyscanner.h | 2 +- src/pyscanner.l | 108 ++---- src/scanner.h | 2 +- src/scanner.l | 317 +++++++--------- src/sqlscanner.h | 2 +- src/tagreader.cpp | 63 +-- src/tagreader.h | 4 +- src/tclscanner.h | 2 +- src/tclscanner.l | 38 +- src/vhdldocgen.cpp | 24 +- src/vhdljjparser.cpp | 105 +++-- src/vhdljjparser.h | 9 +- src/xmlscanner.h | 2 +- vhdlparser/VhdlParser.cc | 22 +- vhdlparser/VhdlParser.h | 2 +- vhdlparser/vhdlparser.jj | 22 +- 29 files changed, 1021 insertions(+), 1114 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index 7c9929c..23a1fc2 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -415,11 +415,8 @@ static GuardType guardType; // kind of guard for conditional se static bool enabledSectionFound; static QCString functionProto; // function prototype static QStack guards; // tracks nested conditional sections (if,ifnot,..) -static Entry* current = 0 ; // working entry -//static Entry* current_root = 0 ; // parent of working entry +static Entry *current = 0; // working entry - -//static Entry* previous = 0 ; // TODO: remove need for this static bool needNewEntry; static QCString g_sectionLabel; @@ -533,7 +530,6 @@ static QCString stripQuotes(const char *s) static void addXRefItem(const char *listName,const char *itemTitle, const char *listTitle,bool append) { - Entry *docEntry = current; // inBody && previous ? previous : current; if (listName==0) return; //printf("addXRefItem(%s,%s,%s,%d)\n",listName,itemTitle,listTitle,append); @@ -545,9 +541,9 @@ static void addXRefItem(const char *listName,const char *itemTitle, Doxygen::xrefLists->insert(listName,refList); //printf("new list!\n"); } - if (docEntry->sli) + if (current->sli) { - QListIterator slii(*docEntry->sli); + QListIterator slii(*current->sli); for (slii.toLast();(lii=slii.current());--slii) { if (qstrcmp(lii->type,listName)==0) @@ -580,16 +576,16 @@ static void addXRefItem(const char *listName,const char *itemTitle, ASSERT(item!=0); item->text = outputXRef; item->listAnchor = anchorLabel; - docEntry->addSpecialListItem(listName,itemId); + current->addSpecialListItem(listName,itemId); QCString cmdString; cmdString.sprintf(" \\xrefitem %s %d.",listName,itemId); if (inBody) { - docEntry->inbodyDocs += cmdString; + current->inbodyDocs += cmdString; } else { - docEntry->doc += cmdString; + current->doc += cmdString; } SectionInfo *si = Doxygen::sectionDict->find(anchorLabel); if (si) @@ -609,7 +605,7 @@ static void addXRefItem(const char *listName,const char *itemTitle, g_sectionTitle,SectionInfo::Anchor, g_sectionLevel); Doxygen::sectionDict->append(anchorLabel,si); - docEntry->anchors->append(si); + current->anchors->append(si); } } outputXRef.resize(0); diff --git a/src/docgroup.cpp b/src/docgroup.cpp index 1f4fb6d..ecaa1af 100644 --- a/src/docgroup.cpp +++ b/src/docgroup.cpp @@ -1,3 +1,18 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2019 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 "doxygen.h" #include "util.h" #include "entry.h" diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 953a5de..798418f 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -33,6 +33,9 @@ #include #include +#include +#include + #include "version.h" #include "doxygen.h" #include "scanner.h" @@ -105,13 +108,6 @@ // provided by the generated file resources.cpp extern void initResources(); -#define RECURSE_ENTRYTREE(func,var) \ - do { if (var->children()) { \ - EntryListIterator eli(*var->children()); \ - for (;eli.current();++eli) func(eli.current()); \ - } } while(0) - - #if !defined(_WIN32) || defined(__CYGWIN__) #include #define HAS_SIGNALS @@ -177,7 +173,7 @@ GenericsSDict *Doxygen::genericsDict; DocGroup Doxygen::docGroup; // locally accessible globals -static QDict g_classEntries(1009); +static std::unordered_map< std::string, const Entry* > g_classEntries; static StringList g_inputFiles; static QDict g_compoundKeywordDict(7); // keywords recognised as compounds static OutputList *g_outputList = 0; // list of output generating objects @@ -297,9 +293,12 @@ void statistics() -static void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl, - ArgumentList *al,bool over_load,NamespaceSDict *nl=0); -static void findMember(Entry *root, +static void addMemberDocs(const Entry *root,MemberDef *md, const char *funcDecl, + ArgumentList *al,bool over_load,uint64 spec); +static void findMember(const Entry *root, + const QCString &relates, + const QCString &type, + const QCString &args, QCString funcDecl, bool overloaded, bool isFunc @@ -313,7 +312,7 @@ enum FindBaseClassRelation_Mode }; static bool findClassRelation( - Entry *root, + const Entry *root, Definition *context, ClassDef *cd, BaseInfo *bi, @@ -420,9 +419,9 @@ static STLInfo g_stlinfo[] = { 0, 0, 0, 0, 0, 0, 0, FALSE, FALSE } }; -static void addSTLMember(Entry *root,const char *type,const char *name) +static void addSTLMember(const std::unique_ptr &root,const char *type,const char *name) { - Entry *memEntry = new Entry; + std::unique_ptr memEntry = std::make_unique(); memEntry->name = name; memEntry->type = type; memEntry->protection = Public; @@ -430,16 +429,12 @@ static void addSTLMember(Entry *root,const char *type,const char *name) memEntry->brief = "STL member"; memEntry->hidden = FALSE; memEntry->artificial = TRUE; - //memEntry->parent = root; - root->addSubEntry(memEntry); - //EntryNav *memEntryNav = new EntryNav(root,memEntry); - //memEntryNav->setEntry(memEntry); - //rootNav->addChild(memEntryNav); + root->moveToSubEntryAndKeep(memEntry); } -static void addSTLIterator(Entry *classEntry,const char *name) +static void addSTLIterator(const std::unique_ptr &classEntry,const char *name) { - Entry *iteratorClassEntry = new Entry; + std::unique_ptr iteratorClassEntry = std::make_unique(); iteratorClassEntry->fileName = "[STL]"; iteratorClassEntry->startLine = 1; iteratorClassEntry->name = name; @@ -447,113 +442,106 @@ static void addSTLIterator(Entry *classEntry,const char *name) iteratorClassEntry->brief = "STL iterator class"; iteratorClassEntry->hidden = FALSE; iteratorClassEntry->artificial= TRUE; - classEntry->addSubEntry(iteratorClassEntry); - //EntryNav *iteratorClassEntryNav = new EntryNav(classEntryNav,iteratorClassEntry); - //iteratorClassEntryNav->setEntry(iteratorClassEntry); - //classEntryNav->addChild(iteratorClassEntryNav); + classEntry->moveToSubEntryAndKeep(iteratorClassEntry); +} + +static void addSTLClass(const std::unique_ptr &root,const STLInfo *info) +{ + //printf("Adding STL class %s\n",info->className); + QCString fullName = info->className; + fullName.prepend("std::"); + + // add fake Entry for the class + std::unique_ptr classEntry = std::make_unique(); + classEntry->fileName = "[STL]"; + classEntry->startLine = 1; + classEntry->name = fullName; + classEntry->section = Entry::CLASS_SEC; + classEntry->brief = "STL class"; + classEntry->hidden = FALSE; + classEntry->artificial= TRUE; + + // add template arguments to class + if (info->templType1) + { + ArgumentList *al = new ArgumentList; + Argument *a=new Argument; + a->type="typename"; + a->name=info->templType1; + al->append(a); + if (info->templType2) // another template argument + { + a=new Argument; + a->type="typename"; + a->name=info->templType2; + al->append(a); + } + classEntry->tArgLists = new QList; + classEntry->tArgLists->setAutoDelete(TRUE); + classEntry->tArgLists->append(al); + } + // add member variables + if (info->templName1) + { + addSTLMember(classEntry,info->templType1,info->templName1); + } + if (info->templName2) + { + addSTLMember(classEntry,info->templType2,info->templName2); + } + if (fullName=="std::auto_ptr" || fullName=="std::smart_ptr" || fullName=="std::shared_ptr" || + fullName=="std::unique_ptr" || fullName=="std::weak_ptr") + { + std::unique_ptr memEntry = std::make_unique(); + memEntry->name = "operator->"; + memEntry->args = "()"; + memEntry->type = "T*"; + memEntry->protection = Public; + memEntry->section = Entry::FUNCTION_SEC; + memEntry->brief = "STL member"; + memEntry->hidden = FALSE; + memEntry->artificial = FALSE; + classEntry->moveToSubEntryAndKeep(memEntry); + } + if (info->baseClass1) + { + classEntry->extends->append(new BaseInfo(info->baseClass1,Public,info->virtualInheritance?Virtual:Normal)); + } + if (info->baseClass2) + { + classEntry->extends->append(new BaseInfo(info->baseClass2,Public,info->virtualInheritance?Virtual:Normal)); + } + if (info->iterators) + { + // add iterator class + addSTLIterator(classEntry,fullName+"::iterator"); + addSTLIterator(classEntry,fullName+"::const_iterator"); + addSTLIterator(classEntry,fullName+"::reverse_iterator"); + addSTLIterator(classEntry,fullName+"::const_reverse_iterator"); + } + root->moveToSubEntryAndKeep(classEntry); } -static void addSTLClasses(Entry *root) +static void addSTLClasses(const std::unique_ptr &root) { - Entry *namespaceEntry = new Entry; + std::unique_ptr namespaceEntry = std::make_unique(); namespaceEntry->fileName = "[STL]"; namespaceEntry->startLine = 1; - //namespaceEntry->parent = rootNav->entry(); namespaceEntry->name = "std"; namespaceEntry->section = Entry::NAMESPACE_SEC; namespaceEntry->brief = "STL namespace"; namespaceEntry->hidden = FALSE; namespaceEntry->artificial= TRUE; - root->addSubEntry(namespaceEntry); - //EntryNav *namespaceEntryNav = new EntryNav(rootNav,namespaceEntry); - //namespaceEntryNav->setEntry(namespaceEntry); - //rootNav->addChild(namespaceEntryNav); STLInfo *info = g_stlinfo; while (info->className) { - //printf("Adding STL class %s\n",info->className); - QCString fullName = info->className; - fullName.prepend("std::"); - - // add fake Entry for the class - Entry *classEntry = new Entry; - classEntry->fileName = "[STL]"; - classEntry->startLine = 1; - classEntry->name = fullName; - classEntry->section = Entry::CLASS_SEC; - classEntry->brief = "STL class"; - classEntry->hidden = FALSE; - classEntry->artificial= TRUE; - namespaceEntry->addSubEntry(classEntry); - //EntryNav *classEntryNav = new EntryNav(namespaceEntryNav,classEntry); - //classEntryNav->setEntry(classEntry); - //namespaceEntryNav->addChild(classEntryNav); - - // add template arguments to class - if (info->templType1) - { - ArgumentList *al = new ArgumentList; - Argument *a=new Argument; - a->type="typename"; - a->name=info->templType1; - al->append(a); - if (info->templType2) // another template argument - { - a=new Argument; - a->type="typename"; - a->name=info->templType2; - al->append(a); - } - classEntry->tArgLists = new QList; - classEntry->tArgLists->setAutoDelete(TRUE); - classEntry->tArgLists->append(al); - } - // add member variables - if (info->templName1) - { - addSTLMember(classEntry,info->templType1,info->templName1); - } - if (info->templName2) - { - addSTLMember(classEntry,info->templType2,info->templName2); - } - if (fullName=="std::auto_ptr" || fullName=="std::smart_ptr" || fullName=="std::shared_ptr" || - fullName=="std::unique_ptr" || fullName=="std::weak_ptr") - { - Entry *memEntry = new Entry; - memEntry->name = "operator->"; - memEntry->args = "()"; - memEntry->type = "T*"; - memEntry->protection = Public; - memEntry->section = Entry::FUNCTION_SEC; - memEntry->brief = "STL member"; - memEntry->hidden = FALSE; - memEntry->artificial = FALSE; - classEntry->addSubEntry(memEntry); - //EntryNav *memEntryNav = new EntryNav(classEntryNav,memEntry); - //memEntryNav->setEntry(memEntry); - //classEntryNav->addChild(memEntryNav); - } - if (info->baseClass1) - { - classEntry->extends->append(new BaseInfo(info->baseClass1,Public,info->virtualInheritance?Virtual:Normal)); - } - if (info->baseClass2) - { - classEntry->extends->append(new BaseInfo(info->baseClass2,Public,info->virtualInheritance?Virtual:Normal)); - } - if (info->iterators) - { - // add iterator class - addSTLIterator(classEntry,fullName+"::iterator"); - addSTLIterator(classEntry,fullName+"::const_iterator"); - addSTLIterator(classEntry,fullName+"::reverse_iterator"); - addSTLIterator(classEntry,fullName+"::const_reverse_iterator"); - } + addSTLClass(namespaceEntry,info); info++; } + + root->moveToSubEntryAndKeep(namespaceEntry); } //---------------------------------------------------------------------------- @@ -616,7 +604,7 @@ static void addRelatedPage(Entry *root) } } -static void buildGroupListFiltered(Entry *root,bool additional, bool includeExternal) +static void buildGroupListFiltered(const Entry *root,bool additional, bool includeExternal) { if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty() && ((!includeExternal && root->tagInfo==0) || @@ -671,18 +659,10 @@ static void buildGroupListFiltered(Entry *root,bool additional, bool includeExte } } } - if (root->children()) - { - EntryListIterator eli(*root->children()); - Entry *e; - for (;(e=eli.current());++eli) - { - buildGroupListFiltered(e,additional,includeExternal); - } - } + for (const auto &e : root->children()) buildGroupListFiltered(e.get(),additional,includeExternal); } -static void buildGroupList(Entry *root) +static void buildGroupList(const Entry *root) { // --- first process only local groups // first process the @defgroups blocks @@ -697,7 +677,7 @@ static void buildGroupList(Entry *root) buildGroupListFiltered(root,TRUE,TRUE); } -static void findGroupScope(Entry *root) +static void findGroupScope(const Entry *root) { if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty() && root->parent() && !root->parent()->name.isEmpty()) @@ -719,10 +699,10 @@ static void findGroupScope(Entry *root) } } } - RECURSE_ENTRYTREE(findGroupScope,root); + for (const auto &e : root->children()) findGroupScope(e.get()); } -static void organizeSubGroupsFiltered(Entry *root,bool additional) +static void organizeSubGroupsFiltered(const Entry *root,bool additional) { if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty()) { @@ -737,18 +717,10 @@ static void organizeSubGroupsFiltered(Entry *root,bool additional) } } } - if (root->children()) - { - EntryListIterator eli(*root->children()); - Entry *e; - for (;(e=eli.current());++eli) - { - organizeSubGroupsFiltered(e,additional); - } - } + for (const auto &e : root->children()) organizeSubGroupsFiltered(e.get(),additional); } -static void organizeSubGroups(Entry *root) +static void organizeSubGroups(const Entry *root) { //printf("Defining groups\n"); // first process the @defgroups blocks @@ -760,7 +732,7 @@ static void organizeSubGroups(Entry *root) //---------------------------------------------------------------------- -static void buildFileList(Entry *root) +static void buildFileList(const Entry *root) { if (((root->section==Entry::FILEDOC_SEC) || ((root->section & Entry::FILE_MASK) && Config_getBool(EXTRACT_ALL))) && @@ -824,10 +796,10 @@ static void buildFileList(Entry *root) warn(fn,root->startLine,text); } } - RECURSE_ENTRYTREE(buildFileList,root); + for (const auto &e : root->children()) buildFileList(e.get()); } -static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root) +static void addIncludeFile(ClassDef *cd,FileDef *ifd,const Entry *root) { if ( (!root->doc.stripWhiteSpace().isEmpty() || @@ -1220,7 +1192,7 @@ ClassDef::CompoundType convertToCompoundType(int section,uint64 specifier) } -static void addClassToContext(Entry *root) +static void addClassToContext(const Entry *root) { FileDef *fd = root->fileDef(); @@ -1386,7 +1358,7 @@ static void addClassToContext(Entry *root) //---------------------------------------------------------------------- // build a list of all classes mentioned in the documentation // and all classes that have a documentation block before their definition. -static void buildClassList(Entry *root) +static void buildClassList(const Entry *root) { if ( ((root->section & Entry::COMPOUND_MASK) || @@ -1395,10 +1367,10 @@ static void buildClassList(Entry *root) { addClassToContext(root); } - RECURSE_ENTRYTREE(buildClassList,root); + for (const auto &e : root->children()) buildClassList(e.get()); } -static void buildClassDocList(Entry *root) +static void buildClassDocList(const Entry *root) { if ( (root->section & Entry::COMPOUNDDOC_MASK) && !root->name.isEmpty() @@ -1406,7 +1378,7 @@ static void buildClassDocList(Entry *root) { addClassToContext(root); } - RECURSE_ENTRYTREE(buildClassDocList,root); + for (const auto &e : root->children()) buildClassDocList(e.get()); } static void resolveClassNestingRelations() @@ -1717,7 +1689,7 @@ static void findTagLessClasses() //---------------------------------------------------------------------- // build a list of all namespaces mentioned in the documentation // and all namespaces that have a documentation block before their definition. -static void buildNamespaceList(Entry *root) +static void buildNamespaceList(const Entry *root) { if ( (root->section==Entry::NAMESPACE_SEC || @@ -1847,7 +1819,7 @@ static void buildNamespaceList(Entry *root) } } } - RECURSE_ENTRYTREE(buildNamespaceList,root); + for (const auto &e : root->children()) buildNamespaceList(e.get()); } //---------------------------------------------------------------------- @@ -1871,7 +1843,7 @@ static const NamespaceDef *findUsedNamespace(const NamespaceSDict *unl, return usingNd; } -static void findUsingDirectives(Entry *root) +static void findUsingDirectives(const Entry *root) { if (root->section==Entry::USINGDIR_SEC) { @@ -2007,12 +1979,12 @@ static void findUsingDirectives(Entry *root) } } } - RECURSE_ENTRYTREE(findUsingDirectives,root); + for (const auto &e : root->children()) findUsingDirectives(e.get()); } //---------------------------------------------------------------------- -static void buildListOfUsingDecls(Entry *root) +static void buildListOfUsingDecls(const Entry *root) { if (root->section==Entry::USINGDECL_SEC && !(root->parent()->section&Entry::COMPOUND_MASK) // not a class/struct member @@ -2029,11 +2001,11 @@ static void buildListOfUsingDecls(Entry *root) } } } - RECURSE_ENTRYTREE(buildListOfUsingDecls,root); + for (const auto &e : root->children()) buildListOfUsingDecls(e.get()); } -static void findUsingDeclarations(Entry *root) +static void findUsingDeclarations(const Entry *root) { if (root->section==Entry::USINGDECL_SEC && !(root->parent()->section&Entry::COMPOUND_MASK) // not a class/struct member @@ -2113,12 +2085,12 @@ static void findUsingDeclarations(Entry *root) } } } - RECURSE_ENTRYTREE(findUsingDeclarations,root); + for (const auto &e : root->children()) findUsingDeclarations(e.get()); } //---------------------------------------------------------------------- -static void findUsingDeclImports(Entry *root) +static void findUsingDeclImports(const Entry *root) { if (root->section==Entry::USINGDECL_SEC && (root->parent()->section&Entry::COMPOUND_MASK) // in a class/struct member @@ -2211,7 +2183,7 @@ static void findUsingDeclImports(Entry *root) } } - RECURSE_ENTRYTREE(findUsingDeclImports,root); + for (const auto &e : root->children()) findUsingDeclImports(e.get()); } //---------------------------------------------------------------------- @@ -2250,10 +2222,12 @@ static void findIncludedUsingDirectives() //---------------------------------------------------------------------- static MemberDef *addVariableToClass( - Entry *root, + const Entry *root, ClassDef *cd, MemberType mtype, + const QCString &type, const QCString &name, + const QCString &args, bool fromAnnScope, MemberDef *fromAnnMemb, Protection prot, @@ -2270,38 +2244,38 @@ static MemberDef *addVariableToClass( Debug::print(Debug::Variables,0, " class variable:\n" " '%s' '%s'::'%s' '%s' prot=%d ann=%d init='%s'\n", - qPrint(root->type), + qPrint(type), qPrint(qualScope), qPrint(name), - qPrint(root->args), + qPrint(args), root->protection, fromAnnScope, qPrint(root->initializer) ); QCString def; - if (!root->type.isEmpty()) + if (!type.isEmpty()) { if (related || mtype==MemberType_Friend || Config_getBool(HIDE_SCOPE_NAMES)) { if (root->spec&Entry::Alias) // turn 'typedef B A' into 'using A = B' { - def="using "+name+" = "+root->type.mid(7); + def="using "+name+" = "+type.mid(7); } else { - def=root->type+" "+name+root->args; + def=type+" "+name+root->args; } } else { if (root->spec&Entry::Alias) // turn 'typedef B C::A' into 'using C::A = B' { - def="using "+qualScope+scopeSeparator+name+" = "+root->type.mid(7); + def="using "+qualScope+scopeSeparator+name+" = "+type.mid(7); } else { - def=root->type+" "+qualScope+scopeSeparator+name+root->args; + def=type+" "+qualScope+scopeSeparator+name+args; } } } @@ -2309,11 +2283,11 @@ static MemberDef *addVariableToClass( { if (Config_getBool(HIDE_SCOPE_NAMES)) { - def=name+root->args; + def=name+args; } else { - def=qualScope+scopeSeparator+name+root->args; + def=qualScope+scopeSeparator+name+args; } } def.stripPrefix("static "); @@ -2329,10 +2303,10 @@ static MemberDef *addVariableToClass( for (mni.toFirst();(md=mni.current());++mni) { //printf("md->getClassDef()=%p cd=%p type=[%s] md->typeString()=[%s]\n", - // md->getClassDef(),cd,root->type.data(),md->typeString()); + // md->getClassDef(),cd,type.data(),md->typeString()); if (!md->isAlias() && md->getClassDef()==cd && - removeRedundantWhiteSpace(root->type)==md->typeString()) + removeRedundantWhiteSpace(type)==md->typeString()) // member already in the scope { @@ -2344,7 +2318,7 @@ static MemberDef *addVariableToClass( md->setProtection(root->protection); cd->reclassifyMember(md,MemberType_Property); } - addMemberDocs(root,md,def,0,FALSE); + addMemberDocs(root,md,def,0,FALSE,root->spec); //printf(" Member already found!\n"); return md; } @@ -2360,7 +2334,7 @@ static MemberDef *addVariableToClass( // new member variable, typedef or enum value MemberDef *md=createMemberDef( fileName,root->startLine,root->startColumn, - root->type,name,root->args,root->exception, + type,name,args,root->exception, prot,Normal,root->stat,related, mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0, root->metaData); md->setTagInfo(root->tagInfo); @@ -2421,17 +2395,19 @@ static MemberDef *addVariableToClass( //TODO: insert FileDef instead of filename strings. cd->insertUsedFile(root->fileDef()); - root->changeSection(Entry::EMPTY_SEC); + root->markAsProcessed(); return md; } //---------------------------------------------------------------------- static MemberDef *addVariableToFile( - Entry *root, + const Entry *root, MemberType mtype, const QCString &scope, + const QCString &type, const QCString &name, + const QCString &args, bool fromAnnScope, /*int indentDepth,*/ MemberDef *fromAnnMemb) @@ -2440,10 +2416,10 @@ static MemberDef *addVariableToFile( " global variable:\n" " file='%s' type='%s' scope='%s' name='%s' args='%s' prot=`%d mtype=%d lang=%d\n", qPrint(root->fileName), - qPrint(root->type), + qPrint(type), qPrint(scope), qPrint(name), - qPrint(root->args), + qPrint(args), root->protection, mtype, root->lang @@ -2454,18 +2430,18 @@ static MemberDef *addVariableToFile( // see if we have a typedef that should hide a struct or union if (mtype==MemberType_Typedef && Config_getBool(TYPEDEF_HIDES_STRUCT)) { - QCString type = root->type; - type.stripPrefix("typedef "); - if (type.left(7)=="struct " || type.left(6)=="union ") + QCString ttype = type; + ttype.stripPrefix("typedef "); + if (ttype.left(7)=="struct " || ttype.left(6)=="union ") { - type.stripPrefix("struct "); - type.stripPrefix("union "); + ttype.stripPrefix("struct "); + ttype.stripPrefix("union "); static QRegExp re("[a-z_A-Z][a-z_A-Z0-9]*"); int l,s; - s = re.match(type,0,&l); + s = re.match(ttype,0,&l); if (s>=0) { - QCString typeValue = type.mid(s,l); + QCString typeValue = ttype.mid(s,l); ClassDef *cd = getClass(typeValue); if (cd) { @@ -2502,45 +2478,45 @@ static MemberDef *addVariableToFile( SrcLangExt lang = nd->getLanguage(); QCString sep=getLanguageSpecificSeparator(lang); - if (!root->type.isEmpty()) + if (!type.isEmpty()) { if (root->spec&Entry::Alias) // turn 'typedef B NS::A' into 'using NS::A = B' { - def="using "+nd->name()+sep+name+" = "+root->type; + def="using "+nd->name()+sep+name+" = "+type; } else // normal member { - def=root->type+" "+nd->name()+sep+name+root->args; + def=type+" "+nd->name()+sep+name+args; } } else { - def=nd->name()+sep+name+root->args; + def=nd->name()+sep+name+args; } } else { - if (!root->type.isEmpty() && !root->name.isEmpty()) + if (!type.isEmpty() && !root->name.isEmpty()) { if (name.at(0)=='@') // dummy variable representing anonymous union { - def=root->type; + def=type; } else { if (root->spec&Entry::Alias) // turn 'typedef B A' into 'using A = B' { - def="using "+root->name+" = "+root->type.mid(7); + def="using "+root->name+" = "+type.mid(7); } else // normal member { - def=root->type+" "+name+root->args; + def=type+" "+name+args; } } } else { - def=name+root->args; + def=name+args; } } def.stripPrefix("static "); @@ -2571,8 +2547,8 @@ static MemberDef *addVariableToFile( // variable already in the scope { bool isPHPArray = md->getLanguage()==SrcLangExt_PHP && - md->argsString()!=root->args && - root->args.find('[')!=-1; + md->argsString()!=args && + args.find('[')!=-1; bool staticsInDifferentFiles = root->stat && md->isStatic() && root->fileName!=md->getDefFileName(); @@ -2585,7 +2561,7 @@ static MemberDef *addVariableToFile( { Debug::print(Debug::Variables,0, " variable already found: scope=%s\n",qPrint(md->getOuterScope()->name())); - addMemberDocs(root,md,def,0,FALSE); + addMemberDocs(root,md,def,0,FALSE,root->spec); md->setRefItems(root->sli); // if md is a variable forward declaration and root is the definition that // turn md into the defintion @@ -2617,7 +2593,7 @@ static MemberDef *addVariableToFile( // new global variable, enum value or typedef MemberDef *md=createMemberDef( fileName,root->startLine,root->startColumn, - root->type,name,root->args,0, + type,name,args,0, root->protection, Normal,root->stat,Member, mtype,root->tArgLists ? root->tArgLists->getLast() : 0,0, root->metaData); md->setTagInfo(root->tagInfo); @@ -2673,7 +2649,7 @@ static MemberDef *addVariableToFile( mn->append(md); Doxygen::functionNameSDict->append(name,mn); } - root->changeSection(Entry::EMPTY_SEC); + root->markAsProcessed(); return md; } @@ -2714,7 +2690,7 @@ static int findFunctionPtr(const QCString &type,int lang, int *pLength=0) /*! Returns TRUE iff \a type is a class within scope \a context. * Used to detect variable declarations that look like function prototypes. */ -static bool isVarWithConstructor(Entry *root) +static bool isVarWithConstructor(const Entry *root) { static QRegExp initChars("[0-9\"'&*!^]+"); static QRegExp idChars("[a-z_A-Z][a-z_A-Z0-9]*"); @@ -2833,7 +2809,7 @@ done: return result; } -static void addVariable(Entry *root,int isFuncPtr=-1) +static void addVariable(const Entry *root,int isFuncPtr=-1) { static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); @@ -2849,48 +2825,52 @@ static void addVariable(Entry *root,int isFuncPtr=-1) ); //printf("root->parent->name=%s\n",root->parent->name.data()); - if (root->type.isEmpty() && root->name.find("operator")==-1 && - (root->name.find('*')!=-1 || root->name.find('&')!=-1)) + QCString type = root->type; + QCString name = root->name; + QCString args = root->args; + if (type.isEmpty() && name.find("operator")==-1 && + (name.find('*')!=-1 || name.find('&')!=-1)) { // recover from parse error caused by redundant braces // like in "int *(var[10]);", which is parsed as // type="" name="int *" args="(var[10])" - root->type=root->name; + type=name; static const QRegExp reName("[a-z_A-Z][a-z_A-Z0-9]*"); int l=0; - int i=root->args.isEmpty() ? -1 : reName.match(root->args,0,&l); + int i=args.isEmpty() ? -1 : reName.match(args,0,&l); if (i!=-1) { - root->name=root->args.mid(i,l); - root->args=root->args.mid(i+l,root->args.find(')',i+l)-i-l); + name=args.mid(i,l); + args=args.mid(i+l,args.find(')',i+l)-i-l); } //printf("new: type='%s' name='%s' args='%s'\n", - // root->type.data(),root->name.data(),root->args.data()); + // type.data(),name.data(),args.data()); } else { int i=isFuncPtr; - if (i==-1 && (root->spec&Entry::Alias)==0) i=findFunctionPtr(root->type,root->lang); // for typedefs isFuncPtr is not yet set + if (i==-1 && (root->spec&Entry::Alias)==0) i=findFunctionPtr(type,root->lang); // for typedefs isFuncPtr is not yet set Debug::print(Debug::Variables,0," functionPtr? %s\n",i!=-1?"yes":"no"); if (i!=-1) // function pointer { - int ai = root->type.find('[',i); + int ai = type.find('[',i); if (ai>i) // function pointer array { - root->args.prepend(root->type.right(root->type.length()-ai)); - root->type=root->type.left(ai); + args.prepend(type.right(type.length()-ai)); + type=type.left(ai); } - else if (root->type.find(')',i)!=-1) // function ptr, not variable like "int (*bla)[10]" + else if (type.find(')',i)!=-1) // function ptr, not variable like "int (*bla)[10]" { - root->type=root->type.left(root->type.length()-1); - root->args.prepend(") "); - //printf("root->type=%s root->args=%s\n",root->type.data(),root->args.data()); + type=type.left(type.length()-1); + args.prepend(") "); + //printf("type=%s args=%s\n",type.data(),args.data()); } } } - QCString scope,name=removeRedundantWhiteSpace(root->name); + QCString scope; + name=removeRedundantWhiteSpace(name); // find the scope of this variable Entry *p = root->parent(); @@ -2906,7 +2886,7 @@ static void addVariable(Entry *root,int isFuncPtr=-1) } MemberType mtype; - QCString type=root->type.stripWhiteSpace(); + type=type.stripWhiteSpace(); ClassDef *cd=0; bool isRelated=FALSE; bool isMemberOf=FALSE; @@ -2915,10 +2895,10 @@ static void addVariable(Entry *root,int isFuncPtr=-1) classScope=stripTemplateSpecifiersFromScope(classScope,FALSE); QCString annScopePrefix=scope.left(scope.length()-classScope.length()); - if (root->name.findRev("::")!=-1) + if (name.findRev("::")!=-1) { - if (root->type=="friend class" || root->type=="friend struct" || - root->type=="friend union") + if (type=="friend class" || type=="friend struct" || + type=="friend union") { cd=getClass(scope); if (cd) @@ -2926,7 +2906,9 @@ static void addVariable(Entry *root,int isFuncPtr=-1) addVariableToClass(root, // entry cd, // class to add member to MemberType_Friend, // type of member - name, // name of the member + type, // type value as string + name, // name of the member + args, // arguments as string FALSE, // from Anonymous scope 0, // anonymous member Public, // protection @@ -3001,7 +2983,9 @@ static void addVariable(Entry *root,int isFuncPtr=-1) md=addVariableToClass(root, // entry pcd, // class to add member to mtype, // member type + type, // type value as string name, // member name + args, // arguments as string TRUE, // from anonymous scope 0, // from anonymous member root->protection, @@ -3013,7 +2997,7 @@ static void addVariable(Entry *root,int isFuncPtr=-1) { if (mtype==MemberType_Variable) { - md=addVariableToFile(root,mtype,pScope,name,TRUE,0); + md=addVariableToFile(root,mtype,pScope,type,name,args,TRUE,0); } //added=TRUE; } @@ -3026,7 +3010,9 @@ static void addVariable(Entry *root,int isFuncPtr=-1) addVariableToClass(root, // entry cd, // class to add member to mtype, // member type + type, // type value as string name, // name of the member + args, // arguments as string FALSE, // from anonymous scope md, // from anonymous member root->protection, @@ -3035,7 +3021,7 @@ static void addVariable(Entry *root,int isFuncPtr=-1) else if (!name.isEmpty()) // global variable { //printf("Inserting member in global scope %s!\n",scope.data()); - addVariableToFile(root,mtype,scope,name,FALSE,/*0,*/0); + addVariableToFile(root,mtype,scope,type,name,args,FALSE,/*0,*/0); } } @@ -3043,7 +3029,7 @@ static void addVariable(Entry *root,int isFuncPtr=-1) //---------------------------------------------------------------------- // Searches the Entry tree for typedef documentation sections. // If found they are stored in their class or in the global list. -static void buildTypedefList(Entry *root) +static void buildTypedefList(const Entry *root) { //printf("buildVarList(%s)\n",rootNav->name().data()); if (!root->name.isEmpty() && @@ -3053,24 +3039,15 @@ static void buildTypedefList(Entry *root) { addVariable(root); } - if (root->children()) - { - EntryListIterator eli(*root->children()); - Entry *e; - for (;(e=eli.current());++eli) - { - if (e->section!=Entry::ENUM_SEC) - { - buildTypedefList(e); - } - } - } + for (const auto &e : root->children()) + if (e->section!=Entry::ENUM_SEC) + buildTypedefList(e.get()); } //---------------------------------------------------------------------- // Searches the Entry tree for sequence documentation sections. // If found they are stored in the global list. -static void buildSequenceList(Entry *root) +static void buildSequenceList(const Entry *root) { if (!root->name.isEmpty() && root->section==Entry::VARIABLE_SEC && @@ -3079,24 +3056,15 @@ static void buildSequenceList(Entry *root) { addVariable(root); } - if (root->children()) - { - EntryListIterator eli(*root->children()); - Entry *e; - for (;(e=eli.current());++eli) - { - if (e->section!=Entry::ENUM_SEC) - { - buildSequenceList(e); - } - } - } + for (const auto &e : root->children()) + if (e->section!=Entry::ENUM_SEC) + buildSequenceList(e.get()); } //---------------------------------------------------------------------- // Searches the Entry tree for dictionary documentation sections. // If found they are stored in the global list. -static void buildDictionaryList(Entry *root) +static void buildDictionaryList(const Entry *root) { if (!root->name.isEmpty() && root->section==Entry::VARIABLE_SEC && @@ -3105,25 +3073,16 @@ static void buildDictionaryList(Entry *root) { addVariable(root); } - if (root->children()) - { - EntryListIterator eli(*root->children()); - Entry *e; - for (;(e=eli.current());++eli) - { - if (e->section!=Entry::ENUM_SEC) - { - buildDictionaryList(e); - } - } - } + for (const auto &e : root->children()) + if (e->section!=Entry::ENUM_SEC) + buildDictionaryList(e.get()); } //---------------------------------------------------------------------- // Searches the Entry tree for Variable documentation sections. // If found they are stored in their class or in the global list. -static void buildVarList(Entry *root) +static void buildVarList(const Entry *root) { //printf("buildVarList(%s) section=%08x\n",rootNav->name().data(),rootNav->section()); int isFuncPtr=-1; @@ -3143,18 +3102,9 @@ static void buildVarList(Entry *root) { addVariable(root,isFuncPtr); } - if (root->children()) - { - EntryListIterator eli(*root->children()); - Entry *e; - for (;(e=eli.current());++eli) - { - if (e->section!=Entry::ENUM_SEC) - { - buildVarList(e); - } - } - } + for (const auto &e : root->children()) + if (e->section!=Entry::ENUM_SEC) + buildVarList(e.get()); } //---------------------------------------------------------------------- @@ -3163,7 +3113,7 @@ static void buildVarList(Entry *root) // static void addInterfaceOrServiceToServiceOrSingleton( - Entry *const root, + const Entry *root, ClassDef *const cd, QCString const& rname) { @@ -3235,11 +3185,11 @@ static void addInterfaceOrServiceToServiceOrSingleton( cd->insertUsedFile(fd); addMemberToGroups(root,md); - root->changeSection(Entry::EMPTY_SEC); + root->markAsProcessed(); md->setRefItems(root->sli); } -static void buildInterfaceAndServiceList(Entry *root) +static void buildInterfaceAndServiceList(const Entry *root) { if (root->section==Entry::EXPORTED_INTERFACE_SEC || root->section==Entry::INCLUDED_SERVICE_SEC) @@ -3292,7 +3242,7 @@ static void buildInterfaceAndServiceList(Entry *root) { case SrcLangExt_Unknown: // fall through (root node always is Unknown) case SrcLangExt_IDL: - RECURSE_ENTRYTREE(buildInterfaceAndServiceList,root); + for (const auto &e : root->children()) buildInterfaceAndServiceList(e.get()); break; default: return; // nothing to do here @@ -3304,26 +3254,32 @@ static void buildInterfaceAndServiceList(Entry *root) // Searches the Entry tree for Function sections. // If found they are stored in their class or in the global list. -static void addMethodToClass(Entry *root,ClassDef *cd, - const QCString &rname,bool isFriend) +static void addMethodToClass(const Entry *root,ClassDef *cd, + const QCString &rtype,const QCString &rname,const QCString &rargs, + bool isFriend, + Protection protection,bool stat,Specifier virt,uint64 spec, + const QCString &relates + ) { FileDef *fd=root->fileDef(); int l; static QRegExp re("([a-z_A-Z0-9: ]*[ &*]+[ ]*"); - int ts=root->type.find('<'); - int te=root->type.findRev('>'); - int i=re.match(root->type,0,&l); + QCString type = rtype; + QCString args = rargs; + int ts=type.find('<'); + int te=type.findRev('>'); + int i=re.match(type,0,&l); if (i!=-1 && ts!=-1 && ts, see bug 677315 { i=-1; } if (cd->getLanguage()==SrcLangExt_Cpp && // only C has pointers - !root->type.isEmpty() && (root->spec&Entry::Alias)==0 && i!=-1) // function variable + !type.isEmpty() && (root->spec&Entry::Alias)==0 && i!=-1) // function variable { - root->args+=root->type.right(root->type.length()-i-l); - root->type=root->type.left(i+l); + args+=type.right(type.length()-i-l); + type=type.left(i+l); } QCString name=removeRedundantWhiteSpace(rname); @@ -3349,17 +3305,17 @@ static void addMethodToClass(Entry *root,ClassDef *cd, fileName = root->tagInfo->tagName; } - //printf("root->name='%s; root->args='%s' root->argList='%s'\n", - // root->name.data(),root->args.data(),argListToString(root->argList).data() + //printf("root->name='%s; args='%s' root->argList='%s'\n", + // root->name.data(),args.data(),argListToString(root->argList).data() // ); // adding class member MemberDef *md=createMemberDef( fileName,root->startLine,root->startColumn, - root->type,name,root->args,root->exception, - root->protection,root->virt, - root->stat && root->relatesType != MemberOf, - root->relates.isEmpty() ? Member : + type,name,args,root->exception, + protection,virt, + stat && root->relatesType != MemberOf, + relates.isEmpty() ? Member : root->relatesType == MemberOf ? Foreign : Related, mtype,root->tArgLists ? root->tArgLists->getLast() : 0,root->argList, root->metaData); md->setTagInfo(root->tagInfo); @@ -3369,7 +3325,7 @@ static void addMethodToClass(Entry *root,ClassDef *cd, md->setBriefDescription(root->brief,root->briefFile,root->briefLine); md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); md->setBodySegment(root->bodyLine,root->endBodyLine); - md->setMemberSpecifiers(root->spec); + md->setMemberSpecifiers(spec); md->setMemberGroupId(root->mGrpId); md->setTypeConstraints(root->typeConstr); md->setLanguage(root->lang); @@ -3391,17 +3347,17 @@ static void addMethodToClass(Entry *root,ClassDef *cd, // for PHP we use Class::method and Namespace\method scopeSeparator="::"; } - if (!root->relates.isEmpty() || isFriend || Config_getBool(HIDE_SCOPE_NAMES)) + if (!relates.isEmpty() || isFriend || Config_getBool(HIDE_SCOPE_NAMES)) { - if (!root->type.isEmpty()) + if (!type.isEmpty()) { if (root->argList) { - def=root->type+" "+name; + def=type+" "+name; } else { - def=root->type+" "+name+root->args; + def=type+" "+name+args; } } else @@ -3412,21 +3368,21 @@ static void addMethodToClass(Entry *root,ClassDef *cd, } else { - def=name+root->args; + def=name+args; } } } else { - if (!root->type.isEmpty()) + if (!type.isEmpty()) { if (root->argList) { - def=root->type+" "+qualScope+scopeSeparator+name; + def=type+" "+qualScope+scopeSeparator+name; } else { - def=root->type+" "+qualScope+scopeSeparator+name+root->args; + def=type+" "+qualScope+scopeSeparator+name+args; } } else @@ -3437,7 +3393,7 @@ static void addMethodToClass(Entry *root,ClassDef *cd, } else { - def=qualScope+scopeSeparator+name+root->args; + def=qualScope+scopeSeparator+name+args; } } } @@ -3452,10 +3408,10 @@ static void addMethodToClass(Entry *root,ClassDef *cd, " Func Member:\n" " '%s' '%s'::'%s' '%s' proto=%d\n" " def='%s'\n", - qPrint(root->type), + qPrint(type), qPrint(qualScope), qPrint(rname), - qPrint(root->args), + qPrint(args), root->proto, qPrint(def) ); @@ -3480,12 +3436,12 @@ static void addMethodToClass(Entry *root,ClassDef *cd, cd->insertUsedFile(fd); addMemberToGroups(root,md); - root->changeSection(Entry::EMPTY_SEC); + root->markAsProcessed(); md->setRefItems(root->sli); } -static void buildFunctionList(Entry *root) +static void buildFunctionList(const Entry *root) { if (root->section==Entry::FUNCTION_SEC) { @@ -3576,7 +3532,8 @@ static void buildFunctionList(Entry *root) { Debug::print(Debug::Functions,0," --> member %s of class %s!\n", qPrint(rname),qPrint(cd->name())); - addMethodToClass(root,cd,rname,isFriend); + addMethodToClass(root,cd,root->type,rname,root->args,isFriend, + root->protection,root->stat,root->virt,root->spec,root->relates); } else if (!((root->parent()->section & Entry::COMPOUND_MASK) || root->parent()->section==Entry::OBJCIMPL_SEC @@ -3880,9 +3837,7 @@ static void buildFunctionList(Entry *root) if (root->relatesType == Simple) // if this is a relatesalso command, // allow find Member to pick it up { - root->changeSection(Entry::EMPTY_SEC); // Otherwise we have finished - // with this entry. - + root->markAsProcessed(); // Otherwise we have finished with this entry. } } else @@ -3911,7 +3866,7 @@ static void buildFunctionList(Entry *root) ); } } - RECURSE_ENTRYTREE(buildFunctionList,root); + for (const auto &e : root->children()) buildFunctionList(e.get()); } //---------------------------------------------------------------------- @@ -4259,7 +4214,7 @@ static ClassDef *findClassWithinClassContext(Definition *context,ClassDef *cd,co } -static void findUsedClassesForClass(Entry *root, +static void findUsedClassesForClass(const Entry *root, Definition *context, ClassDef *masterCd, ClassDef *instanceCd, @@ -4429,7 +4384,7 @@ static void findUsedClassesForClass(Entry *root, } static void findBaseClassesForClass( - Entry *root, + const Entry *root, Definition *context, ClassDef *masterCd, ClassDef *instanceCd, @@ -4491,7 +4446,7 @@ static void findBaseClassesForClass( //---------------------------------------------------------------------- -static bool findTemplateInstanceRelation(Entry *root, +static bool findTemplateInstanceRelation(const Entry *root, Definition *context, ClassDef *templateClass,const QCString &templSpec, QDict *templateNames, @@ -4531,9 +4486,10 @@ static bool findTemplateInstanceRelation(Entry *root, // search for new template instances caused by base classes of // instanceClass - Entry *templateRoot = g_classEntries.find(templateClass->name()); - if (templateRoot) + auto it = g_classEntries.find(templateClass->name().data()); + if (it!=g_classEntries.end()) { + const Entry *templateRoot = it->second; Debug::print(Debug::Classes,0," template root found %s templSpec=%s!\n", qPrint(templateRoot->name),qPrint(templSpec)); ArgumentList *templArgs = new ArgumentList; @@ -4653,7 +4609,7 @@ static int findEndOfTemplate(const QCString &s,int startPos) } static bool findClassRelation( - Entry *root, + const Entry *root, Definition *context, ClassDef *cd, BaseInfo *bi, @@ -5010,7 +4966,7 @@ static bool findClassRelation( //---------------------------------------------------------------------- // Computes the base and super classes for each class in the tree -static bool isClassSection(Entry *root) +static bool isClassSection(const Entry *root) { if ( !root->name.isEmpty() ) { @@ -5032,16 +4988,16 @@ static bool isClassSection(Entry *root) /*! Builds a dictionary of all entry nodes in the tree starting with \a root */ -static void findClassEntries(Entry *root) +static void findClassEntries(const Entry *root) { if (isClassSection(root)) { - g_classEntries.insert(root->name,root); + g_classEntries.insert({root->name.data(),root}); } - RECURSE_ENTRYTREE(findClassEntries,root); + for (const auto &e : root->children()) findClassEntries(e.get()); } -static QCString extractClassName(Entry *root) +static QCString extractClassName(const Entry *root) { // strip any anonymous scopes first QCString bName=stripAnonymousNamespaceScope(root->name); @@ -5066,10 +5022,9 @@ static void findInheritedTemplateInstances() { ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); - QDictIterator edi(g_classEntries); - Entry *root; - for (;(root=edi.current());++edi) + for (const auto &kv : g_classEntries) { + const Entry *root = kv.second; ClassDef *cd; QCString bName = extractClassName(root); Debug::print(Debug::Classes,0," Inheritance: Class %s : \n",qPrint(bName)); @@ -5085,10 +5040,9 @@ static void findUsedTemplateInstances() { ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); - QDictIterator edi(g_classEntries); - Entry *root; - for (;(root=edi.current());++edi) + for (const auto &kv : g_classEntries) { + const Entry *root = kv.second; ClassDef *cd; QCString bName = extractClassName(root); Debug::print(Debug::Classes,0," Usage: Class %s : \n",qPrint(bName)); @@ -5104,10 +5058,9 @@ static void computeClassRelations() { ClassSDict::Iterator cli(*Doxygen::classSDict); for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); - QDictIterator edi(g_classEntries); - Entry *root; - for (;(root=edi.current());++edi) + for (const auto &kv : g_classEntries) { + const Entry *root = kv.second; ClassDef *cd; QCString bName = extractClassName(root); @@ -5137,10 +5090,9 @@ static void computeClassRelations() static void computeTemplateClassRelations() { - QDictIterator edi(g_classEntries); - Entry *root; - for (;(root=edi.current());++edi) + for (const auto &kv : g_classEntries) { + const Entry *root = kv.second; QCString bName=stripAnonymousNamespaceScope(root->name); bName=stripTemplateSpecifiersFromScope(bName); ClassDef *cd=getClass(bName); @@ -5340,15 +5292,15 @@ static void generateXRefPages() // set the function declaration of the member to 'funcDecl'. If the boolean // over_load is set the standard overload text is added. -static void addMemberDocs(Entry *root, +static void addMemberDocs(const Entry *root, MemberDef *md, const char *funcDecl, ArgumentList *al, bool over_load, - NamespaceSDict * + uint64 spec ) { //printf("addMemberDocs: '%s'::'%s' '%s' funcDecl='%s' mSpec=%d\n", - // root->parent->name.data(),md->name().data(),md->argsString(),funcDecl,root->spec); + // root->parent->name.data(),md->name().data(),md->argsString(),funcDecl,spec); QCString fDecl=funcDecl; // strip extern specifier fDecl.stripPrefix("extern "); @@ -5452,7 +5404,7 @@ static void addMemberDocs(Entry *root, md->enableReferencedByRelation(md->hasReferencedByRelation() || root->referencedByRelation); md->enableReferencesRelation(md->hasReferencesRelation() || root->referencesRelation); - md->mergeMemberSpecifiers(root->spec); + md->mergeMemberSpecifiers(spec); md->addSectionsToDefinition(root->anchors); addMemberToGroups(root,md); if (cd) cd->insertUsedFile(rfd); @@ -5496,13 +5448,14 @@ static const ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, // with name 'name' and argument list 'args' (for overloading) and // function declaration 'decl' to the corresponding member definition. -static bool findGlobalMember(Entry *root, +static bool findGlobalMember(const Entry *root, const QCString &namespaceName, const char *type, const char *name, const char *tempArg, const char *, - const char *decl) + const char *decl, + uint64 spec) { Debug::print(Debug::FindMembers,0, "2. findGlobalMember(namespace=%s,type=%s,name=%s,tempArg=%s,decl=%s)\n", @@ -5612,7 +5565,7 @@ static bool findGlobalMember(Entry *root, if (matching) // add docs to the member { Debug::print(Debug::FindMembers,0,"5. Match found\n"); - addMemberDocs(root,md->resolveAlias(),decl,root->argList,FALSE); + addMemberDocs(root,md->resolveAlias(),decl,root->argList,FALSE,root->spec); found=TRUE; } } @@ -5822,7 +5775,10 @@ static void substituteTemplatesInArgList( * The boolean \a isFunc is a hint that indicates that this is a function * instead of a variable or typedef. */ -static void findMember(Entry *root, +static void findMember(const Entry *root, + const QCString &relates, + const QCString &type, + const QCString &args, QCString funcDecl, bool overloaded, bool isFunc @@ -5832,7 +5788,7 @@ static void findMember(Entry *root, "findMember(root=%p,funcDecl='%s',related='%s',overload=%d," "isFunc=%d mGrpId=%d tArgList=%p (#=%d) " "spec=%lld lang=%x\n", - root,qPrint(funcDecl),qPrint(root->relates),overloaded,isFunc,root->mGrpId, + root,qPrint(funcDecl),qPrint(relates),overloaded,isFunc,root->mGrpId, root->tArgLists,root->tArgLists ? root->tArgLists->count() : 0, root->spec,root->lang ); @@ -5850,6 +5806,7 @@ static void findMember(Entry *root, bool isMemberOf=FALSE; bool isFriend=FALSE; bool done; + uint64 spec = root->spec; do { done=TRUE; @@ -5860,17 +5817,17 @@ static void findMember(Entry *root, } if (funcDecl.stripPrefix("inline ")) { - root->spec|=Entry::Inline; + spec|=Entry::Inline; done=FALSE; } if (funcDecl.stripPrefix("explicit ")) { - root->spec|=Entry::Explicit; + spec|=Entry::Explicit; done=FALSE; } if (funcDecl.stripPrefix("mutable ")) { - root->spec|=Entry::Mutable; + spec|=Entry::Mutable; done=FALSE; } if (funcDecl.stripPrefix("virtual ")) @@ -5926,21 +5883,21 @@ static void findMember(Entry *root, // related field. //printf("scopeName='%s' className='%s' namespaceName='%s'\n", // scopeName.data(),className.data(),namespaceName.data()); - if (!root->relates.isEmpty()) + if (!relates.isEmpty()) { // related member, prefix user specified scope isRelated=TRUE; isMemberOf=(root->relatesType == MemberOf); - if (getClass(root->relates)==0 && !scopeName.isEmpty()) + if (getClass(relates)==0 && !scopeName.isEmpty()) { - scopeName= mergeScopes(scopeName,root->relates); + scopeName= mergeScopes(scopeName,relates); } else { - scopeName = root->relates; + scopeName = relates; } } - if (root->relates.isEmpty() && root->parent() && + if (relates.isEmpty() && root->parent() && ((root->parent()->section&Entry::SCOPE_MASK) || (root->parent()->section==Entry::OBJCIMPL_SEC) ) && @@ -6015,7 +5972,7 @@ static void findMember(Entry *root, { scopeName=namespaceName; } - else if (!root->relates.isEmpty() || // relates command with explicit scope + else if (!relates.isEmpty() || // relates command with explicit scope !getClass(className)) // class name only exists in a namespace { scopeName=namespaceName+"::"+className; @@ -6122,7 +6079,7 @@ static void findMember(Entry *root, " isFunc=%d\n\n", qPrint(namespaceName),qPrint(className), qPrint(funcType),qPrint(funcSpec),qPrint(funcName),qPrint(funcArgs),qPrint(funcTempList), - qPrint(funcDecl),qPrint(root->relates),qPrint(exceptions),isRelated,isMemberOf,isFriend, + qPrint(funcDecl),qPrint(relates),qPrint(exceptions),isRelated,isMemberOf,isFriend, isFunc ); @@ -6306,11 +6263,8 @@ static void findMember(Entry *root, // specialization. In this case we add it to the class // even though the member arguments do not match. - // TODO: copy other aspects? - root->protection=md->protection(); // copy protection level - root->stat=md->isStatic(); - root->virt=md->virtualness(); - addMethodToClass(root,cd,md->name(),isFriend); + addMethodToClass(root,cd,type,md->name(),args,isFriend, + md->protection(),md->isStatic(),md->virtualness(),spec,relates); return; } delete argList; @@ -6318,7 +6272,7 @@ static void findMember(Entry *root, } if (matching) { - addMemberDocs(root,md,funcDecl,0,overloaded,0/* TODO */); + addMemberDocs(root,md,funcDecl,0,overloaded,spec); count++; memFound=TRUE; } @@ -6354,10 +6308,8 @@ static void findMember(Entry *root, root->tArgLists->getLast()->count()<=templAl->count()) { Debug::print(Debug::FindMembers,0,"7. add template specialization\n"); - root->protection=md->protection(); - root->stat=md->isStatic(); - root->virt=md->virtualness(); - addMethodToClass(root,ccd,md->name(),isFriend); + addMethodToClass(root,ccd,type,md->name(),args,isFriend, + root->protection,root->stat,root->virt,spec,relates); return; } if (md->argsString()==argListToString(root->argList,TRUE,FALSE)) @@ -6387,7 +6339,7 @@ static void findMember(Entry *root, { // we didn't find an actual match on argument lists, but there is only 1 member with this // name in the same scope, so that has to be the one. - addMemberDocs(root,umd,funcDecl,0,overloaded,0); + addMemberDocs(root,umd,funcDecl,0,overloaded,spec); return; } else if (candidates>1 && ecd && emd) @@ -6395,7 +6347,7 @@ static void findMember(Entry *root, // we didn't find a unique match using type resolution, // but one of the matches has the exact same signature so // we take that one. - addMemberDocs(root,emd,funcDecl,0,overloaded,0); + addMemberDocs(root,emd,funcDecl,0,overloaded,spec); return; } } @@ -6505,7 +6457,7 @@ static void findMember(Entry *root, md->setBodySegment(root->bodyLine,root->endBodyLine); FileDef *fd=root->fileDef(); md->setBodyDef(fd); - md->setMemberSpecifiers(root->spec); + md->setMemberSpecifiers(spec); md->setMemberGroupId(root->mGrpId); mn->append(md); cd->insertMember(md); @@ -6575,7 +6527,7 @@ static void findMember(Entry *root, md->setBodySegment(root->bodyLine,root->endBodyLine); FileDef *fd=root->fileDef(); md->setBodyDef(fd); - md->setMemberSpecifiers(root->spec); + md->setMemberSpecifiers(spec); md->setMemberGroupId(root->mGrpId); mn->append(md); cd->insertMember(md); @@ -6585,7 +6537,7 @@ static void findMember(Entry *root, } else // unrelated function with the same name as a member { - if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl)) + if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec)) { QCString fullFuncDecl=funcDecl.copy(); if (isFunc) fullFuncDecl+=argListToString(root->argList,TRUE); @@ -6596,11 +6548,11 @@ static void findMember(Entry *root, } } } - else if (isRelated && !root->relates.isEmpty()) + else if (isRelated && !relates.isEmpty()) { Debug::print(Debug::FindMembers,0,"2. related function\n" " scopeName=%s className=%s\n",qPrint(scopeName),qPrint(className)); - if (className.isEmpty()) className=root->relates; + if (className.isEmpty()) className=relates; ClassDef *cd; //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); if ((cd=getClass(scopeName))) @@ -6649,7 +6601,7 @@ static void findMember(Entry *root, { //printf("addMemberDocs for related member %s\n",root->name.data()); //rmd->setMemberDefTemplateArguments(root->mtArgList); - addMemberDocs(root,rmd,funcDecl,0,overloaded); + addMemberDocs(root,rmd,funcDecl,0,overloaded,spec); } } @@ -6763,7 +6715,7 @@ static void findMember(Entry *root, // md->setMemberGroup(memberGroupDict[root->mGrpId]); //} md->setMemberClass(cd); - md->setMemberSpecifiers(root->spec); + md->setMemberSpecifiers(spec); md->setDefinition(funcDecl); md->enableCallGraph(root->callGraph); md->enableCallerGraph(root->callerGraph); @@ -6798,7 +6750,7 @@ static void findMember(Entry *root, } if (root->relatesType == Duplicate) { - if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl)) + if (!findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec)) { QCString fullFuncDecl=funcDecl.copy(); if (isFunc) fullFuncDecl+=argListToString(root->argList,TRUE); @@ -6852,7 +6804,7 @@ localObjCMethod: md->setBodySegment(root->bodyLine,root->endBodyLine); FileDef *fd=root->fileDef(); md->setBodyDef(fd); - md->setMemberSpecifiers(root->spec); + md->setMemberSpecifiers(spec); md->setMemberGroupId(root->mGrpId); cd->insertMember(md); cd->insertUsedFile(fd); @@ -6875,7 +6827,7 @@ localObjCMethod: } else // unrelated not overloaded member found { - bool globMem = findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl); + bool globMem = findGlobalMember(root,namespaceName,funcType,funcName,funcTempList,funcArgs,funcDecl,spec); if (className.isEmpty() && !globMem) { warn(root->fileName,root->startLine, @@ -6904,7 +6856,7 @@ localObjCMethod: // find the members corresponding to the different documentation blocks // that are extracted from the sources. -static void filterMemberDocumentation(Entry *root) +static void filterMemberDocumentation(const Entry *root,const QCString relates) { int i=-1,l; Debug::print(Debug::FindMembers,0, @@ -6914,26 +6866,20 @@ static void filterMemberDocumentation(Entry *root) //printf("root->parent()->name=%s\n",root->parent()->name.data()); bool isFunc=TRUE; - if (root->relatesType == Duplicate && !root->relates.isEmpty()) - { - QCString tmp = root->relates; - root->relates.resize(0); - filterMemberDocumentation(root); - root->relates = tmp; - } - + QCString type = root->type; + QCString args = root->args; if ( // detect func variable/typedef to func ptr - (i=findFunctionPtr(root->type,root->lang,&l))!=-1 + (i=findFunctionPtr(type,root->lang,&l))!=-1 ) { //printf("Fixing function pointer!\n"); // fix type and argument - root->args.prepend(root->type.right(root->type.length()-i-l)); - root->type=root->type.left(i+l); - //printf("Results type=%s,name=%s,args=%s\n",root->type.data(),root->name.data(),root->args.data()); + args.prepend(type.right(type.length()-i-l)); + type=type.left(i+l); + //printf("Results type=%s,name=%s,args=%s\n",type.data(),root->name.data(),args.data()); isFunc=FALSE; } - else if ((root->type.left(8)=="typedef " && root->args.find('(')!=-1)) + else if ((type.left(8)=="typedef " && args.find('(')!=-1)) // detect function types marked as functions { isFunc=FALSE; @@ -6943,80 +6889,117 @@ static void filterMemberDocumentation(Entry *root) if (root->section==Entry::MEMBERDOC_SEC) { //printf("Documentation for inline member '%s' found args='%s'\n", - // root->name.data(),root->args.data()); - //if (root->relates.length()) printf(" Relates %s\n",root->relates.data()); - if (root->type.isEmpty()) - { - findMember(root,root->name+root->args+root->exception,FALSE,isFunc); + // root->name.data(),args.data()); + //if (relates.length()) printf(" Relates %s\n",relates.data()); + if (type.isEmpty()) + { + findMember(root, + relates, + type, + args, + root->name + args + root->exception, + FALSE, + isFunc); } else { - findMember(root,root->type+" "+root->name+root->args+root->exception,FALSE,isFunc); + findMember(root, + relates, + type, + args, + type + " " + root->name + args + root->exception, + FALSE, + isFunc); } } else if (root->section==Entry::OVERLOADDOC_SEC) { //printf("Overloaded member %s found\n",root->name.data()); - findMember(root,root->name,TRUE,isFunc); + findMember(root, + relates, + type, + args, + root->name, + TRUE, + isFunc); } else if ((root->section==Entry::FUNCTION_SEC // function || (root->section==Entry::VARIABLE_SEC && // variable - !root->type.isEmpty() && // with a type - g_compoundKeywordDict.find(root->type)==0 // that is not a keyword + !type.isEmpty() && // with a type + g_compoundKeywordDict.find(type)==0 // that is not a keyword // (to skip forward declaration of class etc.) ) ) ) { //printf("Documentation for member '%s' found args='%s' excp='%s'\n", - // root->name.data(),root->args.data(),root->exception.data()); - //if (root->relates.length()) printf(" Relates %s\n",root->relates.data()); - //printf("Inside=%s\n Relates=%s\n",root->inside.data(),root->relates.data()); - if (root->type=="friend class" || root->type=="friend struct" || - root->type=="friend union") + // root->name.data(),args.data(),root->exception.data()); + //if (relates.length()) printf(" Relates %s\n",relates.data()); + //printf("Inside=%s\n Relates=%s\n",root->inside.data(),relates.data()); + if (type=="friend class" || type=="friend struct" || + type=="friend union") { findMember(root, - root->type+" "+ - root->name, + relates, + type, + args, + type+" "+root->name, FALSE,FALSE); } - else if (!root->type.isEmpty()) + else if (!type.isEmpty()) { findMember(root, - root->type+" "+ - root->inside+ - root->name+ - root->args+ - root->exception, + relates, + type, + args, + type+" "+ root->inside + root->name + args + root->exception, FALSE,isFunc); } else { findMember(root, - root->inside+ - root->name+ - root->args+ - root->exception, + relates, + type, + args, + root->inside + root->name + args + root->exception, FALSE,isFunc); } } - else if (root->section==Entry::DEFINE_SEC && !root->relates.isEmpty()) + else if (root->section==Entry::DEFINE_SEC && !relates.isEmpty()) { - findMember(root,root->name+root->args,FALSE,!root->args.isEmpty()); + findMember(root, + relates, + type, + args, + root->name + args, + FALSE, + !args.isEmpty()); } else if (root->section==Entry::VARIABLEDOC_SEC) { //printf("Documentation for variable %s found\n",root->name.data()); - //if (!root->relates.isEmpty()) printf(" Relates %s\n",root->relates.data()); - findMember(root,root->name,FALSE,FALSE); + //if (!relates.isEmpty()) printf(" Relates %s\n",relates.data()); + findMember(root, + relates, + type, + args, + root->name, + FALSE, + FALSE); } else if (root->section==Entry::EXPORTED_INTERFACE_SEC || root->section==Entry::INCLUDED_SERVICE_SEC) { - findMember(root,root->type + " " + root->name,FALSE,FALSE); + findMember(root, + relates, + type, + args, + type + " " + root->name, + FALSE, + FALSE); } else { @@ -7025,7 +7008,7 @@ static void filterMemberDocumentation(Entry *root) } } -static void findMemberDocumentation(Entry *root) +static void findMemberDocumentation(const Entry *root) { if (root->section==Entry::MEMBERDOC_SEC || root->section==Entry::OVERLOADDOC_SEC || @@ -7037,42 +7020,41 @@ static void findMemberDocumentation(Entry *root) root->section==Entry::EXPORTED_INTERFACE_SEC ) { - filterMemberDocumentation(root); + if (root->relatesType == Duplicate && !root->relates.isEmpty()) + { + filterMemberDocumentation(root,""); + } + filterMemberDocumentation(root,root->relates); } - if (root->children()) + for (const auto &e : root->children()) { - EntryListIterator eli(*root->children()); - Entry *e; - for (;(e=eli.current());++eli) + if (e->section!=Entry::ENUM_SEC) { - if (e->section!=Entry::ENUM_SEC) findMemberDocumentation(e); + findMemberDocumentation(e.get()); } } } //---------------------------------------------------------------------- -static void findObjCMethodDefinitions(Entry *root) +static void findObjCMethodDefinitions(const Entry *root) { - if (root->children()) + for (const auto &objCImpl : root->children()) { - EntryListIterator eli(*root->children()); - Entry *objCImpl; - for (;(objCImpl=eli.current());++eli) + if (objCImpl->section==Entry::OBJCIMPL_SEC) { - if (objCImpl->section==Entry::OBJCIMPL_SEC && objCImpl->children()) + for (const auto &objCMethod : objCImpl->children()) { - EntryListIterator seli(*objCImpl->children()); - Entry *objCMethod; - for (;(objCMethod=seli.current());++seli) + if (objCMethod->section==Entry::FUNCTION_SEC) { - if (objCMethod->section==Entry::FUNCTION_SEC) - { - //Printf(" Found ObjC method definition %s\n",objCMethod->name.data()); - findMember(objCMethod, objCMethod->type+" "+objCImpl->name+"::"+ - objCMethod->name+" "+objCMethod->args, FALSE,TRUE); - objCMethod->section=Entry::EMPTY_SEC; - } + //Printf(" Found ObjC method definition %s\n",objCMethod->name.data()); + findMember(objCMethod.get(), + objCMethod->relates, + objCMethod->type, + objCMethod->args, + objCMethod->type+" "+objCImpl->name+"::"+objCMethod->name+" "+objCMethod->args, + FALSE,TRUE); + objCMethod->section=Entry::EMPTY_SEC; } } } @@ -7082,7 +7064,7 @@ static void findObjCMethodDefinitions(Entry *root) //---------------------------------------------------------------------- // find and add the enumeration to their classes, namespaces or files -static void findEnums(Entry *root) +static void findEnums(const Entry *root) { if (root->section==Entry::ENUM_SEC) { @@ -7255,13 +7237,13 @@ static void findEnums(Entry *root) } else { - RECURSE_ENTRYTREE(findEnums,root); + for (const auto &e : root->children()) findEnums(e.get()); } } //---------------------------------------------------------------------- -static void addEnumValuesToEnums(Entry *root) +static void addEnumValuesToEnums(const Entry *root) { if (root->section==Entry::ENUM_SEC) // non anonymous enumeration @@ -7337,12 +7319,10 @@ static void addEnumValuesToEnums(Entry *root) MemberDef *md; for (mni.toFirst(); (md=mni.current()) ; ++mni) // for each enum in this list { - if (!md->isAlias() && md->isEnumerate() && root->children()) + if (!md->isAlias() && md->isEnumerate() && !root->children().empty()) { //printf(" enum with %d children\n",root->children()->count()); - EntryListIterator eli(*root->children()); // for each enum value - Entry *e; - for (;(e=eli.current());++eli) + for (const auto &e : root->children()) { SrcLangExt sle; if ( @@ -7474,7 +7454,7 @@ static void addEnumValuesToEnums(Entry *root) } else { - RECURSE_ENTRYTREE(addEnumValuesToEnums,root); + for (const auto &e : root->children()) addEnumValuesToEnums(e.get()); } } @@ -7482,7 +7462,7 @@ static void addEnumValuesToEnums(Entry *root) //---------------------------------------------------------------------- // find the documentation blocks for the enumerations -static void findEnumDocumentation(Entry *root) +static void findEnumDocumentation(const Entry *root) { if (root->section==Entry::ENUMDOC_SEC && !root->name.isEmpty() @@ -7615,7 +7595,7 @@ static void findEnumDocumentation(Entry *root) } } } - RECURSE_ENTRYTREE(findEnumDocumentation,root); + for (const auto &e : root->children()) findEnumDocumentation(e.get()); } // search for each enum (member or function) in mnl if it has documented @@ -8730,12 +8710,12 @@ static void findDefineDocumentation(Entry *root) } } } - RECURSE_ENTRYTREE(findDefineDocumentation,root); + for (const auto &e : root->children()) findDefineDocumentation(e.get()); } //---------------------------------------------------------------------------- -static void findDirDocumentation(Entry *root) +static void findDirDocumentation(const Entry *root) { if (root->section == Entry::DIRDOC_SEC) { @@ -8791,7 +8771,7 @@ static void findDirDocumentation(Entry *root) "directory found for command \\dir %s\n",normalizedName.data()); } } - RECURSE_ENTRYTREE(findDirDocumentation,root); + for (const auto &e : root->children()) findDirDocumentation(e.get()); } @@ -8821,7 +8801,7 @@ static void buildPageList(Entry *root) 0,0 ); } - RECURSE_ENTRYTREE(buildPageList,root); + for (const auto &e : root->children()) buildPageList(e.get()); } // search for the main page defined in this project @@ -8875,7 +8855,7 @@ static void findMainPage(Entry *root) Doxygen::mainPage->docFile().data(),Doxygen::mainPage->docLine()); } } - RECURSE_ENTRYTREE(findMainPage,root); + for (const auto &e : root->children()) findMainPage(e.get()); } // search for the main page imported via tag files and add only the section labels @@ -8888,7 +8868,7 @@ static void findMainPageTagFiles(Entry *root) Doxygen::mainPage->addSectionsToDefinition(root->anchors); } } - RECURSE_ENTRYTREE(findMainPageTagFiles,root); + for (const auto &e : root->children()) findMainPageTagFiles(e.get()); } static void computePageRelations(Entry *root) @@ -8925,7 +8905,7 @@ static void computePageRelations(Entry *root) } } } - RECURSE_ENTRYTREE(computePageRelations,root); + for (const auto &e : root->children()) computePageRelations(e.get()); } static void checkPageRelations() @@ -9071,7 +9051,7 @@ static void buildExampleList(Entry *root) //addExampleToGroups(root,pd); } } - RECURSE_ENTRYTREE(buildExampleList,root); + for (const auto &e : root->children()) buildExampleList(e.get()); } //---------------------------------------------------------------------------- @@ -9085,10 +9065,9 @@ void printNavTree(Entry *root,int indent) indentStr.isEmpty()?"":indentStr.data(), root->name.isEmpty()?"":root->name.data(), root->section); - if (root->children()) + for (const auto &e : root->children()) { - EntryListIterator eli(*root->children()); - for (;eli.current();++eli) printNavTree(eli.current(),indent+2); + printNavTree(e.get(),indent+2); } } @@ -9310,7 +9289,7 @@ static void compareDoxyfile() //---------------------------------------------------------------------------- -static void readTagFile(Entry *root,const char *tl) +static void readTagFile(const std::unique_ptr &root,const char *tl) { QCString tagLine = tl; QCString fileName; @@ -9479,7 +9458,7 @@ static ParserInterface *getParserForFile(const char *fn) } static void parseFile(ParserInterface *parser, - Entry *root,FileDef *fd,const char *fn, + const std::unique_ptr &root,FileDef *fd,const char *fn, bool sameTu,QStrList &filesInSameTu) { #if USE_LIBCLANG @@ -9532,15 +9511,15 @@ static void parseFile(ParserInterface *parser, fd->getAllIncludeFilesRecursively(filesInSameTu); } - Entry *fileRoot = new Entry; + std::unique_ptr fileRoot = std::make_unique(); // use language parse to parse the file parser->parseInput(fileName,convBuf.data(),fileRoot,sameTu,filesInSameTu); fileRoot->setFileDef(fd); - root->addSubEntry(fileRoot); + root->moveToSubEntryAndKeep(fileRoot); } //! parse the list of input files -static void parseFiles(Entry *root) +static void parseFiles(const std::unique_ptr &root) { #if USE_LIBCLANG static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING); @@ -11346,7 +11325,7 @@ void parseInput() * Handle Tag Files * **************************************************************************/ - Entry *root=new Entry; + std::unique_ptr root = std::make_unique(); msg("Reading and parsing tag files\n"); QStrList &tagFileList = Config_getList(TAGFILES); @@ -11381,31 +11360,31 @@ void parseInput() **************************************************************************/ g_s.begin("Building group list...\n"); - buildGroupList(root); - organizeSubGroups(root); + buildGroupList(root.get()); + organizeSubGroups(root.get()); g_s.end(); g_s.begin("Building directory list...\n"); buildDirectories(); - findDirDocumentation(root); + findDirDocumentation(root.get()); g_s.end(); g_s.begin("Building namespace list...\n"); - buildNamespaceList(root); - findUsingDirectives(root); + buildNamespaceList(root.get()); + findUsingDirectives(root.get()); g_s.end(); g_s.begin("Building file list...\n"); - buildFileList(root); + buildFileList(root.get()); g_s.end(); //generateFileTree(); g_s.begin("Building class list...\n"); - buildClassList(root); + buildClassList(root.get()); g_s.end(); // build list of using declarations here (global list) - buildListOfUsingDecls(root); + buildListOfUsingDecls(root.get()); g_s.end(); g_s.begin("Computing nesting relations for classes...\n"); @@ -11422,14 +11401,14 @@ void parseInput() g_usingDeclarations.clear(); g_s.begin("Associating documentation with classes...\n"); - buildClassDocList(root); + buildClassDocList(root.get()); g_s.begin("Building example list...\n"); - buildExampleList(root); + buildExampleList(root.get()); g_s.end(); g_s.begin("Searching for enumerations...\n"); - findEnums(root); + findEnums(root.get()); g_s.end(); // Since buildVarList calls isVarWithConstructor @@ -11437,24 +11416,24 @@ void parseInput() // typedefs first so the relations between classes via typedefs // are properly resolved. See bug 536385 for an example. g_s.begin("Searching for documented typedefs...\n"); - buildTypedefList(root); + buildTypedefList(root.get()); g_s.end(); if (Config_getBool(OPTIMIZE_OUTPUT_SLICE)) { g_s.begin("Searching for documented sequences...\n"); - buildSequenceList(root); + buildSequenceList(root.get()); g_s.end(); g_s.begin("Searching for documented dictionaries...\n"); - buildDictionaryList(root); + buildDictionaryList(root.get()); g_s.end(); } g_s.begin("Searching for members imported via using declarations...\n"); // this should be after buildTypedefList in order to properly import // used typedefs - findUsingDeclarations(root); + findUsingDeclarations(root.get()); g_s.end(); g_s.begin("Searching for included using directives...\n"); @@ -11462,14 +11441,14 @@ void parseInput() g_s.end(); g_s.begin("Searching for documented variables...\n"); - buildVarList(root); + buildVarList(root.get()); g_s.end(); g_s.begin("Building interface member list...\n"); - buildInterfaceAndServiceList(root); // UNO IDL + buildInterfaceAndServiceList(root.get()); // UNO IDL g_s.begin("Building member list...\n"); // using class info only ! - buildFunctionList(root); + buildFunctionList(root.get()); g_s.end(); g_s.begin("Searching for friends...\n"); @@ -11477,11 +11456,11 @@ void parseInput() g_s.end(); g_s.begin("Searching for documented defines...\n"); - findDefineDocumentation(root); + findDefineDocumentation(root.get()); g_s.end(); g_s.begin("Computing class inheritance relations...\n"); - findClassEntries(root); + findClassEntries(root.get()); findInheritedTemplateInstances(); g_s.end(); @@ -11512,14 +11491,14 @@ void parseInput() g_s.end(); g_s.begin("Add enum values to enums...\n"); - addEnumValuesToEnums(root); - findEnumDocumentation(root); + addEnumValuesToEnums(root.get()); + findEnumDocumentation(root.get()); g_s.end(); g_s.begin("Searching for member function documentation...\n"); - findObjCMethodDefinitions(root); - findMemberDocumentation(root); // may introduce new members ! - findUsingDeclImports(root); // may introduce new members ! + findObjCMethodDefinitions(root.get()); + findMemberDocumentation(root.get()); // may introduce new members ! + findUsingDeclImports(root.get()); // may introduce new members ! transferRelatedFunctionDocumentation(); transferFunctionDocumentation(); @@ -11532,21 +11511,21 @@ void parseInput() g_s.end(); g_s.begin("Building page list...\n"); - buildPageList(root); + buildPageList(root.get()); g_s.end(); g_s.begin("Search for main page...\n"); - findMainPage(root); - findMainPageTagFiles(root); + findMainPage(root.get()); + findMainPageTagFiles(root.get()); g_s.end(); g_s.begin("Computing page relations...\n"); - computePageRelations(root); + computePageRelations(root.get()); checkPageRelations(); g_s.end(); g_s.begin("Determining the scope of groups...\n"); - findGroupScope(root); + findGroupScope(root.get()); g_s.end(); g_s.begin("Sorting lists...\n"); diff --git a/src/entry.cpp b/src/entry.cpp index e2a21c6..ec3c736 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -15,6 +15,7 @@ * */ +#include #include #include #include "entry.h" @@ -37,8 +38,6 @@ Entry::Entry() num++; m_parent=0; section = EMPTY_SEC; - m_sublist = new QList; - m_sublist->setAutoDelete(TRUE); extends = new QList; extends->setAutoDelete(TRUE); groups = new QList; @@ -137,17 +136,14 @@ Entry::Entry(const Entry &e) id = e.id; m_parent = e.m_parent; - m_sublist = new QList; - m_sublist->setAutoDelete(TRUE); - // deep copy of the child entry list - QListIterator eli(*e.m_sublist); - Entry *cur; - for (;(cur=eli.current());++eli) + // deep copy child entries + m_sublist.reserve(e.m_sublist.size()); + for (const auto &cur : e.m_sublist) { - m_sublist->append(new Entry(*cur)); + m_sublist.push_back(std::make_unique(*cur)); } - + // deep copy base class list QListIterator bli(*e.extends); BaseInfo *bi; @@ -192,9 +188,7 @@ Entry::~Entry() //printf("Entry::~Entry(%p) num=%d\n",this,num); //printf("Deleting entry %d name %s type %x children %d\n", // num,name.data(),section,sublist->count()); - - delete m_sublist; // each element is now own by a EntryNav so we do no longer own - // our children. + delete extends; delete groups; delete anchors; @@ -206,15 +200,44 @@ Entry::~Entry() num--; } -void Entry::addSubEntry(Entry *current) +void Entry::moveToSubEntryAndRefresh(Entry *¤t) +{ + current->m_parent=this; + m_sublist.emplace_back(current); + current = new Entry; +} + +void Entry::moveToSubEntryAndRefresh(std::unique_ptr ¤t) +{ + current->m_parent=this; + m_sublist.push_back(std::move(current)); + current = std::make_unique(); +} + +void Entry::moveToSubEntryAndKeep(Entry *current) +{ + current->m_parent=this; + m_sublist.emplace_back(current); +} + +void Entry::moveToSubEntryAndKeep(std::unique_ptr ¤t) { - //printf("Entry %d with name %s type 0x%x added to %s type 0x%x\n", - // current->num,current->name.data(),current->section, - // name.data(),section); - //printf("Entry::addSubEntry(%s:%p) to %s\n",current->name.data(), - // current,name.data()); current->m_parent=this; - m_sublist->append(current); + m_sublist.push_back(std::move(current)); +} + +void Entry::copyToSubEntry(Entry *current) +{ + Entry *copy = new Entry(*current); + copy->m_parent=this; + m_sublist.emplace_back(copy); +} + +void Entry::copyToSubEntry(const std::unique_ptr ¤t) +{ + std::unique_ptr copy = std::make_unique(*current); + copy->m_parent=this; + m_sublist.push_back(std::move(copy)); } void Entry::reset() @@ -271,7 +294,7 @@ void Entry::reset() groupDocType = GROUPDOC_NORMAL; id.resize(0); metaData.resize(0); - m_sublist->clear(); + m_sublist.clear(); extends->clear(); groups->clear(); anchors->clear(); @@ -293,14 +316,9 @@ int Entry::getSize() void Entry::setFileDef(FileDef *fd) { m_fileDef = fd; - if (m_sublist) + for (const auto &childNode : m_sublist) { - QListIterator eli(*m_sublist); - Entry *childNode; - for (eli.toFirst();(childNode=eli.current());++eli) - { childNode->setFileDef(fd); - } } } @@ -317,10 +335,14 @@ void Entry::addSpecialListItem(const char *listName,int itemId) sli->append(ili); } -Entry *Entry::removeSubEntry(Entry *e) +void Entry::removeSubEntry(Entry *e) { - int i = m_sublist->find(e); - return i!=-1 ? m_sublist->take(i) : 0; + auto it = std::find_if(m_sublist.begin(),m_sublist.end(), + [e](const std::unique_ptr&elem) { return elem.get()==e; }); + if (it!=m_sublist.end()) + { + m_sublist.erase(it); + } } //------------------------------------------------------------------ diff --git a/src/entry.h b/src/entry.h index 6dfa0c6..091e81b 100644 --- a/src/entry.h +++ b/src/entry.h @@ -23,6 +23,9 @@ #include #include +#include +#include + struct SectionInfo; class QFile; class FileDef; @@ -199,32 +202,42 @@ class Entry void addSpecialListItem(const char *listName,int index); - // while parsing a file these function can be used to navigate/build the tree - void setParent(Entry *parent) { m_parent = parent; } - /*! Returns the parent for this Entry or 0 if this entry has no parent. */ Entry *parent() const { return m_parent; } /*! Returns the list of children for this Entry * @see addSubEntry() and removeSubEntry() */ - const QList *children() const { return m_sublist; } + //const QList *children() const { return m_sublist; } + const std::vector< std::unique_ptr > &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!) + * @{ + */ + void moveToSubEntryAndKeep(Entry* e); + void moveToSubEntryAndKeep(std::unique_ptr &e); + /*! @} */ + + /*! @name add entry as a child, pass ownership and reinitialize entry */ + void moveToSubEntryAndRefresh(Entry* &e); + void moveToSubEntryAndRefresh(std::unique_ptr &e); - /*! Adds entry \a e as a child to this entry */ - void addSubEntry (Entry* e) ; + /*! make a copy of \a e and add it as a child to this entry */ + void copyToSubEntry (Entry* e); + void copyToSubEntry (const std::unique_ptr &e); /*! Removes entry \a e from the list of children. - * Returns a pointer to the entry or 0 if the entry was not a child. - * Note the entry will not be deleted. + * The entry will be deleted if found. */ - Entry *removeSubEntry(Entry *e); + void removeSubEntry(Entry *e); /*! Restore the state of this Entry to the default value it has * at construction time. */ void reset(); - void changeSection(int sec) { section = sec; } + void markAsProcessed() const { ((Entry*)(this))->section = Entry::EMPTY_SEC; } void setFileDef(FileDef *fd); FileDef *fileDef() const { return m_fileDef; } @@ -323,12 +336,9 @@ class Entry private: Entry *m_parent; //!< parent node in the tree - QList *m_sublist; //!< entries that are children of this one + std::vector< std::unique_ptr > m_sublist; Entry &operator=(const Entry &); FileDef *m_fileDef; }; -typedef QList EntryList; -typedef QListIterator EntryListIterator; - #endif diff --git a/src/fileparser.h b/src/fileparser.h index 4b311e6..7c3f40c 100644 --- a/src/fileparser.h +++ b/src/fileparser.h @@ -25,7 +25,7 @@ class FileParser : public ParserInterface virtual ~FileParser() {} void startTranslationUnit(const char *) {} void finishTranslationUnit() {} - void parseInput(const char *, const char *,Entry *, bool, QStrList &) {} + void parseInput(const char *, const char *,const std::unique_ptr &, bool, QStrList &) {} bool needsPreprocessing(const QCString &) { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, diff --git a/src/fortranscanner.h b/src/fortranscanner.h index 15a9bf0..7490cde 100644 --- a/src/fortranscanner.h +++ b/src/fortranscanner.h @@ -33,7 +33,7 @@ class FortranLanguageScanner : public ParserInterface void finishTranslationUnit() {} void parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); bool needsPreprocessing(const QCString &extension); diff --git a/src/fortranscanner.l b/src/fortranscanner.l index d75134a..9ff89e7 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -165,11 +165,11 @@ static int yyColNr = 0 ; static Entry* current_root = 0 ; static Entry* global_root = 0 ; static Entry* file_root = 0 ; -static Entry* current = 0 ; static Entry* last_entry = 0 ; static Entry* last_enum = 0 ; +static std::unique_ptr current; static ScanVar v_type = V_IGNORE; // type of parsed variable -static QList moduleProcedures; // list of all interfaces which contain unresolved +static std::vector moduleProcedures; // list of all interfaces which contain unresolved // module procedures static QCString docBlock; static bool docBlockInBody = FALSE; @@ -202,7 +202,7 @@ static SymbolModifiers currentModifiers; //! Holds program scope->symbol name->symbol modifiers. static QMap > modifiers; -static Entry *global_scope = NULL; +static Entry *global_scope = 0; static int anonCount = 0 ; //----------------------------------------------------------------------------- @@ -211,7 +211,7 @@ static void startCommentBlock(bool); static void handleCommentBlock(const QCString &doc,bool brief); static void subrHandleCommentBlock(const QCString &doc,bool brief); static void subrHandleCommentBlockResult(const QCString &doc,bool brief); -static void addCurrentEntry(int case_insens); +static void addCurrentEntry(bool case_insens); static void addModule(const char *name, bool isModule=FALSE); static void addSubprogram(const char *text); static void addInterface(QCString name, InterfaceType type); @@ -221,7 +221,7 @@ static void scanner_abort(); static void startScope(Entry *scope); static bool endScope(Entry *scope, bool isGlobalRoot=FALSE); //static bool isTypeName(QCString name); -static void resolveModuleProcedures(QList &moduleProcedures, Entry *current_root); +static void resolveModuleProcedures(Entry *current_root); static int getAmpersandAtTheStart(const char *buf, int length); static int getAmpOrExclAtTheEnd(const char *buf, int length, char ch); static void truncatePrepass(int index); @@ -241,6 +241,7 @@ static const char *stateToString(int state); #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); #define YY_USER_ACTION yyColNr+=(int)yyleng; +#define INVALID_ENTRY ((Entry*)0x8) //----------------------------------------------------------------------------- %} @@ -444,8 +445,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* current->name=yytext; current->fileName = yyFileName; current->section=Entry::USINGDIR_SEC; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); current->lang = SrcLangExt_Fortran; yy_pop_state(); } @@ -459,8 +459,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* current->name= useModuleName+"::"+yytext; current->fileName = yyFileName; current->section=Entry::USINGDECL_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); current->lang = SrcLangExt_Fortran; } "\n" { @@ -516,8 +515,8 @@ SCOPENAME ({ID}{BS}"::"{BS})* current->section = Entry::FUNCTION_SEC ; current->name = yytext; - moduleProcedures.append(current); - addCurrentEntry(1); + moduleProcedures.push_back(current.get()); + addCurrentEntry(true); } "\n" { yyColNr -= 1; unput(*yytext); @@ -558,13 +557,13 @@ SCOPENAME ({ID}{BS}"::"{BS})* yy_pop_state(); } "end"({BS}(module|program)({BS_}{ID})?)?{BS}/(\n|!|;) { // end module - resolveModuleProcedures(moduleProcedures, current_root); + resolveModuleProcedures(current_root); if (!endScope(current_root)) yyterminate(); defaultProtection = Public; if (global_scope) { - if (global_scope != (Entry *) -1) + if (global_scope != INVALID_ENTRY) yy_push_state(Start); else yy_pop_state(); // cannot pop artrificial entry @@ -572,7 +571,7 @@ SCOPENAME ({ID}{BS}"::"{BS})* else { yy_push_state(Start); - global_scope = (Entry *)-1; // signal that the global_scope has already been used. + global_scope = INVALID_ENTRY; // signal that the global_scope has already been used. } } {ID} { @@ -647,7 +646,7 @@ private { current->name = current_root->name + "::" + current->name; } - addCurrentEntry(1); + addCurrentEntry(true); startScope(last_entry); BEGIN(TypedefBody); } @@ -679,7 +678,7 @@ private { current->fileName = yyFileName; current->bodyLine = yyLineNr; current->startLine = yyLineNr; - addCurrentEntry(1); + addCurrentEntry(true); } {BS}"=>"[^(\n|\!)]* { /* Specific bindings come after the ID. */ QCString args = yytext; @@ -866,17 +865,15 @@ private { current->startLine = yyLineNr; if (argType == "@") { - current_root->addSubEntry(current); - current = new Entry(*current); + current_root->copyToSubEntry(current); // add to the scope surrounding the enum (copy!) - current_root->parent()->addSubEntry(current); - last_enum = current; - current = new Entry ; + last_enum = current.get(); + current_root->parent()->moveToSubEntryAndRefresh(current); initEntry(); } else { - addCurrentEntry(1); + addCurrentEntry(true); } } else if (!argType.isEmpty()) @@ -889,7 +886,7 @@ private { if (!docBlock.isNull()) { subrHandleCommentBlock(docBlock,TRUE); - } + } } // save, it may be function return type if (parameter) @@ -1068,7 +1065,7 @@ private { current->name = current_root->name + "::" + current->name; } - addCurrentEntry(1); + addCurrentEntry(true); startScope(last_entry); BEGIN( Enum ) ; } @@ -1138,7 +1135,7 @@ private { ")" { current->args += ")"; current->args = removeRedundantWhiteSpace(current->args); - addCurrentEntry(1); + addCurrentEntry(true); startScope(last_entry); BEGIN(SubprogBody); } @@ -1164,7 +1161,7 @@ private { newLine(); //printf("3=========> without parameterlist \n"); //current->argList = ; - addCurrentEntry(1); + addCurrentEntry(true); startScope(last_entry); BEGIN(SubprogBody); } @@ -1217,11 +1214,20 @@ private { unput(*yytext); if (v_type == V_VARIABLE) { - Entry *tmp_entry = current; - current = last_entry; // temporarily switch to the previous entry - if (last_enum) current = last_enum; + std::unique_ptr tmp_entry; + current.swap(tmp_entry); + // temporarily switch to the previous entry + if (last_enum) + { + current.reset(last_enum); + } + else + { + current.reset(last_entry); + } handleCommentBlock(docBlock,TRUE); - current=tmp_entry; + // switch back + tmp_entry.swap(current); } else if (v_type == V_PARAMETER) { @@ -1773,34 +1779,30 @@ static void popBuffer() { } /** used to copy entry to an interface module procedure */ -static void copyEntry(Entry *dest, Entry *src) +static void copyEntry(Entry *dest, const std::unique_ptr &src) { - dest->type = src->type; - dest->fileName = src->fileName; - dest->startLine = src->startLine; - dest->bodyLine = src->bodyLine; + dest->type = src->type; + dest->fileName = src->fileName; + dest->startLine = src->startLine; + dest->bodyLine = src->bodyLine; dest->endBodyLine = src->endBodyLine; - dest->args = src->args; - dest->argList = new ArgumentList(*src->argList); - dest->doc = src->doc; - dest->brief = src->brief; + dest->args = src->args; + delete dest->argList; + dest->argList = new ArgumentList(*src->argList); + dest->doc = src->doc; + dest->brief = src->brief; } /** fill empty interface module procedures with info from corresponding module subprogs @TODO: handle procedures in used modules */ -void resolveModuleProcedures(QList &moduleProcedures, Entry *current_root) +void resolveModuleProcedures(Entry *current_root) { - if (moduleProcedures.isEmpty()) return; - - EntryListIterator eli1(moduleProcedures); - // for all module procedures - for (Entry *ce1; (ce1=eli1.current()); ++eli1) + for (const auto &ce1 : moduleProcedures) { // check all entries in this module - EntryListIterator eli2(*current_root->children()); - for (Entry *ce2; (ce2=eli2.current()); ++eli2) + for (const auto &ce2 : current_root->children()) { if (ce1->name == ce2->name) { @@ -2022,26 +2024,6 @@ static Argument *findArgument(Entry* subprog, QCString name, bool byTypeName = F return 0; } -/*! Find function with given name in \a entry. */ -#if 0 -static Entry *findFunction(Entry* entry, QCString name) -{ - QCString cname(name.lower()); - - EntryListIterator eli(*entry->children()); - Entry *ce; - for (;(ce=eli.current());++eli) - { - if (ce->section != Entry::FUNCTION_SEC) - continue; - - if (ce->name.lower() == cname) - return ce; - } - - return 0; -} -#endif /*! Apply modifiers stored in \a mdfs to the \a typeName string. */ static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs) @@ -2199,10 +2181,10 @@ static bool endScope(Entry *scope, bool isGlobalRoot) { if (global_scope == scope) { - global_scope = NULL; + global_scope = 0; return TRUE; } - if (global_scope == (Entry *) -1) + if (global_scope == INVALID_ENTRY) { return TRUE; } @@ -2250,11 +2232,9 @@ static bool endScope(Entry *scope, bool isGlobalRoot) // iterate functions of interface and // try to find types for dummy(ie. argument) procedures. //cout<<"Search in "<name<children()); - Entry *ce; int count = 0; int found = FALSE; - for (;(ce=eli.current());++eli) + for (const auto &ce : scope->children()) { count++; if (ce->section != Entry::FUNCTION_SEC) @@ -2273,7 +2253,7 @@ static bool endScope(Entry *scope, bool isGlobalRoot) { // clear all modifiers of the scope modifiers.remove(scope); - delete scope->parent()->removeSubEntry(scope); + scope->parent()->removeSubEntry(scope); scope = 0; return TRUE; } @@ -2282,16 +2262,14 @@ static bool endScope(Entry *scope, bool isGlobalRoot) if (scope->section!=Entry::FUNCTION_SEC) { // not function section // iterate variables: get and apply modifiers - EntryListIterator eli(*scope->children()); - Entry *ce; - for (;(ce=eli.current());++eli) + for (const auto &ce : scope->children()) { if (ce->section != Entry::VARIABLE_SEC && ce->section != Entry::FUNCTION_SEC) continue; //cout<name<<", "<name.lower())<name.lower())) - applyModifiers(ce, mdfsMap[ce->name.lower()]); + applyModifiers(ce.get(), mdfsMap[ce->name.lower()]); } } @@ -2345,19 +2323,18 @@ static void initEntry() current->virt = virt; current->stat = gstat; current->lang = SrcLangExt_Fortran; - Doxygen::docGroup.initGroupInfo(current); + Doxygen::docGroup.initGroupInfo(current.get()); } /** adds current entry to current_root and creates new current */ -static void addCurrentEntry(int case_insens) +static void addCurrentEntry(bool case_insens) { if (case_insens) current->name = current->name.lower(); //printf("===Adding entry %s to %s\n", current->name.data(), current_root->name.data()); - current_root->addSubEntry(current); - last_entry = current; - current = new Entry ; + last_entry = current.get(); + current_root->moveToSubEntryAndRefresh(current); initEntry(); } @@ -2375,7 +2352,7 @@ static void addModule(const char *name, bool isModule) if (name!=NULL) { current->name = name; - } + } else { QCString fname = yyFileName; @@ -2389,7 +2366,7 @@ static void addModule(const char *name, bool isModule) current->bodyLine = yyLineNr; // used for source reference current->startLine = yyLineNr; current->protection = Public ; - addCurrentEntry(1); + addCurrentEntry(true); startScope(last_entry); } @@ -2397,7 +2374,7 @@ static void addModule(const char *name, bool isModule) static void addSubprogram(const char *text) { DBG_CTX((stderr,"1=========> got subprog, type: %s\n",text)); - subrCurrent.prepend(current); + subrCurrent.prepend(current.get()); current->section = Entry::FUNCTION_SEC ; QCString subtype = text; subtype=subtype.lower().stripWhiteSpace(); functionLine = (subtype.find("function") != -1); @@ -2454,7 +2431,7 @@ static void addInterface(QCString name, InterfaceType type) current->fileName = yyFileName; current->bodyLine = yyLineNr; current->startLine = yyLineNr; - addCurrentEntry(1); + addCurrentEntry(true); } @@ -2513,7 +2490,7 @@ static void handleCommentBlock(const QCString &doc,bool brief) QCString processedDoc = preprocessCommentBlock(doc,yyFileName,lineNr); while (parseCommentBlock( g_thisParser, - docBlockInBody ? subrCurrent.getFirst() : current, + docBlockInBody ? subrCurrent.getFirst() : current.get(), processedDoc, // text yyFileName, // file lineNr, @@ -2526,11 +2503,11 @@ static void handleCommentBlock(const QCString &doc,bool brief) )) { DBG_CTX((stderr,"parseCommentBlock position=%d [%s] needsEntry=%d\n",position,doc.data()+position,needsEntry)); - if (needsEntry) addCurrentEntry(0); + if (needsEntry) addCurrentEntry(false); } DBG_CTX((stderr,"parseCommentBlock position=%d [%s] needsEntry=%d\n",position,doc.data()+position,needsEntry)); - if (needsEntry) addCurrentEntry(0); + if (needsEntry) addCurrentEntry(false); docBlockInBody = FALSE; } @@ -2541,8 +2518,9 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) QCString loc_doc; loc_doc = doc.stripWhiteSpace(); - Entry *tmp_entry = current; - current = subrCurrent.getFirst(); // temporarily switch to the entry of the subroutine / function + std::unique_ptr tmp_entry; + current.swap(tmp_entry); + current.reset(subrCurrent.getFirst()); // temporarily switch to the entry of the subroutine / function // Still in the specification section so no inbodyDocs yet, but parameter documentation current->inbodyDocs = ""; @@ -2566,14 +2544,11 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) loc_doc = loc_doc.right(loc_doc.length()-strlen(directionParam[SymbolModifiers::IN])); loc_doc.stripWhiteSpace(); // in case of empty documentation or (now) just name, consider it as no documemntation - if (loc_doc.isEmpty() || (loc_doc.lower() == argName.lower())) + if (!loc_doc.isEmpty() && (loc_doc.lower() != argName.lower())) { - // reset current back to the part inside the routine - current=tmp_entry; - return; - } - handleCommentBlock(QCString("\n\n@param ") + directionParam[SymbolModifiers::IN] + " " + + handleCommentBlock(QCString("\n\n@param ") + directionParam[SymbolModifiers::IN] + " " + argName + " " + loc_doc,brief); + } } else { @@ -2594,7 +2569,7 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) loc_doc.stripWhiteSpace(); if (loc_doc.isEmpty() || (loc_doc.lower() == argName.lower())) { - current=tmp_entry; + tmp_entry.swap(current); return; } handleCommentBlock(QCString("\n\n@param ") + directionParam[SymbolModifiers::OUT] + " " + @@ -2616,13 +2591,11 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) { loc_doc = loc_doc.right(loc_doc.length()-strlen(directionParam[SymbolModifiers::INOUT])); loc_doc.stripWhiteSpace(); - if (loc_doc.isEmpty() || (loc_doc.lower() == argName.lower())) + if (!loc_doc.isEmpty() && (loc_doc.lower() != argName.lower())) { - current=tmp_entry; - return; + handleCommentBlock(QCString("\n\n@param ") + directionParam[SymbolModifiers::INOUT] + " " + + argName + " " + loc_doc,brief); } - handleCommentBlock(QCString("\n\n@param ") + directionParam[SymbolModifiers::INOUT] + " " + - argName + " " + loc_doc,brief); } else { @@ -2633,19 +2606,14 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) } } // analogous to the [in] case; here no direction specified - else + else if (!loc_doc.isEmpty() && (loc_doc.lower() != argName.lower())) { - if (loc_doc.isEmpty() || (loc_doc.lower() == argName.lower())) - { - current=tmp_entry; - return; - } handleCommentBlock(QCString("\n\n@param ") + directionParam[dir1] + " " + argName + " " + loc_doc,brief); } // reset current back to the part inside the routine - current=tmp_entry; + tmp_entry.swap(current); } //---------------------------------------------------------------------------- /// Handle result description as defined after the declaration of the parameter @@ -2654,8 +2622,9 @@ static void subrHandleCommentBlockResult(const QCString &doc,bool brief) QCString loc_doc; loc_doc = doc.stripWhiteSpace(); - Entry *tmp_entry = current; - current = subrCurrent.getFirst(); // temporarily switch to the entry of the subroutine / function + std::unique_ptr tmp_entry; + current.swap(tmp_entry); + current.reset(subrCurrent.getFirst()); // temporarily switch to the entry of the subroutine / function // Still in the specification section so no inbodyDocs yet, but parameter documentation current->inbodyDocs = ""; @@ -2668,15 +2637,13 @@ static void subrHandleCommentBlockResult(const QCString &doc,bool brief) ) (void)loc_doc; // Do nothing work has been done by stripPrefix; (void)loc_doc: to overcome 'empty controlled statement' warning loc_doc.stripWhiteSpace(); - if (loc_doc.isEmpty() || (loc_doc.lower() == argName.lower())) + if (!loc_doc.isEmpty() && (loc_doc.lower() != argName.lower())) { - current=tmp_entry; - return; + handleCommentBlock(QCString("\n\n@returns ") + loc_doc,brief); } - handleCommentBlock(QCString("\n\n@returns ") + loc_doc,brief); // reset current back to the part inside the routine - current=tmp_entry; + tmp_entry.swap(current); } //---------------------------------------------------------------------------- @@ -2687,18 +2654,17 @@ static void debugCompounds(Entry *rt) // print Entry structure (for debugging) { level++; printf("%d) debugCompounds(%s) line %d\n",level, rt->name.data(), rt->bodyLine); - EntryListIterator eli(*rt->children()); - Entry *ce; - for (;(ce=eli.current());++eli) + for (const auto &ce : rt->children()) { - debugCompounds(ce); - } + debugCompounds(ce.get()); + } level--; } #endif -static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, FortranFormat format) +static void parseMain(const char *fileName,const char *fileBuf, + const std::unique_ptr &rt, FortranFormat format) { char *tmpBuf = NULL; initParser(); @@ -2713,8 +2679,8 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, Fortra mtype = Method; gstat = FALSE; virt = Normal; - current_root = rt; - global_root = rt; + current_root = rt.get(); + global_root = rt.get(); inputFile.setName(fileName); if (inputFile.open(IO_ReadOnly)) { @@ -2750,18 +2716,18 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, Fortra yyFileName = fileName; msg("Parsing file %s...\n",yyFileName.data()); - global_scope = rt; - startScope(rt); // implies current_root = rt + global_scope = rt.get(); + startScope(rt.get()); // implies current_root = rt initParser(); Doxygen::docGroup.enterFile(yyFileName,yyLineNr); - current = new Entry; + // add entry for the file + current = std::make_unique(); current->lang = SrcLangExt_Fortran; current->name = yyFileName; current->section = Entry::SOURCE_SEC; - current_root->addSubEntry(current); - file_root = current; - current = new Entry; + file_root = current.get(); + current_root->moveToSubEntryAndRefresh(current); current->lang = SrcLangExt_Fortran; fortranscannerYYrestart( fortranscannerYYin ); @@ -2772,12 +2738,12 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, Fortra fortranscannerYYlex(); Doxygen::docGroup.leaveFile(yyFileName,yyLineNr); - if (global_scope && global_scope != (Entry *) -1) endScope(current_root, TRUE); // TRUE - global root + if (global_scope && global_scope != INVALID_ENTRY) endScope(current_root, TRUE); // TRUE - global root //debugCompounds(rt); //debug rt->program.resize(0); - delete current; current=0; + //delete current; current=0; moduleProcedures.clear(); if (tmpBuf) { free((char*)tmpBuf); @@ -2796,7 +2762,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt, Fortra void FortranLanguageScanner::parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool /*sameTranslationUnit*/, QStrList & /*filesInSameTranslationUnit*/) { @@ -2856,13 +2822,11 @@ static void scanner_abort() fprintf(stderr,"Error in file %s line: %d, state: %d(%s)\n",yyFileName.data(),yyLineNr,YY_START,stateToString(YY_START)); fprintf(stderr,"********************************************************************\n"); - EntryListIterator eli(*global_root->children()); - Entry *ce; bool start=FALSE; - for (;(ce=eli.current());++eli) + for (const auto &ce : global_root->children()) { - if (ce == file_root) start=TRUE; + if (ce.get() == file_root) start=TRUE; if (start) ce->reset(); } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index e1fab11..00e42d7 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -1460,7 +1460,7 @@ void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *current //---- helper functions ------------------------------------------------------ -void addClassToGroups(Entry *root,ClassDef *cd) +void addClassToGroups(const Entry *root,ClassDef *cd) { QListIterator gli(*root->groups); Grouping *g; @@ -1478,7 +1478,7 @@ void addClassToGroups(Entry *root,ClassDef *cd) } } -void addNamespaceToGroups(Entry *root,NamespaceDef *nd) +void addNamespaceToGroups(const Entry *root,NamespaceDef *nd) { //printf("root->groups->count()=%d\n",root->groups->count()); QListIterator gli(*root->groups); @@ -1495,7 +1495,7 @@ void addNamespaceToGroups(Entry *root,NamespaceDef *nd) } } -void addDirToGroups(Entry *root,DirDef *dd) +void addDirToGroups(const Entry *root,DirDef *dd) { //printf("*** root->groups->count()=%d\n",root->groups->count()); QListIterator gli(*root->groups); @@ -1513,7 +1513,7 @@ void addDirToGroups(Entry *root,DirDef *dd) } } -void addGroupToGroups(Entry *root,GroupDef *subGroup) +void addGroupToGroups(const Entry *root,GroupDef *subGroup) { //printf("addGroupToGroups for %s groups=%d\n",root->name.data(), // root->groups?root->groups->count():-1); @@ -1544,7 +1544,7 @@ void addGroupToGroups(Entry *root,GroupDef *subGroup) } /*! Add a member to the group with the highest priority */ -void addMemberToGroups(Entry *root,MemberDef *md) +void addMemberToGroups(const Entry *root,MemberDef *md) { //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%d\n", // root, root->name.data(), md, md->name().data(), root->groups->count() ); @@ -1650,7 +1650,7 @@ void addMemberToGroups(Entry *root,MemberDef *md) } -void addExampleToGroups(Entry *root,PageDef *eg) +void addExampleToGroups(const Entry *root,PageDef *eg) { QListIterator gli(*root->groups); Grouping *g; diff --git a/src/groupdef.h b/src/groupdef.h index 92d524f..8a84a98 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -18,6 +18,8 @@ #ifndef GROUPDEF_H #define GROUPDEF_H +#include + #include "sortdict.h" #include "definition.h" @@ -138,13 +140,13 @@ class GroupListIterator : public QListIterator virtual ~GroupListIterator() {} }; -void addClassToGroups(Entry *root,ClassDef *cd); -void addNamespaceToGroups(Entry *root,NamespaceDef *nd); -void addGroupToGroups(Entry *root,GroupDef *subGroup); -void addMemberToGroups(Entry *root,MemberDef *md); -void addPageToGroups(Entry *root,PageDef *pd); -void addExampleToGroups(Entry *root,PageDef *eg); -void addDirToGroups(Entry *root,DirDef *dd); +void addClassToGroups (const Entry *root,ClassDef *cd); +void addNamespaceToGroups(const Entry *root,NamespaceDef *nd); +void addGroupToGroups (const Entry *root,GroupDef *subGroup); +void addMemberToGroups (const Entry *root,MemberDef *md); +void addPageToGroups (const Entry *root,PageDef *pd); +void addExampleToGroups (const Entry *root,PageDef *eg); +void addDirToGroups (const Entry *root,DirDef *dd); #endif diff --git a/src/markdown.cpp b/src/markdown.cpp index ce28540..d1a6a63 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2578,11 +2578,11 @@ QCString markdownFileNameToId(const QCString &fileName) void MarkdownFileParser::parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool /*sameTranslationUnit*/, QStrList & /*filesInSameTranslationUnit*/) { - Entry *current = new Entry; + std::unique_ptr current = std::make_unique(); current->lang = SrcLangExt_Markdown; current->fileName = fileName; current->docFile = fileName; @@ -2630,7 +2630,7 @@ void MarkdownFileParser::parseInput(const char *fileName, QCString processedDocs = preprocessCommentBlock(docs,fileName,lineNr); while (parseCommentBlock( this, - current, + current.get(), processedDocs, fileName, lineNr, @@ -2644,8 +2644,7 @@ void MarkdownFileParser::parseInput(const char *fileName, if (needsEntry) { QCString docFile = current->docFile; - root->addSubEntry(current); - current = new Entry; + root->moveToSubEntryAndRefresh(current); current->lang = SrcLangExt_Markdown; current->docFile = docFile; current->docLine = lineNr; @@ -2653,7 +2652,7 @@ void MarkdownFileParser::parseInput(const char *fileName, } if (needsEntry) { - root->addSubEntry(current); + root->moveToSubEntryAndKeep(current); } // restore setting diff --git a/src/markdown.h b/src/markdown.h index 1a3895e..f101e5a 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -33,7 +33,7 @@ class MarkdownFileParser : public ParserInterface void finishTranslationUnit() {} void parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); bool needsPreprocessing(const QCString &) { return FALSE; } diff --git a/src/parserintf.h b/src/parserintf.h index f03aac7..a269bfb 100644 --- a/src/parserintf.h +++ b/src/parserintf.h @@ -21,6 +21,8 @@ #include #include +#include + #include "types.h" class Entry; @@ -67,7 +69,7 @@ class ParserInterface */ virtual void parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit) = 0; diff --git a/src/pyscanner.h b/src/pyscanner.h index 01235ee..13b10b9 100644 --- a/src/pyscanner.h +++ b/src/pyscanner.h @@ -39,7 +39,7 @@ class PythonLanguageScanner : public ParserInterface void finishTranslationUnit() {} void parseInput(const char * fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); bool needsPreprocessing(const QCString &extension); diff --git a/src/pyscanner.l b/src/pyscanner.l index 2320bca..c6120fb 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -73,7 +73,7 @@ static QFile inputFile; static Protection protection; static Entry* current_root = 0 ; -static Entry* current = 0 ; +static std::unique_ptr current; static Entry* previous = 0 ; static Entry* bodyEntry = 0 ; static int yyLineNr = 1 ; @@ -145,16 +145,14 @@ static void initEntry() current->virt = virt; current->stat = gstat; current->lang = SrcLangExt_Python; - current->setParent(current_root); - Doxygen::docGroup.initGroupInfo(current); + Doxygen::docGroup.initGroupInfo(current.get()); gstat = FALSE; } static void newEntry() { - previous = current; - current_root->addSubEntry(current); - current = new Entry ; + previous = current.get(); + current_root->moveToSubEntryAndRefresh(current); initEntry(); } @@ -240,8 +238,7 @@ static void addFrom(bool all) current->fileName = yyFileName; //printf("Adding using declaration: found:%s:%d name=%s\n",yyFileName.data(),yyLineNr,current->name.data()); current->section=all ? Entry::USINGDIR_SEC : Entry::USINGDECL_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); } //----------------------------------------------------------------------------- @@ -261,43 +258,6 @@ static void incLineNr() yyLineNr++; } -#if 0 -// Appends the current-name to current-type; -// Destroys current-name. -// Destroys current->args and current->argList -static void addType( Entry* current ) -{ - uint tl=current->type.length(); - if ( tl>0 && !current->name.isEmpty() && current->type.at(tl-1)!='.') - { - current->type += ' ' ; - } - current->type += current->name ; - current->name.resize(0) ; - tl=current->type.length(); - if ( tl>0 && !current->args.isEmpty() && current->type.at(tl-1)!='.') - { - current->type += ' ' ; - } - current->type += current->args ; - current->args.resize(0) ; - current->argList->clear(); -} - -static QCString stripQuotes(const char *s) -{ - QCString name; - if (s==0 || *s==0) return name; - name=s; - if (name.at(0)=='"' && name.at(name.length()-1)=='"') - { - name=name.mid(1,name.length()-2); - } - return name; -} -#endif -//----------------------------------------------------------------- - //----------------------------------------------------------------- static void startCommentBlock(bool brief) { @@ -313,15 +273,6 @@ static void startCommentBlock(bool brief) } } -/* -static void appendDocBlock() { - previous = current; - current_root->addSubEntry(current); - current = new Entry; - initEntry(); -} -*/ - static void handleCommentBlock(const QCString &doc,bool brief) { //printf("handleCommentBlock(doc=[%s] brief=%d docBlockInBody=%d docBlockJavaStyle=%d\n", @@ -341,7 +292,7 @@ static void handleCommentBlock(const QCString &doc,bool brief) QCString processedDoc = preprocessCommentBlock(doc,yyFileName,lineNr); while (parseCommentBlock( g_thisParser, - (docBlockInBody && previous) ? previous : current, + (docBlockInBody && previous) ? previous : current.get(), processedDoc, // text yyFileName, // file lineNr, @@ -765,8 +716,7 @@ STARTDOCSYMS "##" current->fileName = yyFileName; //printf("Adding using declaration: found:%s:%d name=%s\n",yyFileName.data(),yyLineNr,current->name.data()); current->section=Entry::USINGDECL_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(Search); } @@ -963,7 +913,7 @@ STARTDOCSYMS "##" } {B}":"{B} { // function without arguments g_specialBlock = TRUE; // expecting a docstring - bodyEntry = current; + bodyEntry = current.get(); BEGIN(FunctionBody); } @@ -1346,7 +1296,7 @@ STARTDOCSYMS "##" current->program+=yytext; //current->startLine = yyLineNr; g_curIndent=computeIndent(yytext); - bodyEntry = current; + bodyEntry = current.get(); DBG_CTX((stderr,"setting indent %d\n",g_curIndent)); //printf("current->program=[%s]\n",current->program.data()); //g_hideClassDocs = TRUE; @@ -1452,9 +1402,10 @@ STARTDOCSYMS "##" // do something based on the type of the IDENTIFIER if (current->type.isEmpty()) { - QListIterator eli(*(current_root->children())); - Entry *child; - for (eli.toFirst();(child=eli.current());++eli) + //QListIterator eli(*(current_root->children())); + //Entry *child; + //for (eli.toFirst();(child=eli.current());++eli) + for (const auto &child : current_root->children()) { if (child->name == QCString(yytext)) { @@ -1754,10 +1705,9 @@ STARTDOCSYMS "##" static void parseCompounds(Entry *rt) { //printf("parseCompounds(%s)\n",rt->name.data()); - EntryListIterator eli(*rt->children()); - Entry *ce; - for (;(ce=eli.current());++eli) + for (int i=0; ichildren().size(); ++i) { + Entry *ce = rt->children()[i].get(); if (!ce->program.isEmpty()) { //printf("-- %s ---------\n%s\n---------------\n", @@ -1768,7 +1718,7 @@ static void parseCompounds(Entry *rt) pyscannerYYrestart( pyscannerYYin ) ; if (ce->section&Entry::COMPOUND_MASK) { - current_root = ce ; + current_root = ce; BEGIN( Search ); } else if (ce->parent()) @@ -1780,18 +1730,17 @@ static void parseCompounds(Entry *rt) } yyFileName = ce->fileName; yyLineNr = ce->bodyLine ; - if (current) delete current; - current = new Entry; + current = std::make_unique(); initEntry(); - Doxygen::docGroup.enterCompound(yyFileName,yyLineNr,ce->name); - + QCString name = ce->name; + Doxygen::docGroup.enterCompound(yyFileName,yyLineNr,name); + pyscannerYYlex() ; g_lexInit=TRUE; - delete current; current=0; ce->program.resize(0); - Doxygen::docGroup.leaveCompound(yyFileName,yyLineNr,ce->name); + Doxygen::docGroup.leaveCompound(yyFileName,yyLineNr,name); } parseCompounds(ce); @@ -1801,7 +1750,7 @@ static void parseCompounds(Entry *rt) //---------------------------------------------------------------------------- -static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) +static void parseMain(const char *fileName,const char *fileBuf,const std::unique_ptr &rt) { initParser(); @@ -1812,7 +1761,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) mtype = Method; gstat = FALSE; virt = Normal; - current_root = rt; + current_root = rt.get(); g_specialBlock = FALSE; @@ -1836,7 +1785,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) g_moduleScope+=baseName; } - current = new Entry; + current = std::make_unique(); initEntry(); current->name = g_moduleScope; current->section = Entry::NAMESPACE_SEC; @@ -1845,11 +1794,11 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) current->startLine = yyLineNr; current->bodyLine = yyLineNr; - rt->addSubEntry(current); + current_root = current.get(); + + rt->moveToSubEntryAndRefresh(current); - current_root = current ; initParser(); - current = new Entry; Doxygen::docGroup.enterFile(yyFileName,yyLineNr); @@ -1863,7 +1812,6 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) Doxygen::docGroup.leaveFile(yyFileName,yyLineNr); current_root->program.resize(0); - delete current; current=0; parseCompounds(current_root); @@ -1936,7 +1884,7 @@ void pyscanFreeScanner() void PythonLanguageScanner::parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool /*sameTranslationUnit*/, QStrList & /*filesInSameTranslationUnit*/) { diff --git a/src/scanner.h b/src/scanner.h index c0d3dff..7103cb0 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -34,7 +34,7 @@ class CLanguageScanner : public ParserInterface void finishTranslationUnit(); void parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); bool needsPreprocessing(const QCString &extension); diff --git a/src/scanner.l b/src/scanner.l index 07d5c71..fe20543 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -22,6 +22,11 @@ /* * includes */ + +#include +#include +#include + #include #include #include @@ -86,11 +91,11 @@ static int roundCount = 0 ; static int curlyCount = 0 ; static int squareCount = 0 ; static int padCount = 0 ; +static std::unique_ptr current; static Entry* current_root = 0 ; static Entry* global_root = 0 ; -static Entry* current = 0 ; static Entry* previous = 0 ; -static Entry* tempEntry = 0 ; +static std::unique_ptr tempEntry; static Entry* firstTypedefEntry = 0 ; static Entry* memspecEntry = 0 ; static int yyLineNr = 1 ; @@ -194,6 +199,8 @@ static int g_column; static int g_fencedSize=0; static bool g_nestedComment=0; +static std::vector< std::pair > > g_outerScopeEntries; + static const char *stateToString(int state); //----------------------------------------------------------------------------- @@ -205,6 +212,7 @@ static const char *stateToString(int state); static void initParser() { + g_outerScopeEntries.clear(); sectionLabel.resize(0); sectionTitle.resize(0); baseName.resize(0); @@ -228,7 +236,6 @@ static void initParser() sliceOpt=Config_getBool(OPTIMIZE_OUTPUT_SLICE); previous = 0; firstTypedefEntry = 0; - tempEntry = 0; memspecEntry =0; } @@ -249,7 +256,7 @@ static void initEntry() // //printf("Appending group %s\n",autoGroupStack.top()->groupname.data()); // current->groups->append(new Grouping(*autoGroupStack.top())); //} - Doxygen::docGroup.initGroupInfo(current); + Doxygen::docGroup.initGroupInfo(current.get()); isTypedef=FALSE; } @@ -329,7 +336,7 @@ static inline int computeIndent(const char *s,int startIndent) return col; } -static void addType( Entry* current ) +static void addType() { uint tl=current->type.length(); if( tl>0 && !current->name.isEmpty() && current->type.at(tl-1)!='.') @@ -1027,7 +1034,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {ID} { - addType( current ); + addType(); current->name = yytext; } "[" { // C++/CLI indexed property @@ -1049,7 +1056,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {B}* { } . { - addType( current ); + addType(); current->type += yytext; } "]" { @@ -1371,9 +1378,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(); } ";" { - current_root->addSubEntry(current); - current_root = current ; - current = new Entry ; + Entry *tmp = current.get(); + current_root->moveToSubEntryAndRefresh(current); + current_root = tmp; initEntry(); BEGIN(FindMembers); } @@ -1509,7 +1516,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - addType( current ) ; + addType(); current->name = QCString(yytext).stripWhiteSpace(); } } @@ -1528,7 +1535,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - addType( current ) ; + addType(); current->name = QCString(yytext).stripWhiteSpace(); } } @@ -1547,7 +1554,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - addType( current ) ; + addType(); current->name = QCString(yytext).stripWhiteSpace(); } } @@ -1560,7 +1567,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->spec = Entry::Service | // preserve UNO IDL [optional] or published (current->spec & (Entry::Optional|Entry::Published)); - addType( current ) ; + addType(); current->type += " service " ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1569,7 +1576,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else // TODO is addType right? just copy/pasted { - addType( current ) ; + addType(); current->name = QCString(yytext).stripWhiteSpace(); } } @@ -1581,7 +1588,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->section = Entry::CLASS_SEC; current->spec = Entry::Singleton | (current->spec & Entry::Published); // preserve - addType( current ) ; + addType(); current->type += " singleton " ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1590,7 +1597,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else // TODO is addType right? just copy/pasted { - addType( current ) ; + addType(); current->name = QCString(yytext).stripWhiteSpace(); } } @@ -1603,7 +1610,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->spec = Entry::Interface | // preserve UNO IDL [optional], published, Slice local (current->spec & (Entry::Optional|Entry::Published|Entry::Local)); - addType( current ) ; + addType(); current->type += " interface" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1613,7 +1620,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - addType( current ) ; + addType(); current->name = QCString(yytext).stripWhiteSpace(); } } @@ -1624,7 +1631,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) language = current->lang = SrcLangExt_ObjC; insideObjC = TRUE; current->protection = protection = Public ; - addType( current ) ; + addType(); current->type += " implementation" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1642,7 +1649,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) insideObjC = TRUE; } current->protection = protection = Public ; - addType( current ) ; + addType(); current->type += " interface" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1658,7 +1665,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) language = current->lang = SrcLangExt_ObjC; insideObjC = TRUE; current->protection = protection = Public ; - addType( current ) ; + addType(); current->type += " protocol" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1673,7 +1680,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->spec = Entry::Exception | (current->spec & Entry::Published) | (current->spec & Entry::Local); - addType( current ) ; + addType(); current->type += " exception" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1690,7 +1697,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; current->section = Entry::CLASS_SEC; - addType( current ) ; + addType(); uint64 spec = current->spec; if (insidePHP && current->spec&Entry::Abstract) { @@ -1728,7 +1735,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) isTypedef=FALSE; current->section = Entry::CLASS_SEC; current->spec = Entry::Value; - addType( current ) ; + addType(); current->type += " value class" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1743,7 +1750,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) isTypedef=FALSE; current->section = Entry::CLASS_SEC; current->spec = Entry::Ref; - addType( current ) ; + addType(); current->type += " ref class" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1758,7 +1765,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) isTypedef=FALSE; current->section = Entry::CLASS_SEC; current->spec = Entry::Interface; - addType( current ) ; + addType(); current->type += " interface class" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1773,7 +1780,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { isTypedef=FALSE; current->section = Entry::CLASS_SEC; - addType( current ) ; + addType(); current->type += " coclass" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1784,7 +1791,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - addType(current); + addType(); current->name = yytext; current->name = current->name.stripWhiteSpace(); lineCount(); @@ -1805,7 +1812,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) (current->spec & Entry::Local); // bug 582676: can be a struct nested in an interface so keep insideObjC state //current->objc = insideObjC = FALSE; - addType( current ) ; + addType(); if (isConst) { current->type += " const"; @@ -1828,7 +1835,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) isTypedef=FALSE; current->section = Entry::CLASS_SEC; current->spec = Entry::Struct | Entry::Value; - addType( current ) ; + addType(); current->type += " value struct" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1843,7 +1850,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) isTypedef=FALSE; current->section = Entry::CLASS_SEC; current->spec = Entry::Struct | Entry::Ref; - addType( current ) ; + addType(); current->type += " ref struct" ; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1858,7 +1865,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) isTypedef=FALSE; current->section = Entry::CLASS_SEC; current->spec = Entry::Struct | Entry::Interface; - addType( current ) ; + addType(); current->type += " interface struct"; current->fileName = yyFileName; current->startLine = yyLineNr; @@ -1878,7 +1885,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->spec = Entry::Union; // bug 582676: can be a struct nested in an interface so keep insideObjC state //current->objc = insideObjC = FALSE; - addType( current ) ; + addType(); if (isConst) { current->type += " const"; @@ -1910,7 +1917,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { current->section = Entry::ENUM_SEC ; } - addType( current ) ; + addType(); current->type += " enum"; if (isStrongEnum) { @@ -2003,12 +2010,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->fileName = yyFileName; // add a using declaraton current->section=Entry::USINGDECL_SEC; - current_root->addSubEntry(current); - current = new Entry(*current); + current_root->copyToSubEntry(current); // also add it as a using directive current->section=Entry::USINGDIR_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); aliasName.resize(0); } @@ -2043,8 +2048,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::")); current->fileName = yyFileName; current->section=Entry::USINGDIR_SEC; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(Using); } @@ -2062,9 +2066,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //printf("import name = %s -> %s\n",yytext,current->name.data()); current->section=Entry::USINGDECL_SEC; } - current_root->addSubEntry(current); - previous = current; - current = new Entry ; + previous = current.get(); + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(Using); } @@ -2081,9 +2084,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->fileName = yyFileName; current->section=Entry::USINGDECL_SEC; current->startLine = yyLineNr; - current_root->addSubEntry(current); - previous = current; - current = new Entry ; + previous = current.get(); + current_root->moveToSubEntryAndRefresh(current); + initEntry(); if (insideCS) /* Hack: in C# a using declaration and directive have the same syntax, so we also add it as a using directive here @@ -2094,10 +2097,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->startLine = yyLineNr; current->startColumn = yyColNr; current->section=Entry::USINGDIR_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); + initEntry(); } - initEntry(); BEGIN(Using); } "=" { // C++11 style template alias? @@ -2156,22 +2158,21 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {SCOPENAME} { current->name=removeRedundantWhiteSpace(yytext); current->fileName = yyFileName; current->section=Entry::USINGDIR_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(Using); } ";" { BEGIN(FindMembers); } {SCOPENAME}{BN}*"<>" { // guided template decl QCString n=yytext; - addType( current ); + addType(); current->name=n.left(n.length()-2); } {SCOPENAME}{BN}*/"<" { // Note: this could be a return type! roundCount=0; sharpCount=0; lineCount(); - addType( current ); + addType(); current->name=yytext; current->name=current->name.stripWhiteSpace(); //current->scopeSpec.resize(0); @@ -2437,7 +2438,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else if (insideCS && qstrcmp(yytext,"this")==0) { // C# indexer - addType( current ) ; + addType(); current->name="this"; BEGIN(CSIndexer); } @@ -2469,7 +2470,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { if (YY_START==FindMembers) { - addType( current ) ; + addType(); } bool javaLike = insideJava || insideCS || insideD || insidePHP || insideJS; if (javaLike && qstrcmp(yytext,"public")==0) @@ -2704,8 +2705,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->args = current->args.simplifyWhiteSpace(); current->name = current->name.stripWhiteSpace(); current->section = Entry::DEFINE_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(lastDefineContext); } @@ -2722,8 +2722,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->initializer = init; current->name = current->name.stripWhiteSpace(); current->section = Entry::VARIABLE_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(FindMembers); } @@ -2758,7 +2757,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) [\^%] { // ^ and % are C++/CLI extensions if (insideCli) { - addType( current ); + addType(); current->name = yytext ; } else @@ -2768,7 +2767,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } [*&]+ { current->name += yytext ; - addType( current ); + addType(); } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { if (current->bodyLine==-1) @@ -2870,7 +2869,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { // link open command to the current entry - Doxygen::docGroup.open(current,yyFileName,yyLineNr); + Doxygen::docGroup.open(current.get(),yyFileName,yyLineNr); } //current = tmp; initEntry(); @@ -2914,7 +2913,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } "//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" { bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && lastInitializerContext==FindFields); // see bug746226 - Doxygen::docGroup.close(current,yyFileName,yyLineNr,insideEnum); + Doxygen::docGroup.close(current.get(),yyFileName,yyLineNr,insideEnum); } "=" { // in PHP code this could also be due to "bodyLine = yyLineNr; @@ -2965,8 +2964,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->args = current->args.simplifyWhiteSpace(); current->name = current->name.stripWhiteSpace(); current->section = Entry::VARIABLE_SEC; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(FindMembers); } @@ -3468,7 +3466,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { if (current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" { - addType(current); + addType(); current->name.sprintf("__pad%d__",padCount++); } BEGIN(BitFields); @@ -3499,7 +3497,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { current->type.prepend("typedef "); } - bool needNewCurrent=FALSE; + bool stat = current->stat; if (!current->name.isEmpty() && current->section!=Entry::ENUM_SEC) { current->type=current->type.simplifyWhiteSpace(); @@ -3513,17 +3511,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->fileName = yyFileName; current->startLine = yyBegLineNr; current->startColumn = yyBegColNr; - current_root->addSubEntry( current ) ; - needNewCurrent=TRUE; + current_root->moveToSubEntryAndRefresh( current ) ; + initEntry(); } if ( *yytext == ',') { - bool stat = current->stat; - if (needNewCurrent) - { - current = new Entry(*current); - initEntry(); - } current->stat = stat; // the static attribute holds for all variables current->name.resize(0); current->args.resize(0); @@ -3539,11 +3531,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { mtype = Method; virt = Normal; - if (needNewCurrent) - { - current = new Entry ; - } - else if (current->groups) + if (current->groups) { current->groups->clear(); } @@ -3764,8 +3752,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->args += ")"; current->name = current->name.stripWhiteSpace(); current->section = Entry::VARIABLE_SEC; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN( FindMembers ); } @@ -3794,7 +3781,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( SkipString ); } [^\n\[\]\"]+ -"<" { addType( current ) ; +"<" { addType(); current->type += yytext ; BEGIN( Sharp ) ; } @@ -3847,8 +3834,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->args = current->args.simplifyWhiteSpace(); current->name = current->name.stripWhiteSpace(); current->section = Entry::VARIABLE_SEC; - current_root->addSubEntry(current); - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); } @@ -3880,17 +3866,17 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->name = current->name.stripWhiteSpace(); current->section = Entry::VARIABLE_SEC; // add to the scope of the enum - current_root->addSubEntry(current); if (!insideCS && !insideJava && !(current_root->spec&Entry::Strong)) // for C# and Java 1.5+ enum values always have to be explicitly qualified, // same for C++11 style enums (enum class Name {}) { - current = new Entry(*current); // add to the scope surrounding the enum (copy!) - current_root->parent()->addSubEntry(current); + // we cannot during it directly as that would invalidate the iterator in parseCompounds. + //printf("*** adding outer scope entry for %s\n",current->name.data()); + g_outerScopeEntries.emplace_back(current_root->parent(), std::make_unique(*current)); } - current = new Entry ; + current_root->moveToSubEntryAndRefresh(current); initEntry(); } else // probably a redundant , @@ -3985,13 +3971,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { current->endBodyLine = yyLineNr; - Entry * original_root = current_root; // save root this namespace is in + Entry * original_root = current_root; // save root this namespace is in if (current->section == Entry::NAMESPACE_SEC && current->type == "namespace") { int split_point; while ((split_point = current->name.find("::")) != -1) { - Entry *new_current = new Entry(*current); + std::unique_ptr new_current = std::make_unique(*current); current->program = ""; new_current->doc = ""; new_current->docLine = 0; @@ -4003,9 +3989,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->name = current->name.left(split_point); if (!current_root->name.isEmpty()) current->name.prepend(current_root->name+"::"); - current_root->addSubEntry(current); - current_root = current; - current = new_current; + Entry *tmp = current.get(); + current_root->moveToSubEntryAndKeep(current); + current_root = tmp; + current.swap(new_current); } } QCString &cn = current->name; @@ -4040,17 +4027,16 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - current_root->addSubEntry( current ) ; - memspecEntry = current; - current = new Entry(*current); - if (current->section==Entry::NAMESPACE_SEC || + memspecEntry = current.get(); + current_root->copyToSubEntry( current ) ; + if (current->section==Entry::NAMESPACE_SEC || (current->spec==Entry::Interface) || insideJava || insidePHP || insideCS || insideD || insideJS || insideSlice ) { // namespaces and interfaces and java classes ends with a closing bracket without semicolon - current->reset(); - current_root = original_root; // restore scope from before namespace descent + current->reset(); + current_root = original_root; // restore scope from before namespace descent initEntry(); memspecEntry = 0; BEGIN( FindMembers ) ; @@ -4105,12 +4091,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->args = current->args.simplifyWhiteSpace(); current->type = current->type.simplifyWhiteSpace(); //printf("Adding compound %s %s %s\n",current->type.data(),current->name.data(),current->args.data()); - current_root->addSubEntry( current ) ; if (!firstTypedefEntry) { - firstTypedefEntry = current; + firstTypedefEntry = current.get(); } - current = new Entry; + current_root->moveToSubEntryAndRefresh( current ) ; initEntry(); isTypedef=TRUE; // to undo reset by initEntry() BEGIN(MemberSpecSkip); @@ -4124,9 +4109,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) // add compound definition to the tree current->args = current->args.simplifyWhiteSpace(); current->type = current->type.simplifyWhiteSpace(); - current_root->addSubEntry( current ) ; - memspecEntry = current; - current = new Entry(*current); + memspecEntry = current.get(); + current_root->moveToSubEntryAndRefresh( current ) ; initEntry(); unput(';'); BEGIN( MemberSpec ) ; @@ -4166,7 +4150,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } "(" { // function with struct return type - addType(current); + addType(); current->name = msName; current->spec = 0; unput('('); @@ -4179,7 +4163,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) // anonymous compound. If so we insert a // special 'anonymous' variable. //Entry *p=current_root; - Entry *p=current; + const Entry *p=current.get(); while (p) { // only look for class scopes, not namespace scopes @@ -4197,7 +4181,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } //p=p->parent; - if (p==current) p=current_root; else p=p->parent(); + if (p==current.get()) p=current_root; else p=p->parent(); } } //printf("msName=%s current->name=%s\n",msName.data(),current->name.data()); @@ -4218,7 +4202,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else // case 2: create a typedef field { - Entry *varEntry=new Entry; + std::unique_ptr varEntry=std::make_unique(); varEntry->lang = language; varEntry->protection = current->protection ; varEntry->mtype = current->mtype; @@ -4273,7 +4257,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n", // varEntry->type.data(),varEntry->name.data(), // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data()); - current_root->addSubEntry(varEntry); + current_root->moveToSubEntryAndKeep(varEntry); } } if (*yytext==';') // end of a struct/class ... @@ -4327,8 +4311,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount() ; } "@end"/[^a-z_A-Z0-9] { // end of Objective C block - current_root->addSubEntry( current ) ; - current=new Entry; + current_root->moveToSubEntryAndRefresh( current ) ; initEntry(); language = current->lang = SrcLangExt_Cpp; // see bug746361 insideObjC=FALSE; @@ -4346,7 +4329,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { current->bodyLine = yyLineNr; lineCount(); - addType(current); + addType(); funcPtrType=yytext; roundCount=0; //current->type += yytext; @@ -4491,7 +4474,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {BN}*{ID}{BN}*"*" { lineCount(); - addType(current); + addType(); funcPtrType="("; funcPtrType+=yytext; roundCount=0; @@ -5223,9 +5206,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { findAndRemoveWord(current->type,"function"); } - previous = current; - current_root->addSubEntry(current); - current = new Entry ; + previous = current.get(); + current_root->moveToSubEntryAndRefresh(current); initEntry(); // Objective C 2.0: Required/Optional section if (previous->spec & (Entry::Optional | Entry::Required)) @@ -5324,8 +5306,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { current->endBodyLine=yyLineNr; - tempEntry = current; // temporarily switch to the previous entry - current = previous; + current.swap(tempEntry); // remember current + current.reset(previous); // and temporarily switch to the previous entry previous = 0; docBlockContext = SkipCurlyEndDoc; @@ -5368,8 +5350,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //addToBody("}"); if (tempEntry) // we can only switch back to current if no new item was created { - current = tempEntry; - tempEntry = 0; + tempEntry.swap(current); + tempEntry.reset(); } BEGIN( lastCurlyContext ); } @@ -5516,8 +5498,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) new BaseInfo(baseName,Public,Normal)); baseName.resize(0); } - current_root->addSubEntry( current ) ; - current = new Entry; + current_root->moveToSubEntryAndRefresh( current ) ; + initEntry(); } else { @@ -5615,8 +5597,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) prependScope(); } current->spec|=Entry::ForwardDecl; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); } else if (insideIDL && (((current_root->spec & (Entry::Interface | @@ -5637,8 +5618,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) : Entry::INCLUDED_SERVICE_SEC; // current->section = Entry::MEMBERDOC_SEC; current->spec &= ~(Entry::Interface|Entry::Service); // FIXME: horrible: Interface == Gettable, so need to clear it - actually we're mixing values from different enums in this case... granted only Optional and Interface are actually valid in this context but urgh... - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); } unput(';'); @@ -5722,7 +5702,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - addType(current); + addType(); current->name = yytext; current->name = current->name.stripWhiteSpace(); lineCount(); @@ -6546,8 +6526,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) ";" { current->section = Entry::VARIABLE_SEC; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(FindMembers); } @@ -6577,8 +6556,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) ";" { current->section = Entry::VARIABLE_SEC; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); initEntry(); BEGIN(FindMembers); } @@ -7009,11 +6987,15 @@ static void newEntry() // already added to current_root, so we should not add it again // (see bug723314) { - current_root->addSubEntry(current); + previous = current.get(); + current_root->moveToSubEntryAndRefresh(current); + } + else + { + previous = current.get(); + tempEntry.swap(current); + tempEntry.reset(); } - tempEntry = 0; - previous = current; - current = new Entry ; initEntry(); } @@ -7025,7 +7007,7 @@ static void handleCommentBlock(const QCString &doc,bool brief) int lineNr = brief ? current->briefLine : current->docLine; // line of block start // fill in inbodyFile && inbodyLine the first time, see bug 633891 - Entry *docEntry = docBlockInBody && previous ? previous : current; + Entry *docEntry = docBlockInBody && previous ? previous : current.get(); if (docBlockInBody && docEntry && docEntry->inbodyLine==-1) { docEntry->inbodyFile = yyFileName; @@ -7037,7 +7019,7 @@ static void handleCommentBlock(const QCString &doc,bool brief) QCString processedDoc = preprocessCommentBlock(stripIndentation(doc),yyFileName,lineNr); while (parseCommentBlock( g_thisParser, - docBlockInBody && previous ? previous : current, + docBlockInBody && previous ? previous : current.get(), processedDoc, // text yyFileName, // file lineNr, // line of block start @@ -7097,7 +7079,7 @@ static void handleParametersCommentBlocks(ArgumentList *al) //printf("handleParametersCommentBlock [%s]\n",doc.data()); while (parseCommentBlock( g_thisParser, - current, + current.get(), a->docs, // text yyFileName, // file current->docLine, // line of block start @@ -7131,12 +7113,10 @@ static void handleParametersCommentBlocks(ArgumentList *al) //---------------------------------------------------------------------------- -static void parseCompounds(Entry *rt) +static void parseCompounds(const std::unique_ptr &rt) { //printf("parseCompounds(%s)\n",rt->name.data()); - EntryListIterator eli(*rt->children()); - Entry *ce; - for (;(ce=eli.current());++eli) + for (const auto &ce : rt->children()) { if (!ce->program.isEmpty()) { @@ -7153,16 +7133,14 @@ static void parseCompounds(Entry *rt) BEGIN( FindFields ) ; else BEGIN( FindMembers ) ; - current_root = ce ; + current_root = ce.get() ; yyFileName = ce->fileName; //setContext(); yyLineNr = ce->startLine ; yyColNr = ce->startColumn ; insideObjC = ce->lang==SrcLangExt_ObjC; //printf("---> Inner block starts at line %d objC=%d\n",yyLineNr,insideObjC); - //current->reset(); - if (current) delete current; - current = new Entry; + current = std::make_unique(); gstat = FALSE; initEntry(); @@ -7229,15 +7207,15 @@ static void parseCompounds(Entry *rt) //memberGroupId = DOX_NOGROUP; //memberGroupRelates.resize(0); //memberGroupInside.resize(0); - Doxygen::docGroup.enterCompound(yyFileName,yyLineNr,ce->name); + QCString name = ce->name; + Doxygen::docGroup.enterCompound(yyFileName,yyLineNr,name); scannerYYlex() ; g_lexInit=TRUE; //forceEndGroup(); - Doxygen::docGroup.leaveCompound(yyFileName,yyLineNr,ce->name); + Doxygen::docGroup.leaveCompound(yyFileName,yyLineNr,name); - delete current; current=0; ce->program.resize(0); @@ -7254,7 +7232,7 @@ static void parseCompounds(Entry *rt) static void parseMain(const char *fileName, const char *fileBuf, - Entry *rt, + const std::unique_ptr &rt, bool sameTranslationUnit, QStrList & filesInSameTranslationUnit) { @@ -7270,8 +7248,8 @@ static void parseMain(const char *fileName, mtype = Method; gstat = FALSE; virt = Normal; - current_root = rt; - global_root = rt; + current_root = rt.get(); + global_root = rt.get(); inputFile.setName(fileName); if (inputFile.open(IO_ReadOnly)) { @@ -7293,18 +7271,17 @@ static void parseMain(const char *fileName, rt->lang = language; msg("Parsing file %s...\n",yyFileName.data()); - current_root = rt ; + current_root = rt.get() ; initParser(); Doxygen::docGroup.enterFile(yyFileName,yyLineNr); - current = new Entry; + current = std::make_unique(); //printf("current=%p current_root=%p\n",current,current_root); int sec=guessSection(yyFileName); if (sec) { current->name = yyFileName; current->section = sec; - current_root->addSubEntry(current); - current = new Entry; + current_root->moveToSubEntryAndRefresh(current); } current->reset(); initEntry(); @@ -7329,18 +7306,7 @@ static void parseMain(const char *fileName, //forceEndGroup(); Doxygen::docGroup.leaveFile(yyFileName,yyLineNr); - //if (depthIf>0) - //{ - // warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); - //} - rt->program.resize(0); - if (rt->children()->contains(current)==0) - // it could be that current is already added as a child to rt, so we - // only delete it if this is not the case. See bug 635317. - { - delete current; current=0; - } parseCompounds(rt); @@ -7348,6 +7314,14 @@ static void parseMain(const char *fileName, anonNSCount++; + // add additional entries that were created during processing + for (auto &kv: g_outerScopeEntries) + { + //printf(">>> adding '%s' to scope '%s'\n",kv.second->name.data(),kv.first->name.data()); + kv.first->moveToSubEntryAndKeep(kv.second); + } + g_outerScopeEntries.clear(); + } } @@ -7396,6 +7370,7 @@ static void parsePrototype(const QCString &text) inputString = orgInputString; inputPosition = orgInputPosition; + //printf("**** parsePrototype end\n"); } @@ -7438,7 +7413,7 @@ void CLanguageScanner::finishTranslationUnit() void CLanguageScanner::parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList & filesInSameTranslationUnit) { diff --git a/src/sqlscanner.h b/src/sqlscanner.h index 3ca6fe3..b981b5b 100644 --- a/src/sqlscanner.h +++ b/src/sqlscanner.h @@ -28,7 +28,7 @@ public: virtual ~SQLScanner() {} void startTranslationUnit(const char *) {} void finishTranslationUnit() {} - void parseInput(const char *, const char *, Entry *, bool , QStrList &) {} + void parseInput(const char *, const char *, const std::unique_ptr &, bool , QStrList &) {} bool needsPreprocessing(const QCString &) { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 56dbe7d..18f6161 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -21,6 +21,8 @@ #include #include #include +#include + #include #include @@ -912,12 +914,12 @@ class TagFileParser : public QXmlDefaultHandler } void dump(); - void buildLists(Entry *root); + void buildLists(const std::unique_ptr &root); void addIncludes(); private: - void buildMemberList(Entry *ce,QList &members); - void addDocAnchors(Entry *e,const TagAnchorInfoList &l); + void buildMemberList(const std::unique_ptr &ce,QList &members); + void addDocAnchors(const std::unique_ptr &e,const TagAnchorInfoList &l); QList m_tagFileClasses; QList m_tagFileFiles; QList m_tagFileNamespaces; @@ -1147,7 +1149,7 @@ void TagFileParser::dump() } } -void TagFileParser::addDocAnchors(Entry *e,const TagAnchorInfoList &l) +void TagFileParser::addDocAnchors(const std::unique_ptr &e,const TagAnchorInfoList &l) { QListIterator tli(l); TagAnchorInfo *ta; @@ -1169,13 +1171,13 @@ void TagFileParser::addDocAnchors(Entry *e,const TagAnchorInfoList &l) } } -void TagFileParser::buildMemberList(Entry *ce,QList &members) +void TagFileParser::buildMemberList(const std::unique_ptr &ce,QList &members) { QListIterator mii(members); TagMemberInfo *tmi; for (;(tmi=mii.current());++mii) { - Entry *me = new Entry; + std::unique_ptr me = std::make_unique(); me->type = tmi->type; me->name = tmi->name; me->args = tmi->arglist; @@ -1192,7 +1194,7 @@ void TagFileParser::buildMemberList(Entry *ce,QList &members) TagEnumValueInfo *evi; for (evii.toFirst();(evi=evii.current());++evii) { - Entry *ev = new Entry; + std::unique_ptr ev = std::make_unique(); ev->type = "@"; ev->name = evi->name; ev->id = evi->clangid; @@ -1202,7 +1204,7 @@ void TagFileParser::buildMemberList(Entry *ce,QList &members) ti->anchor = evi->anchor; ti->fileName = evi->file; ev->tagInfo = ti; - me->addSubEntry(ev); + me->moveToSubEntryAndKeep(ev); } } me->protection = tmi->prot; @@ -1287,7 +1289,7 @@ void TagFileParser::buildMemberList(Entry *ce,QList &members) me->section = Entry::FUNCTION_SEC; me->mtype = Slot; } - ce->addSubEntry(me); + ce->moveToSubEntryAndKeep(me); } } @@ -1308,14 +1310,14 @@ static QCString stripPath(const QCString &s) * This tree contains the information extracted from the input in a * "unrelated" form. */ -void TagFileParser::buildLists(Entry *root) +void TagFileParser::buildLists(const std::unique_ptr &root) { // build class list QListIterator cit(m_tagFileClasses); TagClassInfo *tci; for (cit.toFirst();(tci=cit.current());++cit) { - Entry *ce = new Entry; + std::unique_ptr ce = std::make_unique(); ce->section = Entry::CLASS_SEC; switch (tci->kind) { @@ -1374,7 +1376,7 @@ void TagFileParser::buildLists(Entry *root) } buildMemberList(ce,tci->members); - root->addSubEntry(ce); + root->moveToSubEntryAndKeep(ce); } // build file list @@ -1382,7 +1384,7 @@ void TagFileParser::buildLists(Entry *root) TagFileInfo *tfi; for (fit.toFirst();(tfi=fit.current());++fit) { - Entry *fe = new Entry; + std::unique_ptr fe = std::make_unique(); fe->section = guessSection(tfi->name); fe->name = tfi->name; addDocAnchors(fe,tfi->docAnchors); @@ -1390,7 +1392,7 @@ void TagFileParser::buildLists(Entry *root) ti->tagName = m_tagName; ti->fileName = tfi->filename; fe->tagInfo = ti; - + QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name); fe->fileName = fullName; //printf("createFileDef() filename=%s\n",tfi->filename.data()); @@ -1411,7 +1413,7 @@ void TagFileParser::buildLists(Entry *root) Doxygen::inputNameDict->insert(tfi->name,mn); } buildMemberList(fe,tfi->members); - root->addSubEntry(fe); + root->moveToSubEntryAndKeep(fe); } // build namespace list @@ -1419,7 +1421,7 @@ void TagFileParser::buildLists(Entry *root) TagNamespaceInfo *tni; for (nit.toFirst();(tni=nit.current());++nit) { - Entry *ne = new Entry; + std::unique_ptr ne = std::make_unique(); ne->section = Entry::NAMESPACE_SEC; ne->name = tni->name; addDocAnchors(ne,tni->docAnchors); @@ -1430,7 +1432,7 @@ void TagFileParser::buildLists(Entry *root) ne->tagInfo = ti; buildMemberList(ne,tni->members); - root->addSubEntry(ne); + root->moveToSubEntryAndKeep(ne); } // build package list @@ -1438,7 +1440,7 @@ void TagFileParser::buildLists(Entry *root) TagPackageInfo *tpgi; for (pit.toFirst();(tpgi=pit.current());++pit) { - Entry *pe = new Entry; + std::unique_ptr pe = std::make_unique(); pe->section = Entry::PACKAGE_SEC; pe->name = tpgi->name; addDocAnchors(pe,tpgi->docAnchors); @@ -1448,7 +1450,7 @@ void TagFileParser::buildLists(Entry *root) pe->tagInfo = ti; buildMemberList(pe,tpgi->members); - root->addSubEntry(pe); + root->moveToSubEntryAndKeep(pe); } // build group list @@ -1456,7 +1458,7 @@ void TagFileParser::buildLists(Entry *root) TagGroupInfo *tgi; for (git.toFirst();(tgi=git.current());++git) { - Entry *ge = new Entry; + std::unique_ptr ge = std::make_unique(); ge->section = Entry::GROUPDOC_SEC; ge->name = tgi->name; ge->type = tgi->title; @@ -1467,7 +1469,7 @@ void TagFileParser::buildLists(Entry *root) ge->tagInfo = ti; buildMemberList(ge,tgi->members); - root->addSubEntry(ge); + root->moveToSubEntryAndKeep(ge); } // set subgroup relations bug_774118 @@ -1476,13 +1478,16 @@ void TagFileParser::buildLists(Entry *root) QCStringList::Iterator it; for ( it = tgi->subgroupList.begin(); it != tgi->subgroupList.end(); ++it ) { - QListIterator eli(*(root->children())); - Entry *childNode; - for (eli.toFirst();(childNode=eli.current());++eli) + //QListIterator eli(*(root->children())); + //Entry *childNode; + //for (eli.toFirst();(childNode=eli.current());++eli) + const auto &children = root->children(); + auto i = std::find_if(children.begin(),children.end(), + [&](const std::unique_ptr &e) { return e->name = *it; }); + if (i!=children.end()) { - if (childNode->name == (*it)) break; + (*i)->groups->append(new Grouping(tgi->name,Grouping::GROUPING_INGROUP)); } - childNode->groups->append(new Grouping(tgi->name,Grouping::GROUPING_INGROUP)); } } @@ -1491,7 +1496,7 @@ void TagFileParser::buildLists(Entry *root) TagPageInfo *tpi; for (pgit.toFirst();(tpi=pgit.current());++pgit) { - Entry *pe = new Entry; + std::unique_ptr pe = std::make_unique(); pe->section = tpi->filename=="index" ? Entry::MAINPAGEDOC_SEC : Entry::PAGEDOC_SEC; pe->name = tpi->name; pe->args = tpi->title; @@ -1500,7 +1505,7 @@ void TagFileParser::buildLists(Entry *root) ti->tagName = m_tagName; ti->fileName = tpi->filename; pe->tagInfo = ti; - root->addSubEntry(pe); + root->moveToSubEntryAndKeep(pe); } } @@ -1551,7 +1556,7 @@ void TagFileParser::addIncludes() } } -void parseTagFile(Entry *root,const char *fullName) +void parseTagFile(const std::unique_ptr &root,const char *fullName) { QFileInfo fi(fullName); if (!fi.exists()) return; diff --git a/src/tagreader.h b/src/tagreader.h index 6ea2d81..4c09a04 100644 --- a/src/tagreader.h +++ b/src/tagreader.h @@ -21,6 +21,8 @@ class Entry; -void parseTagFile(Entry *root,const char *fullPathName); +#include + +void parseTagFile(const std::unique_ptr &root,const char *fullPathName); #endif diff --git a/src/tclscanner.h b/src/tclscanner.h index 0e56bdd..482fb1f 100644 --- a/src/tclscanner.h +++ b/src/tclscanner.h @@ -33,7 +33,7 @@ class TclLanguageScanner : public ParserInterface void finishTranslationUnit() {} void parseInput(const char *fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); bool needsPreprocessing(const QCString &extension); diff --git a/src/tclscanner.l b/src/tclscanner.l index e763575..3b939ce 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -578,7 +578,7 @@ Entry* tcl_entry_namespace(const QCString ns) myEntry = tcl_entry_new(); myEntry->section = Entry::NAMESPACE_SEC; myEntry->name = ns; - tcl.entry_main->addSubEntry(myEntry); + tcl.entry_main->moveToSubEntryAndKeep(myEntry); tcl.ns.insert(ns,myEntry); } return myEntry; @@ -597,7 +597,7 @@ Entry* tcl_entry_class(const QCString cl) myEntry = tcl_entry_new(); myEntry->section = Entry::CLASS_SEC; myEntry->name = cl; - tcl.entry_main->addSubEntry(myEntry); + tcl.entry_main->moveToSubEntryAndKeep(myEntry); tcl.cl.insert(cl,myEntry); } return myEntry; @@ -1540,7 +1540,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment); processedDoc = preprocessCommentBlock(myDoc,tcl.file_name,myLine0); parseCommentBlock(tcl.this_parser, myEntry, processedDoc, tcl.file_name, myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew); - tcl.entry_inside->addSubEntry(myEntry); + tcl.entry_inside->moveToSubEntryAndRefresh(myEntry); } else { // we can add to current entry in this case @@ -1562,7 +1562,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment); processedDoc = preprocessCommentBlock(myDoc,tcl.file_name,myLine0); parseCommentBlock(tcl.this_parser, myEntry, processedDoc, tcl.file_name, myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew); - tcl.entry_inside->addSubEntry(myEntry); + tcl.entry_inside->moveToSubEntryAndKeep(myEntry); } else { // we can add to current entry @@ -1585,7 +1585,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment); { if (myNew) { - tcl.entry_inside->addSubEntry(tcl.entry_current); + tcl.entry_inside->moveToSubEntryAndKeep(tcl.entry_current); tcl.entry_current = tcl_entry_new(); } else @@ -1596,7 +1596,7 @@ tcl_inf("-> %s\n",(const char *)tcl.string_comment); } if (myNew) { - tcl.entry_inside->addSubEntry(tcl.entry_current); + tcl.entry_inside->moveToSubEntryAndKeep(tcl.entry_current); tcl.entry_current = tcl_entry_new(); } else @@ -2155,7 +2155,7 @@ D tcl.entry_current->endBodyLine = tcl.line_body1; tcl_protection(tcl.entry_current); tcl_command_ARGLIST(*tcl.list_commandwords.at(4)); - myEntryNs->addSubEntry(tcl.entry_current); + 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), @@ -2197,7 +2197,7 @@ D tcl.entry_current->endBodyLine = tcl.line_body1; tcl_protection(tcl.entry_current); tcl_command_ARGLIST(*tcl.list_commandwords.at(4)); - myEntryCl->addSubEntry(tcl.entry_current); + 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), @@ -2234,7 +2234,7 @@ D tcl.entry_current->endBodyLine = tcl.line_body1; tcl_protection(tcl.entry_current); tcl_command_ARGLIST(*tcl.list_commandwords.at(2)); - if (myEntryCl) myEntryCl->addSubEntry(tcl.entry_current); + 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), @@ -2268,7 +2268,7 @@ D tcl.entry_current->bodyLine = tcl.line_body0; tcl.entry_current->endBodyLine = tcl.line_body1; tcl_protection(tcl.entry_current); - myEntryCl->addSubEntry(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), @@ -2300,7 +2300,7 @@ D tcl.entry_current->startLine = tcl.line_command; tcl.entry_current->bodyLine = tcl.line_body0; tcl.entry_current->endBodyLine = tcl.line_body1; - tcl.entry_main->addSubEntry(tcl.entry_current); + tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current); tcl.ns.insert(myName,tcl.entry_current); //myEntryNs = tcl.entry_current; myStr = (*tcl.list_commandwords.at(6)); @@ -2338,7 +2338,7 @@ D tcl.entry_current->startLine = tcl.line_command; tcl.entry_current->bodyLine = tcl.line_body0; tcl.entry_current->endBodyLine = tcl.line_body1; - tcl.entry_main->addSubEntry(tcl.entry_current); + 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), @@ -2370,7 +2370,7 @@ D tcl.entry_current->startLine = tcl.line_command; tcl.entry_current->bodyLine = tcl.line_body0; tcl.entry_current->endBodyLine = tcl.line_body1; - tcl.entry_main->addSubEntry(tcl.entry_current); + tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current); //myEntryNs = tcl_entry_namespace(myName); tcl.cl.insert(myName,tcl.entry_current); myEntryCl = tcl.entry_current; @@ -2431,7 +2431,7 @@ D { tcl_command_ARGLIST(*tcl.list_commandwords.at(6)); } - if (myEntryCl) myEntryCl->addSubEntry(tcl.entry_current); + 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), @@ -2493,7 +2493,7 @@ D tcl.entry_current->bodyLine = tcl.line_body0; tcl.entry_current->endBodyLine = tcl.line_body1; tcl_protection(tcl.entry_current); - myEntry->addSubEntry(tcl.entry_current); + myEntry->moveToSubEntryAndKeep(tcl.entry_current); tcl.entry_current = tcl_entry_new(); } @@ -2911,10 +2911,10 @@ static void tcl_parse(const QCString ns, const QCString cls) tcl.entry_file->name = tcl.file_name; tcl.entry_file->section = Entry::SOURCE_SEC; tcl.entry_file->protection = Public; - tcl.entry_main->addSubEntry(tcl.entry_file); + tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_file); Entry *myEntry=tcl_entry_new(); myEntry->name=""; - tcl.entry_main->addSubEntry(myEntry); + tcl.entry_main->moveToSubEntryAndKeep(myEntry); tcl.ns.insert("::",myEntry); tcl.entry_current = tcl_entry_new(); @@ -2944,7 +2944,7 @@ static void tcl_parse(const QCString ns, const QCString cls) //! Parse text file and build up entry tree. void TclLanguageScanner::parseInput(const char *fileName, const char *input, - Entry *root, + const std::unique_ptr &root, bool /*sameTranslationUnit*/, QStrList & /*filesInSameTranslationUnit*/) { @@ -2965,7 +2965,7 @@ tcl_inf("%s\n",fileName); tcl.code = NULL; tcl.file_name = fileName; tcl.this_parser = this; - tcl.entry_main = root; /* toplevel entry */ + tcl.entry_main = root.get(); /* toplevel entry */ tcl_parse("",""); Doxygen::docGroup.leaveFile(tcl.file_name,yylineno); root->program.resize(0); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 38a80ef..fca010e 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -71,7 +71,8 @@ static QDict 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,Entry *cur,ClassDef* archBind=NULL); +static void addInstance(ClassDef* entity, ClassDef* arch, ClassDef *inst, + const std::unique_ptr &cur); //---------- create svg ------------------------------------------------------------- static void createSVG(); @@ -2577,7 +2578,7 @@ static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCStr qcs.stripPrefix("="); - Entry* current=new Entry; + std::unique_ptr current = std::make_unique(); current->spec=VhdlDocGen::UCF_CONST; current->section=Entry::VARIABLE_SEC; current->bodyLine=line; @@ -2604,7 +2605,7 @@ static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCStr brief.resize(0); } - root->addSubEntry(current); + root->moveToSubEntryAndKeep(current); } @@ -2761,9 +2762,6 @@ QCString VhdlDocGen::parseForBinding(QCString & entity,QCString & arch) void assignBinding(VhdlConfNode * conf) { - QList instList=getVhdlInstList(); - QListIterator eli(instList); - Entry *cur=0; ClassDef *archClass=0,*entClass=0; QCString archName; QCString arcBind,entBind; @@ -2826,7 +2824,7 @@ void assignBinding(VhdlConfNode * conf) all=allOt.lower()=="all" ; others= allOt.lower()=="others"; - for (;(cur=eli.current());++eli) + for (const auto &cur : getVhdlInstList()) { if (cur->exception.lower()==label || conf->isInlineConf) { @@ -2909,11 +2907,7 @@ void VhdlDocGen::computeVhdlComponentRelations() assignBinding(conf); } - QList qsl= getVhdlInstList(); - QListIterator eli(qsl); - Entry *cur; - - for (eli.toFirst();(cur=eli.current());++eli) + for (const auto &cur : getVhdlInstList()) { if (cur->stat ) // was bind { @@ -2949,7 +2943,7 @@ void VhdlDocGen::computeVhdlComponentRelations() } static void addInstance(ClassDef* classEntity, ClassDef* ar, - ClassDef *cd , Entry *cur,ClassDef* /*archBind*/) + ClassDef *cd , const std::unique_ptr &cur) { QCString bName,n1; @@ -3185,10 +3179,10 @@ void VhdlDocGen::createFlowChart(const MemberDef *mdef) VHDLLanguageScanner *pIntf =(VHDLLanguageScanner*) Doxygen::parserManager->getParser(".vhd"); VhdlDocGen::setFlowMember(mdef); - Entry root; + std::unique_ptr root = std::make_unique(); QStrList filesInSameTu; pIntf->startTranslationUnit(""); - pIntf->parseInput("",codeFragment.data(),&root,FALSE,filesInSameTu); + pIntf->parseInput("",codeFragment.data(),root,FALSE,filesInSameTu); pIntf->finishTranslationUnit(); } diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index aeed048..9a817dc 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -48,16 +48,16 @@ static Entry* oldEntry; static bool varr=FALSE; static QCString varName; -static QList instFiles; -static QList libUse; -static QList lineEntry; +static std::vector< std::unique_ptr > instFiles; +static std::vector< std::unique_ptr > libUse; +static std::vector lineEntry; Entry* VhdlParser::currentCompound=0; Entry* VhdlParser::tempEntry=0; Entry* VhdlParser::lastEntity=0 ; Entry* VhdlParser::lastCompound=0 ; -Entry* VhdlParser::current=0; Entry* VhdlParser::current_root = 0; +std::unique_ptr VhdlParser::current=0; QCString VhdlParser::compSpec; QCString VhdlParser::currName; QCString VhdlParser::confName; @@ -84,13 +84,13 @@ static QCString strComment; static int iCodeLen; static const char *vhdlFileName = 0; -bool checkMultiComment(QCString& qcs,int line); -QList* getEntryAtLine(const Entry* ce,int line); +static bool checkMultiComment(QCString& qcs,int line); +static void insertEntryAtLine(const Entry* ce,int line); //------------------------------------- -QList& getVhdlConfiguration() { return configL; } -QList& getVhdlInstList() { return instFiles; } +const QList& getVhdlConfiguration() { return configL; } +const std::vector > &getVhdlInstList() { return instFiles; } Entry* getVhdlCompound() { @@ -105,8 +105,8 @@ bool isConstraintFile(const QCString &fileName,const QCString &ext) } -void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,Entry *root, - bool ,QStrList&) +void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf, + const std::unique_ptr &root, bool ,QStrList&) { g_thisParser=this; bool inLine=false; @@ -128,34 +128,32 @@ void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,En if (xilinx_ucf) { - VhdlDocGen::parseUCF(fileBuf,root,yyFileName,FALSE); + VhdlDocGen::parseUCF(fileBuf,root.get(),yyFileName,FALSE); return; } if (altera_qsf) { - VhdlDocGen::parseUCF(fileBuf,root,yyFileName,TRUE); + VhdlDocGen::parseUCF(fileBuf,root.get(),yyFileName,TRUE); return; } - libUse.setAutoDelete(true); yyLineNr=1; - VhdlParser::current_root=root; + VhdlParser::current_root=root.get(); VhdlParser::lastCompound=0; VhdlParser::lastEntity=0; VhdlParser::currentCompound=0; VhdlParser::lastEntity=0; oldEntry = 0; - VhdlParser::current=new Entry(); - VhdlParser::initEntry(VhdlParser::current); + VhdlParser::current=std::make_unique(); + VhdlParser::initEntry(VhdlParser::current.get()); Doxygen::docGroup.enterFile(fileName,yyLineNr); vhdlFileName = fileName; lineParse=new int[200]; // Dimitri: dangerous constant: should be bigger than largest token id in VhdlParserConstants.h VhdlParserIF::parseVhdlfile(fileBuf,inLine); - delete VhdlParser::current; - VhdlParser::current=0; + VhdlParser::current.reset(); if (!inLine) - VhdlParser::mapLibPackage(root); + VhdlParser::mapLibPackage(root.get()); delete[] lineParse; yyFileName.resize(0); @@ -198,34 +196,33 @@ void VhdlParser::initEntry(Entry *e) void VhdlParser::newEntry() { + previous = current.get(); if (current->spec==VhdlDocGen::ENTITY || current->spec==VhdlDocGen::PACKAGE || current->spec==VhdlDocGen::ARCHITECTURE || current->spec==VhdlDocGen::PACKAGE_BODY) { - current_root->addSubEntry(current); + current_root->moveToSubEntryAndRefresh(current); } else { if (lastCompound) { - lastCompound->addSubEntry(current); + lastCompound->moveToSubEntryAndRefresh(current); } else { if (lastEntity) { - lastEntity->addSubEntry(current); + lastEntity->moveToSubEntryAndRefresh(current); } else { - current_root->addSubEntry(current); + current_root->moveToSubEntryAndRefresh(current); } } } - previous = current; - current = new Entry ; - initEntry(current); + initEntry(current.get()); } void VhdlParser::handleFlowComment(const char* doc) @@ -259,7 +256,7 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief) Protection protection=Public; - if (oldEntry==current) + if (oldEntry==current.get()) { //printf("\n find pending message < %s > at line: %d \n ",doc.data(),iDocLine); str_doc.doc=doc; @@ -269,7 +266,7 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief) return; } - oldEntry=current; + oldEntry=current.get(); if (brief) { @@ -293,7 +290,7 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief) QCString processedDoc = preprocessCommentBlock(doc,yyFileName,iDocLine); while (parseCommentBlock( g_thisParser, - current, + current.get(), processedDoc, // text yyFileName, // file iDocLine, // line of block start @@ -357,13 +354,11 @@ void VhdlParser::addCompInst(const char *n, const char* instName, const char* co current->args=lastCompound->name; if (true) // !findInstant(current->type)) { - initEntry(current); - instFiles.append(new Entry(*current)); + initEntry(current.get()); + instFiles.emplace_back(std::make_unique(*current)); } - Entry *temp=current; // hold current pointer (temp=oldEntry) - current=new Entry; // (oldEntry != current) - delete temp; + current=std::make_unique(); } else { @@ -401,7 +396,7 @@ void VhdlParser::addVhdlType(const char *n,int startLine,int section, if (!lastCompound && (section==Entry::VARIABLE_SEC) && (spec == VhdlDocGen::USE || spec == VhdlDocGen::LIBRARY) ) { - libUse.append(new Entry(*current)); + libUse.emplace_back(std::make_unique(*current)); current->reset(); } newEntry(); @@ -590,31 +585,30 @@ void VhdlParser::addProto(const char *s1,const char *s2,const char *s3, */ void VhdlParser::mapLibPackage( Entry* root) { - QList epp=libUse; - EntryListIterator eli(epp); - Entry *rt; - for (;(rt=eli.current());++eli) + //QList epp=libUse; + //EntryListIterator eli(epp); + //Entry *rt; + //for (;(rt=eli.current());++eli) + for (const auto &rt : libUse) { if (addLibUseClause(rt->name)) { - Entry *current; - EntryListIterator eLib(*root->children()); bool bFound=FALSE; - for (eLib.toFirst();(current=eLib.current());++eLib) + for (const auto ¤t : root->children()) { - if (VhdlDocGen::isVhdlClass(current)) + if (VhdlDocGen::isVhdlClass(current.get())) { if (current->startLine > rt->startLine) { bFound=TRUE; - current->addSubEntry(new Entry(*rt)); + current->copyToSubEntry(rt); break; } } }//for if (!bFound) { - root->addSubEntry(new Entry(*rt)); + root->copyToSubEntry(rt); } } //if }// for @@ -718,37 +712,34 @@ void VhdlParser::oneLineComment(QCString qcs) bool checkMultiComment(QCString& qcs,int line) { - QList *pTemp=getEntryAtLine(VhdlParser::current_root,line); + insertEntryAtLine(VhdlParser::current_root,line); - if (pTemp->isEmpty()) return false; + if (lineEntry.empty()) return false; VhdlDocGen::prepareComment(qcs); - while (!pTemp->isEmpty()) + while (!lineEntry.empty()) { - Entry *e=(Entry*)pTemp->getFirst(); + Entry *e=lineEntry.back(); e->briefLine=line; e->brief+=qcs; - pTemp->removeFirst(); + lineEntry.pop_back(); } return true; } // returns the vhdl parsed types at line xxx -QList* getEntryAtLine(const Entry* ce,int line) +void insertEntryAtLine(const Entry* ce,int line) { - EntryListIterator eli(*ce->children()); - Entry *rt; - for (;(rt=eli.current());++eli) + for (const auto &rt : ce->children()) { if (rt->bodyLine==line) { - lineEntry.insert(0,rt); + lineEntry.push_back(rt.get()); } - getEntryAtLine(rt,line); + insertEntryAtLine(rt.get(),line); } - return &lineEntry; } const char *getVhdlFileName(void) diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index fffea47..a179630 100644 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -1,6 +1,9 @@ #ifndef VHDLJJPARSER_H #define VHDLJJPARSER_H +#include +#include + #include "parserintf.h" #include #include @@ -45,7 +48,7 @@ class VHDLLanguageScanner : public ParserInterface void finishTranslationUnit() {} void parseInput(const char * fileName, const char *fileBuf, - Entry *root, + const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); @@ -95,7 +98,7 @@ struct VhdlConfNode void vhdlscanFreeScanner(); -QList& getVhdlConfiguration(); -QList& getVhdlInstList(); +const QList& getVhdlConfiguration(); +const std::vector >&getVhdlInstList(); #endif diff --git a/src/xmlscanner.h b/src/xmlscanner.h index cb9792c..b54d416 100644 --- a/src/xmlscanner.h +++ b/src/xmlscanner.h @@ -28,7 +28,7 @@ public: virtual ~XMLScanner() {} void startTranslationUnit(const char *) {} void finishTranslationUnit() {} - void parseInput(const char *, const char *, Entry *, bool , QStrList &) {} + void parseInput(const char *, const char *, const std::unique_ptr &, bool , QStrList &) {} bool needsPreprocessing(const QCString &) { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, diff --git a/vhdlparser/VhdlParser.cc b/vhdlparser/VhdlParser.cc index 4cf8ec0..aa0847a 100644 --- a/vhdlparser/VhdlParser.cc +++ b/vhdlparser/VhdlParser.cc @@ -462,7 +462,7 @@ void VhdlParser::architecture_body() {QCString s,s1;if (!hasError) { QCString t=s1+"::"+s; genLabels.resize(0); pushLabel(genLabels,s1); - lastCompound=current; + lastCompound=current.get(); addVhdlType(t,getLine(ARCHITECTURE_T),Entry::CLASS_SEC,VhdlDocGen::ARCHITECTURE,0,0,Private); } if (!hasError) { @@ -3336,7 +3336,7 @@ void VhdlParser::entity_declaration() {QCString s;if (!hasError) { } if (!hasError) { -lastEntity=current; +lastEntity=current.get(); lastCompound=0; addVhdlType(s.data(),getLine(ENTITY_T),Entry::CLASS_SEC,VhdlDocGen::ENTITY,0,0,Public); } @@ -4432,7 +4432,7 @@ QCString VhdlParser::full_type_declaration() {Entry *tmpEntry;QCString s,s1,s2;i } if (!hasError) { -tmpEntry=current; +tmpEntry=current.get(); addVhdlType(s.data(),getLine(),Entry::VARIABLE_SEC,VhdlDocGen::RECORD,0,0,Public); } if (!hasError) { @@ -6680,7 +6680,7 @@ void VhdlParser::package_body() {QCString s;if (!hasError) { } if (!hasError) { -lastCompound=current; +lastCompound=current.get(); s.prepend("_"); addVhdlType(s,getLine(),Entry::CLASS_SEC,VhdlDocGen::PACKAGE_BODY,0,0,Protected); } @@ -6875,15 +6875,15 @@ void VhdlParser::package_declaration() {QCString s;if (!hasError) { } if (!hasError) { -lastCompound=current; - Entry *clone=new Entry(*current); +lastCompound=current.get(); + std::unique_ptr clone=std::make_unique(*current); clone->section=Entry::NAMESPACE_SEC; clone->spec=VhdlDocGen::PACKAGE; clone->name=s; clone->startLine=getLine(PACKAGE_T); clone->bodyLine=getLine(PACKAGE_T); clone->protection=Package; - current_root->addSubEntry(clone); + current_root->moveToSubEntryAndKeep(clone); addVhdlType(s,getLine(PACKAGE_T),Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package); } if (!hasError) { @@ -7913,7 +7913,7 @@ if(s.isEmpty()) currName=s; current->name=currName; - tempEntry=current; + tempEntry=current.get(); current->endBodyLine=getLine(); currP=0; if(tok) @@ -9735,7 +9735,7 @@ void VhdlParser::subprogram_specification() {QCString s;Token *tok=0;Token *t; currP=VhdlDocGen::PROCEDURE; createFunction(s.data(),currP,0); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(PROCEDURE_T); current->bodyLine=getLine(PROCEDURE_T); } @@ -9855,7 +9855,7 @@ currP=VhdlDocGen::FUNCTION; createFunction(tok->image.c_str(),currP,s.data()); else createFunction(0,currP,s.data()); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(FUNCTION_T); current->bodyLine=getLine(FUNCTION_T); } @@ -9900,7 +9900,7 @@ param_sec=0; } if (!hasError) { -tempEntry=current; +tempEntry=current.get(); current->type=s; newEntry(); } diff --git a/vhdlparser/VhdlParser.h b/vhdlparser/VhdlParser.h index 3e32daa..3cd383a 100644 --- a/vhdlparser/VhdlParser.h +++ b/vhdlparser/VhdlParser.h @@ -8933,7 +8933,7 @@ static Entry* current_root; static Entry* tempEntry; static Entry* lastEntity ; static Entry* lastCompound ; -static Entry* current; +static std::unique_ptr current; static QCString compSpec; static QCString currName; static int levelCounter; diff --git a/vhdlparser/vhdlparser.jj b/vhdlparser/vhdlparser.jj index af1bd34..6eb95b4 100644 --- a/vhdlparser/vhdlparser.jj +++ b/vhdlparser/vhdlparser.jj @@ -31,7 +31,7 @@ static Entry* current_root; static Entry* tempEntry; static Entry* lastEntity ; static Entry* lastCompound ; -static Entry* current; +static std::unique_ptr current; static QCString compSpec; static QCString currName; static int levelCounter; @@ -409,7 +409,7 @@ void architecture_body() : {QCString s,s1;} QCString t=s1+"::"+s; genLabels.resize(0); pushLabel(genLabels,s1); - lastCompound=current; + lastCompound=current.get(); addVhdlType(t,getLine(ARCHITECTURE_T),Entry::CLASS_SEC,VhdlDocGen::ARCHITECTURE,0,0,Private); } try{ @@ -1012,7 +1012,7 @@ void entity_declaration() : {QCString s;} // try{ s=identifier() { - lastEntity=current; + lastEntity=current.get(); lastCompound=0; addVhdlType(s.data(),getLine(ENTITY_T),Entry::CLASS_SEC,VhdlDocGen::ENTITY,0,0,Public); } @@ -1209,7 +1209,7 @@ QCString full_type_declaration() : {Entry *tmpEntry;QCString s,s1,s2;} { s=identifier() { - tmpEntry=current; + tmpEntry=current.get(); addVhdlType(s.data(),getLine(),Entry::VARIABLE_SEC,VhdlDocGen::RECORD,0,0,Public); } try{ @@ -1693,7 +1693,7 @@ void package_body() : {QCString s;} { s=name() { - lastCompound=current; + lastCompound=current.get(); s.prepend("_"); addVhdlType(s,getLine(),Entry::CLASS_SEC,VhdlDocGen::PACKAGE_BODY,0,0,Protected); } @@ -1729,15 +1729,15 @@ void package_declaration(): {QCString s;} s=identifier() { - lastCompound=current; - Entry *clone=new Entry(*current); + lastCompound=current.get(); + std::unique_ptr clone=std::make_unique_ptr(*current); clone->section=Entry::NAMESPACE_SEC; clone->spec=VhdlDocGen::PACKAGE; clone->name=s; clone->startLine=getLine(PACKAGE_T); clone->bodyLine=getLine(PACKAGE_T); clone->protection=Package; - current_root->addSubEntry(clone); + current_root->moveToSubEntryAndKeep(clone); addVhdlType(s,getLine(PACKAGE_T),Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package); } package_declarative_part() @@ -2292,7 +2292,7 @@ void subprogram_specification() : {QCString s;Token *tok=0;Token *t;} { currP=VhdlDocGen::PROCEDURE; createFunction(s.data(),currP,0); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(PROCEDURE_T); current->bodyLine=getLine(PROCEDURE_T); @@ -2309,14 +2309,14 @@ void subprogram_specification() : {QCString s;Token *tok=0;Token *t;} createFunction(tok->image.c_str(),currP,s.data()); else createFunction(0,currP,s.data()); - tempEntry=current; + tempEntry=current.get(); current->startLine=getLine(FUNCTION_T); current->bodyLine=getLine(FUNCTION_T); } [{ param_sec=PARAM_SEC; } formal_parameter_list() { param_sec=0; }] s=type_mark() { - tempEntry=current; + tempEntry=current.get(); current->type=s; newEntry(); } -- cgit v0.12 From 148162e48b8337fafffc61e5a1b5cdf86077d6ac Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 8 Oct 2019 18:50:53 +0200 Subject: issue 7302: Parsing of template args in single-quotes is incorrect. In case we encounter an unescaped single or double quote during specialization we search for the closing quote. We are cionnsidering potential escape sequences in the strings as well. --- src/scanner.l | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/scanner.l b/src/scanner.l index fe20543..242a106 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -751,6 +751,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %x GCopyCurly %x SkipUnionSwitch %x Specialization +%x SpecializationSingleQuote +%x SpecializationDoubleQuote %x FuncPtrInit %x FuncFunc %x FuncFuncEnd @@ -6145,6 +6147,19 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) "typename"{BN}+ { lineCount(); } "(" { *specName += *yytext; roundCount++; } ")" { *specName += *yytext; roundCount--; } + +"\\\\" { *specName += *yytext;} +"\\'" { *specName += *yytext;} +"\\\"" { *specName += *yytext;} +"'" { *specName += *yytext;BEGIN(SpecializationSingleQuote);} +"\"" { *specName += *yytext;BEGIN(SpecializationDoubleQuote);} +"\\\\" { *specName += *yytext;} +"\\'" { *specName += *yytext;} +"'" { *specName += *yytext; BEGIN(Specialization);} +"\\\"" { *specName += *yytext;} +"\"" { *specName += *yytext; BEGIN(Specialization);} +. { *specName += *yytext;} + . { *specName += *yytext; } -- cgit v0.12 From f23e59f2543f592bcbc2358c1d51825ab71f88bd Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 9 Oct 2019 13:32:31 +0200 Subject: Problem with round brackets in PS output In case we use the doxygen inheritance diagrams in doxygen (i.e. `HAVE_DOT=NO`) for a construct like (based on #7302): ``` template struct one { }; /// The struct str_040 struct str_040 : one<'('> { }; ``` this will lead to a postscript error (epstopdf) as the `(` (and analogous the `)`) have to be escaped. --- src/diagram.cpp | 6 +++--- src/util.cpp | 20 ++++++++++++++++++++ src/util.h | 2 ++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/diagram.cpp b/src/diagram.cpp index 08b49ca..2dadc12 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -247,7 +247,7 @@ static void writeVectorBox(FTextStream &t,DiagramItem *di, float x,float y,bool children=FALSE) { if (di->virtualness()==Virtual) t << "dashed\n"; - t << " (" << di->label() << ") " << x << " " << y << " box\n"; + t << " (" << convertToPSString(di->label()) << ") " << x << " " << y << " box\n"; if (children) t << x << " " << y << " mark\n"; if (di->virtualness()==Virtual) t << "solid\n"; } @@ -1297,7 +1297,7 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, for (;(di=rit.current());++rit) { done=di->isInList(); - t << "(" << di->label() << ") cw\n"; + t << "(" << convertToPSString(di->label()) << ") cw\n"; } } QListIterator sit(*super); @@ -1310,7 +1310,7 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, for (;(di=rit.current());++rit) { done=di->isInList(); - t << "(" << di->label() << ") cw\n"; + t << "(" << convertToPSString(di->label()) << ") cw\n"; } } diff --git a/src/util.cpp b/src/util.cpp index 85536ca..e1e9fb5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6183,6 +6183,26 @@ QCString convertToJSString(const char *s, bool applyTextDir) return convertCharEntitiesToUTF8(growBuf.get()); } +QCString convertToPSString(const char *s) +{ + static GrowBuf growBuf; + growBuf.clear(); + if (s==0) return ""; + const char *p=s; + char c; + while ((c=*p++)) + { + switch (c) + { + case '(': growBuf.addStr("\\("); break; + case ')': growBuf.addStr("\\)"); break; + default: growBuf.addChar(c); break; + } + } + growBuf.addChar(0); + return growBuf.get(); +} + QCString convertToLaTeX(const QCString &s,bool insideTabbing,bool keepSpaces) { QGString result; diff --git a/src/util.h b/src/util.h index 4e6f622..cb2b957 100644 --- a/src/util.h +++ b/src/util.h @@ -291,6 +291,8 @@ QCString convertToDocBook(const char *s); QCString convertToJSString(const char *s, bool applyTextDir = true); +QCString convertToPSString(const char *s); + QCString getOverloadDocs(); void addMembersToMemberGroup(/* in,out */ MemberList *ml, -- cgit v0.12 From 5e8da21d56dc821f27e1c8cded754bbf2594181e Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 10 Oct 2019 11:08:39 +0200 Subject: Code highlighting. In case we have an example like (based on issue #7302): ``` /// @file /// Something template struct one { }; /// The struct single_009 the char struct single_009 : one<' '> { }; /// The struct single_010 the char struct single_039 : one<'\''> { }; /// The struct single_040 the char ( struct single_040 : one<'('> { }; /// The struct single_041 the char ) struct single_041 : one<')'> { }; /// The struct single_042 the char * struct single_042 : one<'*'> { }; struct single_058 : one<':'> { }; /// The struct single_059 the char ; struct single_059 : one<';'> { }; /// The struct single_060 the char < struct single_060 : one<'<'> { }; /// The struct single_061 the char = struct single_061 : one<'='> { }; /// The struct single_062 the char > struct single_062 : one<'>'> { }; /// The struct single_063 the char ? struct single_063 : one<'?'> { }; ``` The result is that in the code section there are no links to the structs 41, 61, 62 as the `(` and `<` block it till the corresponding `)` and `>` is found. Analogous problem for the double quote version. --- src/code.l | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/code.l b/src/code.l index 9428432..35efcd9 100644 --- a/src/code.l +++ b/src/code.l @@ -2357,6 +2357,12 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_code->codify(yytext); g_insideProtocolList=FALSE; } +"\""((\\0[Xx0-9]+)|(\\.)|(.))*"\"" { + g_code->codify(yytext); + } +"'"((\\0[Xx0-9]+)|(\\.)|(.))"'" { + g_code->codify(yytext); + } "<" { g_code->codify(yytext); ++g_sharpCount; -- cgit v0.12 From 44695af0c77cff4099bc8a53c5f3270cc6a6e33c Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 10 Oct 2019 15:47:58 +0200 Subject: Also span entire line in case of a memTemplItemRight Based on the CGAL issue https://github.com/CGAL/cgal/issues/2095 (and pull request https://github.com/CGAL/cgal/pull/4282) to see to it that all relevant table span the page. --- templates/html/doxygen.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/html/doxygen.css b/templates/html/doxygen.css index 09b7aad..ffba793 100644 --- a/templates/html/doxygen.css +++ b/templates/html/doxygen.css @@ -535,7 +535,7 @@ table.memberdecls { white-space: nowrap; } -.memItemRight { +.memItemRight, .memTemplItemRight { width: 100%; } -- cgit v0.12 From 78b5c447d516d64237f73e08a7ba2ad488201aa7 Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 10 Oct 2019 16:17:36 +0200 Subject: Properly close quotes in warning Found warning like: ``` Possible candidates: 'template < T > gmic::gmic(const T &pixel_type=(T) 0) 'template < T > gmic::gmic(const char *const commands_line, const char *const custom_commands=0, const bool include_stdlib=true, float *const p_progress=0, bool *const p_is_abort=0, const T &pixel_type=(T) 0) 'template < T > gmic::gmic(const char *const commands_line, cimg_library::CImgList< T > &images, cimg_library::CImgList< char > &images_names, const char *const custom_commands=0, const bool include_stdlib=true, float *const p_progress=0, bool *const p_is_abort=0) ``` Note the starting quote `'` but there is no closing quote (in case of a file and line the closing quote is present. --- src/doxygen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 184220c..7b3c7d9 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -6405,6 +6405,8 @@ static void findMember(const Entry *root, warnMsg+="' at line "+QCString().setNum(md->getDefLine()) + " of file "+md->getDefFileName(); } + else + warnMsg += "'"; warnMsg+='\n'; } -- cgit v0.12 From 056a6ba3de9b9a558ffa9c908bed28ae3494e121 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 12 Oct 2019 18:47:29 +0200 Subject: Warning when using empty p HTML tag When we use the construct: ```

``` we get the warning: ``` warning: HTML tags may not use the 'empty tag' XHTML syntax. ``` tough the construct is handled properly, so we can omit the warning. --- src/docparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index da4cfb2..1b6dbca 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -5892,7 +5892,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta int retval=RetVal_OK; int tagId = Mappers::htmlTagMapper->map(tagName); if (g_token->emptyTag && !(tagId&XML_CmdMask) && - tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR) + tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR && tagId!=HTML_P) { warn_doc_error(g_fileName,doctokenizerYYlineno,"HTML tags may not use the 'empty tag' XHTML syntax."); } -- cgit v0.12 From 79f6a43c5fbd1f28f2fbdaa642cf42a0079b5be6 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 13 Oct 2019 23:53:12 +0200 Subject: Fix lifetime issue for Entry objects. --- src/entry.cpp | 35 ++++++++++++++++++++++++++--------- src/entry.h | 5 ++++- src/scanner.l | 4 ++-- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/entry.cpp b/src/entry.cpp index ec3c736..8ec7846 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -240,6 +240,32 @@ void Entry::copyToSubEntry(const std::unique_ptr ¤t) m_sublist.push_back(std::move(copy)); } +void Entry::moveFromSubEntry(const Entry *child,std::unique_ptr &moveTo) +{ + auto it = std::find_if(m_sublist.begin(),m_sublist.end(), + [child](const std::unique_ptr&elem) { return elem.get()==child; }); + if (it!=m_sublist.end()) + { + moveTo = std::move(*it); + m_sublist.erase(it); + } + else + { + moveTo.reset(); + } +} + +void Entry::removeSubEntry(const Entry *e) +{ + auto it = std::find_if(m_sublist.begin(),m_sublist.end(), + [e](const std::unique_ptr&elem) { return elem.get()==e; }); + if (it!=m_sublist.end()) + { + m_sublist.erase(it); + } +} + + void Entry::reset() { static bool entryCallGraph = Config_getBool(CALL_GRAPH); @@ -335,14 +361,5 @@ void Entry::addSpecialListItem(const char *listName,int itemId) sli->append(ili); } -void Entry::removeSubEntry(Entry *e) -{ - auto it = std::find_if(m_sublist.begin(),m_sublist.end(), - [e](const std::unique_ptr&elem) { return elem.get()==e; }); - if (it!=m_sublist.end()) - { - m_sublist.erase(it); - } -} //------------------------------------------------------------------ diff --git a/src/entry.h b/src/entry.h index 091e81b..c078936 100644 --- a/src/entry.h +++ b/src/entry.h @@ -223,6 +223,9 @@ class Entry void moveToSubEntryAndRefresh(Entry* &e); void moveToSubEntryAndRefresh(std::unique_ptr &e); + /*! take \a child of of to list of children and move it into \a moveTo */ + void moveFromSubEntry(const Entry *child,std::unique_ptr &moveTo); + /*! make a copy of \a e and add it as a child to this entry */ void copyToSubEntry (Entry* e); void copyToSubEntry (const std::unique_ptr &e); @@ -230,7 +233,7 @@ class Entry /*! Removes entry \a e from the list of children. * The entry will be deleted if found. */ - void removeSubEntry(Entry *e); + void removeSubEntry(const Entry *e); /*! Restore the state of this Entry to the default value it has * at construction time. diff --git a/src/scanner.l b/src/scanner.l index fe20543..4ed4a62 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -5305,9 +5305,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { current->endBodyLine=yyLineNr; - + // take previous out of current_root and move it into current current.swap(tempEntry); // remember current - current.reset(previous); // and temporarily switch to the previous entry + current_root->moveFromSubEntry(previous,current); previous = 0; docBlockContext = SkipCurlyEndDoc; -- cgit v0.12 From ef3063ef59cb1f41f02d7658490b0e554bb7a288 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 14 Oct 2019 12:37:34 +0200 Subject: Warning when using empty HTML tag - the HR tag has in xhtml the form


. Supporting empty tag - better warning (with tag name, for empty tag. - `` does not exist, correcting warning (analogous to `
`) --- src/docparser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index 1b6dbca..5253b04 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -5892,9 +5892,10 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta int retval=RetVal_OK; int tagId = Mappers::htmlTagMapper->map(tagName); if (g_token->emptyTag && !(tagId&XML_CmdMask) && - tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR && tagId!=HTML_P) + tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR && tagId!=HTML_HR && tagId!=HTML_P) { - warn_doc_error(g_fileName,doctokenizerYYlineno,"HTML tags may not use the 'empty tag' XHTML syntax."); + warn_doc_error(g_fileName,doctokenizerYYlineno,"HTML tag ('<%s/>') may not use the 'empty tag' XHTML syntax.", + tagName.data()); } switch (tagId) { @@ -6439,7 +6440,7 @@ int DocPara::handleHtmlEndTag(const QCString &tagName) warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag found"); break; case HTML_HR: - warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag found"); + warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal tag found\n"); break; case HTML_A: //warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag found"); -- cgit v0.12 From b0c0fc0b741f3c51ff9f891a0725d68bca6ecda5 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 15 Oct 2019 18:54:54 +0200 Subject: Skip empty HTML tag Due to the fact that an empty HTML tag (like `` is seen as a start tag the rest of a documentation block is handled with the strikethrough. Same problem occurs for other tags as well, in most cases empty HTML tags should be left out of the output (and just give the warning about the empty tag). Mentioned example: ``` /** Before a strike: after strike */ void fie_b_strike(void); ``` --- src/docparser.cpp | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index 5253b04..1f7e460 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -5900,6 +5900,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta switch (tagId) { case HTML_UL: + if (!g_token->emptyTag) { DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Unordered); m_children.append(list); @@ -5907,6 +5908,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } break; case HTML_OL: + if (!g_token->emptyTag) { DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Ordered); m_children.append(list); @@ -5914,6 +5916,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } break; case HTML_LI: + if (g_token->emptyTag) break; if (!insideUL(this) && !insideOL(this)) { warn_doc_error(g_fileName,doctokenizerYYlineno,"lonely
  • tag found"); @@ -5924,21 +5927,22 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } break; case HTML_BOLD: - handleStyleEnter(this,m_children,DocStyleChange::Bold,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Bold,&g_token->attribs); break; case HTML_STRIKE: - handleStyleEnter(this,m_children,DocStyleChange::Strike,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Strike,&g_token->attribs); break; case HTML_DEL: - handleStyleEnter(this,m_children,DocStyleChange::Del,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Del,&g_token->attribs); break; case HTML_UNDERLINE: - handleStyleEnter(this,m_children,DocStyleChange::Underline,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Underline,&g_token->attribs); break; case HTML_INS: - handleStyleEnter(this,m_children,DocStyleChange::Ins,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Ins,&g_token->attribs); break; case HTML_CODE: + if (g_token->emptyTag) break; if (/*getLanguageFromFileName(g_fileName)==SrcLangExt_CSharp ||*/ g_xmlComment) // for C# source or inside a or section we // treat as an XML tag (so similar to @code) @@ -5952,27 +5956,28 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } break; case HTML_EMPHASIS: - handleStyleEnter(this,m_children,DocStyleChange::Italic,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Italic,&g_token->attribs); break; case HTML_DIV: - handleStyleEnter(this,m_children,DocStyleChange::Div,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Div,&g_token->attribs); break; case HTML_SPAN: - handleStyleEnter(this,m_children,DocStyleChange::Span,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Span,&g_token->attribs); break; case HTML_SUB: - handleStyleEnter(this,m_children,DocStyleChange::Subscript,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Subscript,&g_token->attribs); break; case HTML_SUP: - handleStyleEnter(this,m_children,DocStyleChange::Superscript,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Superscript,&g_token->attribs); break; case HTML_CENTER: - handleStyleEnter(this,m_children,DocStyleChange::Center,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Center,&g_token->attribs); break; case HTML_SMALL: - handleStyleEnter(this,m_children,DocStyleChange::Small,&g_token->attribs); + if (!g_token->emptyTag) handleStyleEnter(this,m_children,DocStyleChange::Small,&g_token->attribs); break; case HTML_PRE: + if (g_token->emptyTag) break; handleStyleEnter(this,m_children,DocStyleChange::Preformatted,&g_token->attribs); setInsidePreformatted(TRUE); doctokenizerYYsetInsidePre(TRUE); @@ -5981,6 +5986,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta retval=TK_NEWPARA; break; case HTML_DL: + if (!g_token->emptyTag) { DocHtmlDescList *list = new DocHtmlDescList(this,tagHtmlAttribs); m_children.append(list); @@ -5994,6 +6000,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected tag
    found"); break; case HTML_TABLE: + if (!g_token->emptyTag) { DocHtmlTable *table = new DocHtmlTable(this,tagHtmlAttribs); m_children.append(table); @@ -6028,22 +6035,22 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta retval=handleAHref(this,m_children,tagHtmlAttribs); break; case HTML_H1: - retval=handleHtmlHeader(tagHtmlAttribs,1); + if (!g_token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,1); break; case HTML_H2: - retval=handleHtmlHeader(tagHtmlAttribs,2); + if (!g_token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,2); break; case HTML_H3: - retval=handleHtmlHeader(tagHtmlAttribs,3); + if (!g_token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,3); break; case HTML_H4: - retval=handleHtmlHeader(tagHtmlAttribs,4); + if (!g_token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,4); break; case HTML_H5: - retval=handleHtmlHeader(tagHtmlAttribs,5); + if (!g_token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,5); break; case HTML_H6: - retval=handleHtmlHeader(tagHtmlAttribs,6); + if (!g_token->emptyTag) retval=handleHtmlHeader(tagHtmlAttribs,6); break; case HTML_IMG: { @@ -6051,6 +6058,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } break; case HTML_BLOCKQUOTE: + if (!g_token->emptyTag) { DocHtmlBlockQuote *block = new DocHtmlBlockQuote(this,tagHtmlAttribs); m_children.append(block); -- cgit v0.12 From 1734f1a16f828013171bb67bb4dcb61be57fad04 Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 16 Oct 2019 15:54:33 +0200 Subject: Support for Support besides `` also `` as `id=` is the HTML attribute to define an ad for an HTML element. --- doc/htmlcmds.doc | 2 ++ src/docparser.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/htmlcmds.doc b/doc/htmlcmds.doc index 12347ab..605bf5a 100644 --- a/doc/htmlcmds.doc +++ b/doc/htmlcmds.doc @@ -25,6 +25,8 @@ of a HTML tag are passed on to the HTML output only
  • {% for arg in obj.typeConstraints %} -- cgit v0.12 From 4ca56cd603207078dfc1b793586aee1be3a6e4c1 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 4 Nov 2019 15:31:56 +0100 Subject: Spelling corrections for examples directory Spelling corrections as found by codespell and in #561. The dbusxml.xml file is not part of the doxygen distribution anymore. Other problems are fixed here. --- examples/templ.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/templ.cpp b/examples/templ.cpp index 9ed48fb..e790684 100644 --- a/examples/templ.cpp +++ b/examples/templ.cpp @@ -27,9 +27,9 @@ template Test::Test() {} /*! The copy constructor */ template Test::Test(const Test &t) {} -/*! The constructor of the partial specilization */ +/*! The constructor of the partial specialization */ template Test::Test() {} -/*! The constructor of the specilization */ +/*! The constructor of the specialization */ template<> Test::Test() {} -- cgit v0.12 From 5ff3c02602652e60f5787e8b988f7b279f649d3e Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 4 Nov 2019 20:03:08 +0100 Subject: Spelling corrections for doc directory Spelling corrections as found by codespell and in #561. Some reported problems were already fixed, others are fixed here. Theer are a few that are not corrected as they signal a documentation correction. --- doc/changelog.doc | 300 +++++++++++++++++++++++++++--------------------------- doc/htmlcmds.doc | 2 +- doc/translator.py | 4 +- 3 files changed, 153 insertions(+), 153 deletions(-) diff --git a/doc/changelog.doc b/doc/changelog.doc index e87c7ce..96652eb 100644 --- a/doc/changelog.doc +++ b/doc/changelog.doc @@ -178,7 +178,7 @@
  • Forgot to comment out debug print [view]
  • Give warning when a retval is used multiple times [view]
  • Handling digraph versus label [view]
  • -
  • High consequence coverity mesages [view]
  • +
  • High consequence coverity messages [view]
  • Image not seen as svg image [view]
  • Implement a new EXTRACT_PRIVATE_VIRTUAL option. [view]
  • Implementing `<hr>` for LaTeX [view]
  • @@ -224,7 +224,7 @@
  • Option for 'input buffer overflow' [view]
  • Option syntax for commands is unclear [view], [view]
  • PLANTUML_RUN_JAVA_ONCE is working well. But some specific plantuml has error on ver 1.8.15 [view]
  • -
  • Portuguse translators updated to Doxygen 1.8.16. [view]
  • +
  • Portuguese translators updated to Doxygen 1.8.16. [view]
  • Possibility to show converted fixed form [view]
  • Problem with just an asterisks on a `\code` line [view]
  • Problem with with comment recognition for group open and closing commands [view]
  • @@ -306,7 +306,7 @@ href="https://github.com/doxygen/doxygen/commit/9d83d43f0d8b7058e2f89371a6ab276c
  • constexp.l: group the flex options [view]
  • constexp.y: drop the = from name-prefix [view]
  • declinfo.l: enable reentrant [view]
  • -
  • declinfo.l: group flex options toghether [view]
  • +
  • declinfo.l: group flex options together [view]
  • declinfo.l: move function declarations before [view]
  • delayed creation and update of .md5 files after successful creation of output files [view], [view]
  • do not clobber version placeholder [view]
  • @@ -664,7 +664,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Problems and some enhancements for LaTeX tables [view]
  • RTF layout regarding References and Referenced by [view]
  • RTF lists more levels and removing extra paragraphs [view]
  • -
  • Readded missing "Span" case to DocStyleChange::styleString [view]
  • +
  • Re-added missing "Span" case to DocStyleChange::styleString [view]
  • Redundant whitespace removal breaks some C++ links [with test case and Git bisect] (Origin: bugzilla #791942) [view]
  • Refactored code a bit [view]
  • Refactored code a bit (use const references and made global functions members) [view]
  • @@ -766,7 +766,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Bug 6139 - Menu does not work without Javascript [view]
  • Bug 6141 - Too greedy behavior of @ref const matching [view]
  • Bug 6169 - doxygen build fails [view]
  • -
  • Bug 6170 - Add "\~" command to internatioalization article [view]
  • +
  • Bug 6170 - Add "\~" command to internationalization article [view]
  • Bug 6223 - Problem RTF output: The class list "classes" within the namespace report is wrong indicated. [view]
  • Bug 6238 - parsing error in Fortran file with preprocessing [view] , [view]
  • @@ -844,7 +844,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Use hidden symbol visibility by default [view]
  • Use language identifier instead of file extension for language attribute [view]
  • Use language in stead of lang for language name attribute [view]
  • -
  • Update of the Brazillian translation [view]
  • +
  • Update of the Brazilian translation [view]
  • [preprocessing.doc] typo amended [view]
  • add decimal to base identifier [view]
  • add the number of conditionals path and bugfix [view]
  • @@ -944,7 +944,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Bug 1662 - Fix missing title in non-page docanchors from tag files [view]
  • Bug 2763 - FILTER_PATTERNS won't take command with arguments [view]
  • Bug 4691 - Uses <img> instead of <object> html tag for SVG images [view]
  • -
  • Bug 5174 - error state 21 with fortran code (fixed format) [view]
  • +
  • Bug 5174 - error state 21 with Fortran code (fixed format) [view]
  • Bug 5323 - Missing Page References in the Index Chapters of the LaTex/PDF output [view]
  • Bug 5411 - Inherited member of template class issues warning and is not documented [view]
  • Bug 5711 - Fortran: attributes after a blank line are ignored / Bug 3880 - FORTRAN: comment in subroutine argument list [view]
  • @@ -959,7 +959,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Bug 5933 - Phantom variables/functions in XML, created from non-code files [view]
  • Bug 5937 - CASE_SENSE_NAMES ignored [view]
  • Bug 5938 - Spaces between the closing bracket of the typename and the opening bracket of the parameter list cause detection issues. [view]
  • -
  • Bug 5941 - python unicode docstrings are ignored [view] +
  • Bug 5941 - python Unicode docstrings are ignored [view] , [view]
  • Bug 5945 - Do not allow ligatures in log output [view]
  • Bug 5958 - References for one function can inherit References from subsequent non documented function [view]
  • @@ -977,7 +977,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Bug 5981 - quick link index in alphabetical class list in classes.html doesn't work [view]
  • Bug 5982 - Bad character escaping scheme in HTML anchor generation. [view]
  • Bug 5983 - `@addindex`entries fail to link to the exact location in Compiled HTML Help. [view]
  • -
  • Bug 5985 - Java: final keyword on a parameter brakes docs inherinance [view]
  • +
  • Bug 5985 - Java: final keyword on a parameter brakes docs inheritance [view]
  • Bug 5991 - Using `@page` to add title to Markdown file generates surplus empty page. [view]
  • Bug 5998 - DOT_PATH not expanded [view]
  • Bug 5999 - Files with incorrect extensions (.doc) are picked up by doxygen [view]
  • @@ -1023,17 +1023,17 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Documentation for extensions .f95, .f03 and .f08 [view]
  • Doxygen fails to copy logo image to LaTex output dir [view]
  • FORTRAN determination string in preprocessing [view]
  • -
  • Feature: Translations for german language (changes since 1.8.4) [view]
  • +
  • Feature: Translations for German language (changes since 1.8.4) [view]
  • Fix STRIP_FROM_PATH when running from drive root [view]
  • Fix Windows build instructions. [view]
  • Fix documentation typos [view]
  • Fix for HTML output when using server side search and the new menu bar [view]
  • -
  • Fix for changed references due to different removeRedudantWhiteSpace() implementation [view]
  • +
  • Fix for changed references due to different removeRedundantWhiteSpace() implementation [view]
  • Fix for empty file name [view]
  • Fix for error in travis.yml [view]
  • Fix issue escaping backslash inside markdown style code span [view]
  • Fix linker flags for building with clang on Windows [view]
  • -
  • Fix order of member initilaization [view]
  • +
  • Fix order of member initialization [view]
  • Fix return-type warnings with -DNDEBUG [view]
  • Fix search box rendering in HTML when menu bar is disabled [view]
  • Fix uppercase letters B-Z being unnecessarily escaped in index HTML anchors. [view]
  • @@ -1209,7 +1209,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Moved creation of inline class documentation to separate template file [view]
  • RTF improvement: Example section was merged with next function title [view]
  • Remove obsolete py files [view]
  • -
  • Removed BOM marker from greek translator to avoid Visual C warnings [view]
  • +
  • Removed BOM marker from Greek translator to avoid Visual C warnings [view]
  • Repaired breaking @include for LaTeX output [view]
  • Revert "Spelling correction for error message with USE_HTAGS usage" [view]
  • Revert using container-based infra as sudo is needed :-( [view]
  • @@ -1236,7 +1236,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Using tabu package for LaTeX tables [view]
  • [Bug 5872] On Windows, generated layout is with UNIX EOL [view]
  • [Doxygen-users] plugin / filter not behaving as expected [view]
  • -
  • add spaces like "Doyxgen"CN_SPC->"Doyxgen" CN_SPC [view]
  • +
  • add spaces like "Doxygen"CN_SPC->"Doxygen" CN_SPC [view]
  • allow building with custom iconv on Windows [view]
  • doc: generate doxygen's documentation. [view]
  • doc: put man pages under share/man/man1 [view]
  • @@ -1293,7 +1293,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Bug 5720 - <CAPTION> inside <TABLE> no longer works for LaTex output [view]
  • Bug 5726 - Duplicate anchors from tagfiles [view]
  • Bug 5727 - Tagfile anchors not generated for enumeration values [view]
  • -
  • Bug 5728 - Non-ascii characters are not emphasised [view]
  • +
  • Bug 5728 - Non-ascii characters are not emphasized [view]
  • Bug 5744 - Using TAGFILES prevents symbol extraction [view]
  • Bug 5753 - PATCH: please consider making doxygen output byte for byte identical between individual runs by default [view]
  • Bug 5754 - Doxygen generates bad "More..." file links for functions within a namespace [view]
  • @@ -1518,9 +1518,9 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
  • Bug 5690 - Crash when building gtkmm documentation [view]
  • Bug 5694 - \cite confused by labels ending with a dot (improved warning message) [view]
  • fix docbook output [view] -
    1. support other than english
    2. +
      1. support other than English
      2. fix broken example link id
      3. -
      4. fix incomplete TOC : no Classe etc.
      5. +
      6. fix incomplete TOC : no Classes etc.
      7. add brief description for Functions etc.
      8. Comply with REPEAT_BRIEF
      9. Do not output duplicated contents when detailed description is missing.
      10. @@ -1793,7 +1793,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      11. Bug 5456 - Crash on \addindex \term [view]
      12. A new files have been added but is not incorporated in the windows build part [view]
      13. Add docbook directory to be removed as well [view]
      14. -
      15. Add extra (documenattion) directories to ignore pattern [view]
      16. +
      17. Add extra (documentation) directories to ignore pattern [view]
      18. Add index support to context [view]
      19. Add line numbers in case comment is not closed properly. [view]
      20. Add template context for annotated class index [view]
      21. @@ -1832,7 +1832,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      22. Fix id parsing for atx markdown headers [view]
      23. Fix segfault on invalid bounding FIG when patching dot [view]
      24. Fix to VHDL scanner. [view]
      25. -
      26. Fix typos in russian translation [view]
      27. +
      28. Fix typos in Russian translation [view]
      29. Fixed Tidy's 'empty span' warning in HTML output [view]
      30. Fixed compiler warnings in section.h [view]
      31. Fixed difference between generated XML schema and XML files for HTML entities [view]
      32. @@ -1847,7 +1847,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      33. Fixed typo in doxyindexer.vcproj [view]
      34. Fixes for missing build dependencies [view]
      35. Give message when PROJECT_LOGO cannot be found or cannot be converted [view]
      36. -
      37. Handlingh of -- by \c and <code> results in - adjusted documentation [view]
      38. +
      39. Handling of -- by \c and <code> results in - adjusted documentation [view]
      40. Improve rendering of sub and superscripts in LaTeX [view]
      41. Improved handling of percent symbol [view]
      42. Improved performance of rendering large index pages, by replacing images in the tables by spans [view]
      43. @@ -1893,7 +1893,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      44. Use hook arrow for hyphens in symbol names in the LaTeX output. [view]
      45. Wrong UTF 8 codes [view]
      46. Fix broken links to subpages in LaTeX output [view]
      47. -
      48. \xmlonly aoppeared twice in see also section of \htmlonly and \docbookonly [view]
      49. +
      50. \xmlonly appeared twice in see also section of \htmlonly and \docbookonly [view]
      51. add css-escape to avoid jquery based xss [view]
      52. add parameter [view]
      53. add search.py, a client for doxygen_sqlite3.db [view]
      54. @@ -2004,7 +2004,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      55. Allow links to other markdown pages of the form [link text](page.md)
      56. Avoid accessing uninitialized memory in fileToString
      57. Build problem with unistd.h and Cygwin The standard g++ compiler under windows (win32-g++) has unistd.gh file; Microsoft windows does not have it, therefore it is better to use the winbuild directory in case of windows and no dependency otherwise
      58. -
      59. Consistency in language part of the documentation Made documentation more inline with other parts of the documentation (regarding the way e.g. filenames are presented) Corrected some spelling errors Corrected the warning in the language.doc by placing ta reference to the files from which language.doc is generated Corrected the color for the languages that are still v1.4.6 (language name now also red in stead of a pink background, was confusing with languages that were 1.5 / 1.6 compatible)
      60. +
      61. Consistency in language part of the documentation Made documentation more inline with other parts of the documentation (regarding the way e.g. filenames are presented) Corrected some spelling errors Corrected the warning in the language.doc by placing a reference to the files from which language.doc is generated Corrected the color for the languages that are still v1.4.6 (language name now also red in stead of a pink background, was confusing with languages that were 1.5 / 1.6 compatible)
      62. Corrected some inconsistencies in the comments
      63. Debug output for lexical analyzer
      64. Deleted generated files from source repository
      65. @@ -2109,7 +2109,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      66. Bug 5225 - Segmentation fault parsing a fortran file
      67. Bug 5226 - Can't use @ref instead of \ref with msc
      68. Bug 5228 - Misleading warning about DOT font
      69. -
      70. Bug 5233 - Out-of-line docs for class template specialisations failing
      71. +
      72. Bug 5233 - Out-of-line docs for class template specializations failing
      73. Bug 5234 - Generated XML is malformed
      74. Bug 5239 - Nested Aliases fail when the nested alias has two or more arguments.
      75. Bug 5242 - doxygen don't hide private Inherited Members
      76. @@ -2206,7 +2206,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      77. id 5056: Added support for processing DocSets with Dash (thanks to Bogdan Popescu for the patch
      78. id 4900: Added option EXTERNAL_PAGES which can be used to determine - whether or not pages importated via tags will appear under related + whether or not pages imported via tags will appear under related pages (similar to EXTERNAL_GROUPS).
      79. id 5042: Added new MathJax command MATHJAX_CODEFILE which supports including a file with MathJax related scripting to be inserted before @@ -2253,7 +2253,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      80. id 4650: Replaced "echo -n" with "printf" in the configure script.
      81. id 4684: Removed warning when using \endinternal
      82. id 4696: Added &, @, and # as allowed characters for commands that
      83. -
      84. id 4788: Included patch by Abert to correctly link pages in the manual
      85. +
      86. id 4788: Included patch by Albert to correctly link pages in the manual
      87. id 4850: Added support for single column Markdown tables.
      88. id 4855: Incomplete documentation on doxygen -w latex
      89. id 4877: Doxygen crashed when structural commands (like \var) appeared @@ -2267,7 +2267,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887 rather than the file name.
      90. id 5059: build using ./configure ; make did not work if the path contained a space.
      91. -
      92. id 5060: Tag files are now identfied by the full path instead of +
      93. id 5060: Tag files are now identified by the full path instead of only the name of the tag file.
      94. id 5086: In some cases members were missing from the tag file.
      95. id 5079: Fortran: derive intent from documentation in case no @@ -2501,7 +2501,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      96. id 5001: Fixed case where doxygen would during preprocessing.
      97. id 5002: A file specified using HTML_EXTRA_STYLEHSHEET did not end up in the Qt Help index.
      98. -
      99. Improved the way enum's are rendered in the HTML output.
      100. +
      101. Improved the way enums are rendered in the HTML output.
      102. When inlining structs (INLINE_SIMPLE_STRUCTS=YES) a <p> was missing for members with a detailed description, causing invalid XHTML.
      103. Fixed problem loading the navigation tree when using .xhtml as the @@ -2583,7 +2583,7 @@ href="https://github.com/doxygen/doxygen/commit/a697caadf1912d0d74faa208f4cff887
      104. Added option AUTOLINK_SUPPORT which can be used to enable/disable autolinking globally.
      105. Included language updates for Czech, Spanish, Greek, Slovak, and - Esparanto.
      106. + Esperanto.

        Bug fixes

          @@ -2870,8 +2870,8 @@ make sure you add the following:
        • id 4651: Included patch by Ryan Schmidt to make the Mac versions in qglobal.h match that of Apple header files.
        • id 4659: Added C++11 classes when BUILTIN_STL_SUPPORT is enabled.
        • -
        • id 4662: Using a backslash in a section cause 026E30F to appear in the - latex TOC.
        • +
        • id 4662: Using a backslash in a section causes 026E30F to appear in the + LaTeX TOC.
        • id 4675: Fortran: case sensitiveness for routines and functions did not work
        • id 4676: Fortran: continuation by ampersand not placed in code output.
        • @@ -2934,7 +2934,7 @@ make sure you add the following: (amount of >'s determine the indentation level).
        • emphasis using *emphasize this* or _emphasis this_ or strong emphasis using **emphasis this**. Unlike classic - Markdown 'some_great_indentifier' is not touched.
        • + Markdown 'some_great_identifier' is not touched.
        • code spans can be created using back-ticks, i.e. `here's an example`
        • Using three or more -'s or *'s alone on a line with only spaces will produce a horizontal ruler.
        • @@ -3254,7 +3254,7 @@ make sure you add the following: depending on the code page (thanks to Hirao for the patch).
        • id 2867: The .spec file in the source distribution did not get updated to the latest version.
        • -
        • id 2872: Fortran: Continuation character was not recognised in +
        • id 2872: Fortran: Continuation character was not recognized in fixed format code.
        • id 2887: Fortran: @param checking was not case insensitive.
        • id 3168: Fixed problem combining @cond with preprocessor directives.
        • @@ -3290,7 +3290,7 @@ make sure you add the following: GENERATE_TREEVIEW was enabled.
        • id 4242: Linking to a section on the main page could result in a broken link when GENERATE_TREEVIEW was enabled.
        • -
        • id 4243: Fixed invalid warning when using @deparated method with +
        • id 4243: Fixed invalid warning when using @deprecated method with default values for parameters.
        • id 4245: A function made related using @relates could end up in the wrong class if there was already a method with a matching @@ -3378,7 +3378,7 @@ make sure you add the following:
        • id 4085: using @dot...@endot produced an image referenced with absolute path.
        • id 4091: \mscfile did not work properly for LaTeX output.
        • -
        • id 4095: Fixed problem where #include's could cause phantom __pad__ +
        • id 4095: Fixed problem where #include could cause phantom __pad__ members to appear in the output (appeared on Windows only).
        • id 4103: Options PROJECT_LOGO and PROJECT_BRIEF were missing from the manual.
        • @@ -3402,7 +3402,7 @@ make sure you add the following:
        • id 4128: Included patch to fix broken hyperlink to page entry in xreflists.
        • id 4136: Header of \page was wrong in Man page output.
        • -
        • id 4137: #include's to other directories were not always linked.
        • +
        • id 4137: #include to other directories were not always linked.
        • id 4140: Using "use Foo\Foo;" in PHP could cause doxygen to hang.
        • id 4142: In some cases the HTML output could contain an extra </p>.
        • id 4147: Tooltips with HTML entities could be wrongly truncated.
        • @@ -3428,7 +3428,7 @@ make sure you add the following:

          Changes

          • Added a header for each HTML page above the navigation menu, - showing the project name and logo and a short descriptin (all optional). + showing the project name and logo and a short description (all optional). Disabling the index (with DISABLE_INDEX) still shows the new header (you can still customize this using HTML_HEADER). This now works nicely in combination with GENERATE_TREEVIEW = YES and/or @@ -3471,7 +3471,7 @@ make sure you add the following: (thanks to Albert).
          • id 3731: Fixed problem handling @cond..@endcond in Fortran code.
          • id 3779: Scope was missing in Tokens.xml when using docsets.
          • -
          • id 3870, 2891: Applied patch tp avoid stripping prefixes for Fortran +
          • id 3870, 2891: Applied patch to avoid stripping prefixes for Fortran subroutines.
          • id 3895: allow label before end statement in Fortran
          • id 3956: </see> was not handled properly in comment block.
          • @@ -3543,7 +3543,7 @@ make sure you add the following:
          • id 2097, 2669: /// were not stripped from formulas and \dot..\enddot
          • id 3190: dropped support for a4wide paper format for LaTeX, since it is on the LaTeX taboo list.
          • -
          • id 3261: Behaviour of CLASS_DIAGRAM=NO in combination with +
          • id 3261: Behavior of CLASS_DIAGRAM=NO in combination with HAVE_DOT=YES, was not properly documented.
          • id 3332: Python comments for next class or method could end up in code of a method/class when enabling INLINE_SOURCES.
          • @@ -3583,7 +3583,7 @@ make sure you add the following:
          • id 3877: In the HTML output </div> was missing for built-in class diagrams.
          • id 3876: References in example files with underscores were wrong.
          • -
          • id : When using Japanese characters mixed with ascii characters +
          • id : When using Japanese characters mixed with ASCII characters doxygen incorrectly ended the brief description with a dot.
          • id 3886: setting MULTILINE_CPP_IS_BRIEF to YES, cause /// to appear in the output.
          • @@ -3595,7 +3595,7 @@ make sure you add the following:
          • id 3898: \copydoc did not work for array type arguments (e.g. int[]).
          • Use \dotfile did not produce the correct map file, so URLs in dot files did not work.
          • -
          • id 3907: #define's in files only found via INCLUDE_PATH were not +
          • id 3907: #define in files only found via INCLUDE_PATH were not correctly handled.
          • id 3918: auto brief description ending with .) cause the ) to end up in the detailed part.
          • @@ -3607,7 +3607,7 @@ make sure you add the following:
          • id 3937: Latex makefile clean target used rm command also for Windows.
          • id 3939: the EXCLUDE_SYMBOLS option was missing form the online docs.
          • id 3962: \htmlinclude and \verbinclude ended the brief description.
          • -
          • id 3963: Inconsistent behaviour when a brief description was given +
          • id 3963: Inconsistent behavior when a brief description was given following by a detailed comment block with JAVADOC_AUTOBRIEF enabled.
          • Fixed a number of typos in the documentation (thanks to Albert)
          • @@ -3683,7 +3683,7 @@ make sure you add the following: and HTML_COLORSTYLE_GAMMA, which control respectively the hue, saturation, and gamma of all elements in the HTML output.
          • Moved dot invocations to the end of a doxygen run. Doxygen will now - run multiple instances of dot in parallel (for better CPU utilisation + run multiple instances of dot in parallel (for better CPU utilization on multi-core systems). The new config option DOT_NUM_THREADS determines the number of threads used (were 0 is auto-detect).
          • Added option EXT_LINKS_IN_WINDOW which controls whether or not @@ -3698,7 +3698,7 @@ make sure you add the following:
          • id 2255, 3796: \if and \endif did not work properly inside auto lists.
          • id 3139: No warning for missing return type documentation even though WARN_NO_PARAMDOC was set to YES.
          • -
          • id 3341: Handling of nesting \defgroup's was not always working +
          • id 3341: Handling of nesting \defgroup was not always working properly.
          • id 3355: ø was not translated correctly in the LaTeX output.
          • id 3401: Use relative paths for mscgen diagrams to avoid errors in the @@ -4063,7 +4063,7 @@ make sure you add the following:
          • id 3457: Fixed problem handling strings like a"\b" within a comment.
          • id 3459: Fixed problem matching explicitly scoped parameter in a template class.
          • -
          • id 3473: A namespaced with name "internal" (C++/CLI keyword) +
          • id 3473: A namespace with name "internal" (C++/CLI keyword) could confuse doxygen's C++ parser.
          • id 3477: @optional/@required attributes for Objective-C were missing from the XML output.
          • @@ -4183,8 +4183,8 @@ make sure you add the following:
          • id 437346: Fixed issue handling multibyte characters in the RTF output.
          • id 475377: Improved error handling in case of character encoding problems.
          • -
          • id 486747: Inherited typedefs were not resolved propertly.
          • -
          • id 508752: Add support for BLOCK DATA to the fortran parser.
          • +
          • id 486747: Inherited typedefs were not resolved properly.
          • +
          • id 508752: Add support for BLOCK DATA to the Fortran parser.
          • id 532695: included documentation update about the use of \public and friends for object-oriented programming in C.
          • id 532808: References to class variables in PHP code did not already work.
          • @@ -4206,7 +4206,7 @@ make sure you add the following: wrong line counting and missing cross-references.
          • id 545128: \overload didn't work if it was the last statement in a comment and not followed by a newline.
          • -
          • id 553380: Removed bogus warning refering to a namespace member from +
          • id 553380: Removed bogus warning referring to a namespace member from with a brief description that was converted to a tooltip.
          • id 553968: Added support for JavaDoc command {@code ... }
          • id 554444: Bullet lists were no longer correctly indented when using @@ -4318,7 +4318,7 @@ make sure you add the following: INCLUDED_BY_GRAPH. Run doxygen with the -l option to generate the default layout file.
          • Included update for the Macedonian, Catalan, Brazilian, and Serbian - translation and also support for Serbian with Cyrilic characters.
          • + translation and also support for Serbian with Cyrillic characters.

          Bug fixes

            @@ -4358,14 +4358,14 @@ make sure you add the following: from multi-byte UTF-8 characters.
          • id 544479: SORT_MEMBER_DOCS did not work for class members.
          • id 546621: Fixed makefile so that .svn stuff is removed from the - tarball when doing "make archive".
          • + tar-ball when doing "make archive".
          • id 546812: Using a table with row span greater than 1 did not produce correct LaTeX output.
          • id 545098: Fixed problem parsing where clauses in combination with C# generics.
          • id 545503: Nameless parameters of type "struct A" could end up wrongly in the XML output.
          • -
          • id 545970: Refering to the main page did not work as advertised.
          • +
          • id 545970: Referring to the main page did not work as advertised.
          • id 546158: The variable defined inside a foreach statement in C# code was not considered for source linking, cause potentially incomplete call graphs.
          • @@ -4396,7 +4396,7 @@ make sure you add the following:
          • id 553616: One can now remove the automatic line breaks in the type part of a declaration by using a custom stylesheet with BR.typebreak { display: none; }
          • -
          • id 553663: Aliases did not work in Fortan comments.
          • +
          • id 553663: Aliases did not work in Fortran comments.
          • id 549022: Reimplemented in links could be wrong in case of overloaded members.
          • id 553225: Parser was confused by arrays inside an Obj-C message.
          • @@ -4432,7 +4432,7 @@ make sure you add the following:
          • id 519573: Included patch to make the font-size button visible in the CHM output.
          • id 521288: Added new options SHOW_NAMESPACES and SHOW_FILES to - Suppress Namepace and Files Pages.
          • + Suppress Namespace and Files Pages.
          • id 521495: Included a patch that makes it easy to modify the root of the html treeview with an image using style sheets.
          • id 522300: Added option IDL_PROPERTY_SUPPORT to enable/disable special @@ -4461,8 +4461,8 @@ make sure you add the following:
          • id 495687: Replaced MAX_DOT_GRAPH_MAX_NODES with DOT_GRAPH_MAX_NODES in the docs & config file.
          • id 508694 Fixed problem with mixed simple and double quotes in - fortran format declaration
          • -
          • id 508752: Fixed problem where the fortran scanner didn't recognize END
          • + Fortran format declaration +
          • id 508752: Fixed problem where the Fortran scanner didn't recognize END
          • id 510971: Fortran: parser was confused by double REAL() in processed statements.
          • id 514488: Fixed problem matching argument lists with const qualifiers.
          • @@ -4503,7 +4503,7 @@ make sure you add the following:
          • id 524473: Removed incorrect warnings about parameters in VHDL.
          • id 525140: Improved handling of Objective-C 2.0 properties.
          • id 525143: Properties are now listed as attributes in the UML diagrams.
          • -
          • id 525144: GENERATE_DOCSET option greyed out in doxywizard.
          • +
          • id 525144: GENERATE_DOCSET option grayed out in doxywizard.
          • id 526155: Removed warning about QFile::setName when parsing VHDL files.
          • id 527781: Template arguments for bases class not shown in a consistent way.
          • @@ -4545,7 +4545,7 @@ make sure you add the following: #define C(S,m) /** container S */ struct S { /** value m */ int m; }
          • id 493923: The options SOURCE_BROWSER, CALL_GRAPH, CALLER_GRAPH, - REFERENCES_RELATION, and REFERENCED_BY_RELATION can now be indepently + REFERENCES_RELATION, and REFERENCED_BY_RELATION can now be independently enabled and disabled. By default the relations are now disabled.

          New features

          @@ -4553,7 +4553,7 @@ make sure you add the following:
        • Added support for VHDL (.vhd or .vhdl extension) based on a patch by Martin Kreis. Use OPTIMIZE_OUTPUT_VHDL when parsing VHDL code.
        • id 374699: Added support for Objective-C 2.0 properties.
        • -
        • Added compilation support for MacOSX 10.5 (Leopard) incombination with +
        • Added compilation support for MacOSX 10.5 (Leopard) in combination with Xcode 3
        • Added support for docsets, which allow integration of doxygen generated API documentation in Xcode 3. new options: @@ -4572,7 +4572,7 @@ make sure you add the following: the second and third argument of a \class command, when the documentation is already in front of a class definition.
        • Added translator support for Macedonian.
        • -
        • Added language updates for German, Perian, Spanish, Taiwanese, +
        • Added language updates for German, Persian, Spanish, Taiwanese, and Chinese, Korean, Croatian.

        Bug fixes

        @@ -4607,7 +4607,7 @@ make sure you add the following: some compilers.
      107. id 492027: Ampersand (&) in front of parameter stops documenting of PHP source
      108. -
      109. id 493249: using a namespace (or fortran module) caused the namespace +
      110. id 493249: using a namespace (or Fortran module) caused the namespace to appear in the documentation as if it was defined.
      111. id 493434: Nested C# style XML lists in a comment block were not handled correctly.
      112. @@ -4631,7 +4631,7 @@ make sure you add the following:
      113. id 500635: Project name is no longer placed before each top level item in the treeview and other indices.
      114. id 500465: Fixed some issues compiling for AIX.
      115. -
      116. id 500928: Fixed parser issue handling a tripple quoted +
      117. id 500928: Fixed parser issue handling a tipple quoted string when used to initialize a Python variable.
      118. id 500944: Python variables with package scope were only extracted if EXTRACT_STATIC was enabled.
      119. @@ -4650,7 +4650,7 @@ make sure you add the following:
      120. id 507603: Enabling FILTER_SOURCE_FILES caused strange warnings when INPUT_FILTER is empty.
      121. id 508740: Using upper case port mode specifiers did not work correctly.
      122. -
      123. id 508753: Fortran: Added .f as allowed fortran extension.
      124. +
      125. id 508753: Fortran: Added .f as allowed Fortran extension.
      126. id 508759: Fortran: fixed potential memory corruption while scanning parameter lists.
      127. id 507528: XML output was not correct for pointer arrays.
      128. @@ -4659,7 +4659,7 @@ make sure you add the following: documentation.
      129. id 509582: Fortran: Spaces in function return type were not parsed properly.
      130. -
      131. id 510387: Fortran scanner didn't parse initialisation of complex type +
      132. id 510387: Fortran scanner didn't parse initialization of complex type correctly.
      133. id 511921: @file command ended brief description even when JAVADOC_AUTOBRIEF was enabled.
      134. @@ -4692,7 +4692,7 @@ make sure you add the following: (used for Python to C++ bindings).
      135. id 475828: Added support for CLI/C++ style indexed properties.
      136. Added config option TYPEDEF_HIDES_STRUCT which when enabled treats a typedef - of a struct as a struct with the name of the typedef. This behavious was + of a struct as a struct with the name of the typedef. This behavior was coupled to OPTIMIZE_OUTPUT_FOR_C in the previous version and is now an independent option.
      137. Included updates for the Korean, Brazilian and Chinese translations.
      138. @@ -4784,7 +4784,7 @@ make sure you add the following:
      139. When OPTIMIZE_OUTPUT_FOR_C is enabled then a struct definition of the form typedef struct _S { ... } S_t will be shown in the output as a struct of type S_t and the typedef itself is omitted - (previousily _S was shown + (previously _S was shown as well as a typedef of the form typedef _S S_t).
      140. Improved the line-breaking rules for members whose return types have many characters (for example a function returning a pointer to a template class).
      141. @@ -4970,7 +4970,7 @@ make sure you add the following:
      142. id 390821: Fixed problem parsing Java 1.5 enums with initializers.
      143. id 391619: When dot produces an non-zero return code, doxygen now prints the return code and the command it tried to execute.
      144. -
      145. id 407815: Doxygen's got confused by certain combinations of " and ' s in PHP code.
      146. +
      147. id 407815: Doxygen got confused by certain combinations of " and ' in PHP code.
      148. id 409935: Fixed bug in qcstring.cpp
      149. id 411300: PDF/Latex output was broken for operator[] documentation.
      150. id 411328: Fixed Accessibility/Section 508 Compliance issue.
      151. @@ -5034,7 +5034,7 @@ make sure you add the following:
      152. id 131445: Fixed autolinking for related functions.
      153. id 137236: Updated documentation to make it clear that a lower-case only word is not a candidate for autolinking.
      154. -
      155. id 141758: Fixed a problem parsing <?=...?> contructs outside of functions in PHP.
      156. +
      157. id 141758: Fixed a problem parsing <?=...?> constructs outside of functions in PHP.
      158. id 319169: Second level index not shown when DISABLE_INDEX=YES.
      159. id 325337: Added "optimize output for C#" option to Doxywizard.
      160. id 325426: Partial C# class inside a namespace where not handled properly.
      161. @@ -5068,7 +5068,7 @@ make sure you add the following: an anonymous namespace
      162. id 349867: Fixed issue handling brief and detailed description when both are positioned after an item.
      163. -
      164. id 350168: Doxygen didn't parse C# type contraints properly.
      165. +
      166. id 350168: Doxygen didn't parse C# type constraints properly.
      167. id 351890: In some cases C# attributes were treated as properties.
      168. id 353044: C99 style variadic macros were not handled properly by doxygen.
      169. id 353195: Member grouping with SUBGROUPING = YES now works the same for files @@ -5249,7 +5249,7 @@ make sure you add the following: set.
      170. id 318460: Multiply-defined labels if two function specializations differ only on the name of a template parameter.
      171. -
      172. id 319219: Spurious space was inserted after inlined math formulae.
      173. +
      174. id 319219: Spurious space was inserted after inlined math formulas.
      175. id 319826: The file name for template classes could become too long causing files that cannot be created by some file systems.
      176. id 320026: undocumented "typedef struct foo baz" causes subsequent @@ -5362,7 +5362,7 @@ make sure you add the following:
      177. id 311198: If JAVADOC_AUTOBRIEF was set to YES, a \todo or \bug like command always ended at the first dot.
      178. id 311207: The /* and */ inside a \code ... \endcode code fragment - were stipped.
      179. + were stripped.
      180. id 311577: Putting a documentated class name in the title of the main page caused a LaTeX error if pdf hyperlinks were enabled.
      181. id 311665: Fixed compile issue for Solaris.
      182. @@ -5464,13 +5464,13 @@ make sure you add the following:
      183. id 304598: Using operator-- in resulted in broken HTML output due to the embedded doxytag that include the end of a HTML comment.
      184. id 304623: Spreading a @fn command over multiple lines didn't work - anymore without using line-contination characters.
      185. + anymore without using line-continuation characters.
      186. id 304666: Attributes of the same class appeared separated with \n in collaboration diagrams
      187. -
      188. id 304751: A define "foo()" was indisguishable from a define "foo" in +
      189. id 304751: A define "foo()" was indistinguishable from a define "foo" in the XML output.
      190. id 304752: XML location tag attribute "file" could have the - syntactially wrong value "<generated>" in some cases.
      191. + syntactically wrong value "<generated>" in some cases.
      192. id 305334: INPUT_FILTER tag did not work properly anymore due to additional quotes.
      193. id 305364: Improved argument matching routine to avoid cases where @@ -5581,12 +5581,12 @@ make sure you add the following: CASE_SENSE_NAME was set to NO.
      194. id 170592: Using \ref for Objective-C methods did not work if the name contained a colon.
      195. -
      196. id 171795: Refering to Objective-C methods now follows Apple's +
      197. id 171795: Referring to Objective-C methods now follows Apple's conventions.
      198. id 171878: When JAVADOC_AUTOBRIEF = YES and there was no blank line after a page command, the first sentence did not appear in the documentation.
      199. -
      200. id 171923: Doxygen failed to match arguments for a function documentated +
      201. id 171923: Doxygen failed to match arguments for a function documented out-of-line with @fn and using @relatesalso.
      202. id 172118: Doxywizard now shows the version of doxygen it is for.
      203. id 172133: Doxygen did not longer ignore preceding C++ comments inside a @@ -5596,7 +5596,7 @@ make sure you add the following:
      204. id 172329: The index of the CHM did not always link to groups correctly.
      205. id 172456: Fixed case where doxygen had problems differentiating const and non-const member functions.
      206. -
      207. id 172494: @code blocks were not poperly ignored by the preprocessor +
      208. id 172494: @code blocks were not properly ignored by the preprocessor in some cases.
      209. id 172622: Fixed parse problem for Objective-C method implementations whole declaration part ended with a semicolon.
      210. @@ -5754,7 +5754,7 @@ make sure you add the following: an anonymous namespace.
      211. id 169549: Previous fixes introduced flattening of the class hierarchy.
      212. id 169640: File suffix check for the D language was broken.
      213. -
      214. id 169641: D contructors and destructors were not detected.
      215. +
      216. id 169641: D constructors and destructors were not detected.
      217. is 169657: Fixed the way import is treated in D to prevent recursive lockup.
      218. id 169784: Objective-C methods with a variable number of arguments were @@ -5881,7 +5881,7 @@ make sure you add the following:
      219. id 155272: Image filenames in RTF output were not quoted causing problem with custom images whose name contained spaces.
      220. id 155322: Fixed parse problem for php code containing '#'.
      221. -
      222. id 155224: Java interfaces did't resolve across packages w/o FQN.
      223. +
      224. id 155224: Java interfaces didn't resolve across packages w/o FQN.
      225. id 156411: Return type of a function was not hyperlinked in some cases (typical with nested namespaces or Java packages).
      226. id 156445: function seen first in header and doc'ed in @@ -6129,7 +6129,7 @@ make sure you add the following:
      227. Included patch that removes some cosmetic annoyances in the man page output (thanks to Chris Croughton).
      228. Added internationalization support for Afrikaans and - Lithanian. Included language updates for Dutch, + Lithuanian. Included language updates for Dutch, Czech, Italian, Brazilian, Croatian, Japanese, Norwegian and Russian.
      229. @@ -6146,7 +6146,7 @@ make sure you add the following:
      230. id 138394: C style comments placed on the same line after a macro definition appeared as part of the macro's value.
      231. id 138429: Fixed language setting for HTML output when using - traditional chinese.
      232. + traditional Chinese.
      233. id 140259: Using @dotfile in a comment block could cause broken @refs to sections defined after the @dotfile command.
      234. id 141915: Fixed a couple of problems with the RTF output.
      235. @@ -6309,7 +6309,7 @@ make sure you add the following:
      236. Examples (documented via \example) are now included in the XML output.
      237. New option SORT_BRIEF_DOCS which when enabled will list the declaration section of the documentation (with the brief descriptions) - in alpabetical order, instead of declaration order (thanks to + in alphabetical order, instead of declaration order (thanks to Akos Kiss for the patch).
      238. Included patch for Hungarian translation (thanks to Akos Kiss) and for the Serbian language. Added support for mixed Korean/english @@ -6364,7 +6364,7 @@ make sure you add the following:

        New features

        • Added support for parsing K&R style function prototypes. - Please try it on your favourite legacy C project and report any + Please try it on your favorite legacy C project and report any problems.
        • Included languages updates for Traditional Chinese, Danish, German, Korian translation.
        • @@ -6374,7 +6374,7 @@ make sure you add the following: generating source code listings as part of the XML output (thanks to Paul Ross for the patch).
        • Added new config option ABBREVIATE_BRIEF which makes the - abbration process of brief descriptions configurable and language + aberration process of brief descriptions configurable and language independent (thanks to Jake Colman for the patch).
        • The alphabetical class list now comes with a quick index (thanks to Marcin Zukowski for the patch).
        • @@ -6396,7 +6396,7 @@ make sure you add the following: was produced.
        • id 123206: Fixed problem in qtools when opening files in text mode.
        • id 123322: The search page did not honor DISABLE_INDEX.
        • -
        • id 123420: Functions with a brief description caused bugus </em> tags +
        • id 123420: Functions with a brief description caused bogus </em> tags in the HTML output.
        • id 124114: typo in the generated PHP search script could cause errors in the search result page.
        • @@ -6436,7 +6436,7 @@ make sure you add the following:
        • Fixed problem that HTML image maps ended up in the RTF output.
        • Fixed bug in code fragment parser that could cause memory corruption in certain cases.
        • -
        • Fixed problem matching definition and declation of functions, which +
        • Fixed problem matching definition and declaration of functions, which could cause bogus warnings for functions with the same name but in different namespaces.
        • Using "/// @file" to document a file quickly was not possible, while @@ -6679,7 +6679,7 @@ make sure you add the following:
        • Links to groups imported via tag files were broken.
        • Fixed problem resolving class relations for nested classes within namespaces.
        • -
        • Static members can now be documentated in a separate file using \fn +
        • Static members can now be documented in a separate file using \fn as long as they have unique names. If the names are not unique the documentation must be located in the same file (as was required before).
        • In arguments and return types of the form NA::A were not linked if NA @@ -6704,7 +6704,7 @@ make sure you add the following:
        • Fixed problem handling omission of the optional arguments of the \image command.
        • Enabling HIDE_IN_BODY_DOCS did not work properly if C++-style special - comments were used inside the body of a fucntion.
        • + comments were used inside the body of a function.
        • Fixed problem cross-referencing variables used as a guard (i.e. if (var) ...)
        • Setting ENUM_VALUES_PER_LINE to 0 caused a division by 0 error.
        • @@ -6776,7 +6776,7 @@ make sure you add the following:
        • Fixed preprocessor problem with parsing /*//*/
        • URL's in the docs using <a href=""> caused a nested link.
        • "using namespace A::B;" confused the code parser.
        • -
        • Interface keyword was not recognised in C# (thanks to Onorio Catenacci +
        • Interface keyword was not recognized in C# (thanks to Onorio Catenacci for the patch).
        • Line counting was incorrect when parsing multi-line formulas.
        • \section's in a \mainpage are now correctly numbered in the LaTeX @@ -6829,7 +6829,7 @@ make sure you add the following: if they were documented.
        • The treeview page was not rendered with the right character set (it was always English).
        • -
        • Explicit template instantations appeared as a variable in the output.
        • +
        • Explicit template instances appeared as a variable in the output.
        • Java instance and static initializer blocks are now correctly parsed and can be documented.
        • Fixed bug in the LATEX_HIDE_INDICES option.
        • @@ -6897,7 +6897,7 @@ make sure you add the following: was already suggested in the docs).
        • source code line in the XML output didn't escape special characters like & anymore.
        • -
        • Fixed small bug in german translation (thanks to Jens Seidel).
        • +
        • Fixed small bug in German translation (thanks to Jens Seidel).
        • e-mail addresses with multiple dots got truncated when linked.
        • Attributes of html commands with value "" where not properly parsed causing the image in the legend page not to appear.
        • @@ -6931,7 +6931,7 @@ make sure you add the following:
        • Fixed problem in code browser that prevented linking to global variables defined in other files.
        • When putting a "using namespace X" in a header file doxygen did not - recognise this in files that included the header file.
        • + recognize this in files that included the header file.
        • Fixed bug in parsing sections without title.
        • doxytag did not include anchor in the search index. Thanks to Joerg Schlichenmaier for the fix.
        • @@ -6978,7 +6978,7 @@ make sure you add the following:
        • RCS/CVS tags did not appear in the output.
        • @note section result in section with type "bug" in the XML output.
        • Dot graphs were truncated too quickly in some cases.
        • -
        • Files with a .php4 extension are now recognised as PHP files.
        • +
        • Files with a .php4 extension are now recognized as PHP files.
        • Source browser could get out of sync causing wrong cross references.
        • Text after @} could end up in another documentation block.
        • Putting a style command such as \c or \b at the end of a line, before @@ -7020,7 +7020,7 @@ make sure you add the following:
        • Included language updates for French, Czech, and Russian.
        • Included a number of enhancements to the xml parser (thanks to a patch by Tree).
        • -
        • Locally documentated parameters now appear in the XML output +
        • Locally documented parameters now appear in the XML output (thanks to Cormac Twomey for the patch).
        • The preprocessor now inserts line control commands where appropriate.
        @@ -7028,7 +7028,7 @@ make sure you add the following:
        • Aliased \if .. \endif commands around a \brief section were not handled properly.
        • -
        • Warnings for undocumentation members were not generated anymore +
        • Warnings for undocumented members were not generated anymore in certain cases.
        • A member of a group linked with \ref showed the group's title as link text instead of the member's name.
        • @@ -7111,7 +7111,7 @@ make sure you add the following:
        • Undocumented private friend classes no longer cause warnings
        • Undocumented private classes no longer cause warnings
        • Undocumented members are now hidden if they are - default constuctors, destructors or reimplemented.
        • + default constructors, destructors or reimplemented.
      239. Pages introduced via \page are now context aware. This means that if you put them inside a class or namespace, names do not have @@ -7126,11 +7126,11 @@ make sure you add the following: that a list of all deprecated items is generated. Thanks to Angela Marshall for the patch.
      240. Enum value documentation was added to the XML output.
      241. -
      242. Files ending with ".inc" are now recognised as PHP files +
      243. Files ending with ".inc" are now recognized as PHP files (thanks to Marcus Ahlfors).
      244. Included updated documentation for language translators (thanks to Petr Prikryl).
      245. -
      246. Included language updates for Czech, Slovak, Brazillan, Croatian, +
      247. Included language updates for Czech, Slovak, Brazilian, Croatian, Portuguese, Russian, Polish, Japanese and Serbian. Include language support for Catalan (thanks to Albert Mora)
      248. Included .dsp update by Simon Goodwin (already needs to be updated @@ -7218,12 +7218,12 @@ make sure you add the following: of some item and paste it in another documentation block.
      249. i18n: Added support for the Serbian language (thanks to Dejan Milosavljevic). Included a new language option Japanese-en for combined Japanese - and english.
      250. + and English.
      251. Included patch for dealing with variable argument macros in @param (thanks to Alfred Heggestad).
      252. Added new option MULTILINE_CPP_IS_BRIEF to make doxygen treat a multi-line brief comment block as a brief description. Set this to - YES to obtain the behaviour of version 1.2.15 and earlier. Default as + YES to obtain the behavior of version 1.2.15 and earlier. Default as of version 1.2.16 is to treat multi-line C++ comment block as a detailed description.
      253. New option CHM_FILE to set the .chm file (and path) to use for @@ -7298,7 +7298,7 @@ make sure you add the following:
      254. operator|() caused invalid entries in the latex index.
      255. Fixed bug parsing URLs with curly braces in documentation blocks.
      256. -
      257. Html help output now uses the correct language code if non english +
      258. Html help output now uses the correct language code if non English language is selected.
      259. Fixed bug in generate makefile for latex output (thanks to Petr Prikryl)
      260. @@ -7306,7 +7306,7 @@ make sure you add the following: confused the parser.
      261. Fixed problem handling function typedefs.
      262. \endif appeared in output when used via ALIASES in a brief description.
      263. -
      264. Included heuristic to distiguish between a variable definition +
      265. Included heuristic to distinguish between a variable definition with initialization via a constructor and a function prototype (e.g. "Test var(initVal);", v.s. "Test func(SomeType);").
      266. Fixed lock-up problem when to @brief were put after each other in a @@ -7373,10 +7373,10 @@ make sure you add the following: Please report any problems that remain.
      267. Alias commands put in separate parameter documentation blocks were not resolved.
      268. -
      269. The documentation for arguments, documented with a seperate +
      270. The documentation for arguments, documented with a separate documentation block, was not consistently shown in source and header files, depending on the order of the input files.
      271. -
      272. The characters '(', ')', '$', ''', and ';' were not recognised +
      273. The characters '(', ')', '$', ''', and ';' were not recognized as part of an URL.
      274. Grouped enum values could not share the same documentation block even when DISTRIBUTE_GROUP_DOC is YES.
      275. @@ -7397,7 +7397,7 @@ make sure you add the following: classes, imported via using declarations, as their parameter type.
      276. Fixed bug in conditional section handling for cases like: @if guard text @else more text @endif
      277. -
      278. The html help files did not honour the HTML_FILE_EXTENSION settings.
      279. +
      280. The html help files did not honor the HTML_FILE_EXTENSION settings.
      281. Removed bogus warning when using @param for function-type parameters.
      282. Include statements in the source browser output now link to the @@ -7470,7 +7470,7 @@ make sure you add the following: with full access to documentation blocks. Made inheritance/collaboration diagrams accessible via the XML parser API (see addon/doxmlparser/include/doxmlintf.h). - Reorganised the internals of the XML parser so the API does + Reorganized the internals of the XML parser so the API does not require destructors. Made the parser more portable (it should compile with gcc and M$ visual C++ now).
      283. @@ -7493,7 +7493,7 @@ make sure you add the following:
      284. In some cases the tree view showed leaf elements as non-leafs.
      285. Fixed a number of cases where illegal characters could end up in the XML output.
      286. -
      287. If a function in a base class was (re)implemented by serveral classes +
      288. If a function in a base class was (re)implemented by several classes only one of them appeared in the "(re)implemented in" list.
      289. graph_legend.gif was hardcoded in translator_*.h files. Note to translators: this has affected all translator files, so please @@ -7560,7 +7560,7 @@ make sure you add the following: this tag switches off the language filter... */ - Which of the language specific fragments is outputed depends + Which of the language specific fragments is outputted depends on the setting of OUTPUT_LANGUAGE (Thanks to Milan Rusek for the patch).
      290. Added build support for Cygwin (thanks to Ryunosuke Sato).
      291. Added new option HTML_FILE_EXTENSION to allow different file extension @@ -7595,7 +7595,7 @@ make sure you add the following:
      292. Undocumented classes exposed when setting EXTRACT_ALL to YES, could result in broken links in the class hierarchy.
      293. Exception specifications in Java were not parsed properly.
      294. -
      295. If INLINE_INHERITED_MEMB was YES, pure vitual members of base classes +
      296. If INLINE_INHERITED_MEMB was YES, pure virtual members of base classes reachable via multiple paths appeared more than once in the documentation.
      297. Removed potential recursive loop when computing reimplements relations @@ -7856,7 +7856,7 @@ make sure you add the following:
      298. Fixed a number of XML output bugs (thanks to Christian Hammond).
      299. Fixed bug parsing character literals.
      300. Fixed bug in RTF output (bracket mismatch).
      301. -
      302. Inializer of the last enum value of an enum did not always appear.
      303. +
      304. Initializer of the last enum value of an enum did not always appear.
      305. Dots were removed from return types in Java.
      306. In some cases a broken "More..." link was generated after a brief class description.
      307. @@ -7965,10 +7965,10 @@ make sure you add the following:
        • Friend class declarations are now treated as normal members.
        • Completely rewrote the way templates are handled. - Doxygen now (internally) computes all template instances it encounters. + Doxygen now (internally) computes all template instantiations it encounters. This has the following advantages:
            -
          • Template instances are now shown in the hierarchical index +
          • Template instantiations are now shown in the hierarchical index and in all class diagrams in a uniform way.
          • The list of all members is now correct for classes deriving from a template.
          • @@ -7986,7 +7986,7 @@ make sure you add the following:
          • Added GNU install tool auto detection to the configure script.
          • Included update for French translation (thanks to Xavier Outhier) Olexij Tkatchenko has added support for the Ukrainian language. - Included update for Portuguese and Brazillian.
          • + Included update for Portuguese and Brazilian.
          • Added --docdir option to the configure script.
          • Using the non-commercial version of Qt for windows, it is now possible to build doxywizard for windows.
          • @@ -8001,7 +8001,7 @@ make sure you add the following:
          • Removed bogus warnings when parsing tag files.
          • The detailed description in a @name block can now be more than plain text.
          • -
          • Included fix for the tree view script for the mozilla browser +
          • Included fix for the tree view script for the Mozilla browser (thanks to Alec Panovici).
          • Grouping members with the same signature but with a different scopes is now possible.
          • @@ -8036,7 +8036,7 @@ make sure you add the following: list of all members, while they were accessible from the derived class.
          • Reworked part of the template handling. Doxygen should now be capable of handling nested template classes correctly. Please test - this if you are using these contructs. Thanks to Christoph Koegl + this if you are using these constructs. Thanks to Christoph Koegl for providing some difficult test cases.
          • Fixed parse problem when parsing << as part of the first argument of a typedef.
          • @@ -8088,7 +8088,7 @@ make sure you add the following:

            New features

            • The dot generated inheritance and collaboration graphs for classes - should now show the proper template instantation for the derived/used + should now show the proper template instantiation for the derived/used classes. For instance it should show that class S uses class V (indirectly) in the following example:
              @@ -8127,7 +8127,7 @@ make sure you add the following:
               
                      \defgroup must be used exactly once for a group, so you should
                      provide a title. Without the title you will get a warning and
              -       doxygen will use the name as title (this is the old behaviour).
              +       doxygen will use the name as title (this is the old behavior).
                      
                      /** \addtogroup name */
                      
              @@ -8176,7 +8176,7 @@ make sure you add the following:

              Bug fixes

              • Fixed a bug in the LaTeX output generation (empty lists).
              • -
              • Doxygen can now distiguishing f(const A) from f(const B) +
              • Doxygen can now distinguishing f(const A) from f(const B) even though they match from a syntactical point of view.
              • A template base class that is actually an inherited template argument of the derived class is no longer shown in the output @@ -8265,7 +8265,7 @@ make sure you add the following:
              • Setting OPTIMIZE_OUTPUT_FOR_C still produced some C++-ish sentences for the list of all struct/union fields.
              • Undocumented friend functions were listed as friend classes.
              • -
              • A CORBA IDL union with a switch was not always recognised correctly.
              • +
              • A CORBA IDL union with a switch was not always recognized correctly.
              • doxygen did not handle try-function-blocks with multiple catch clauses properly.
              • \bug and co. were not working for static members.
              • @@ -8320,8 +8320,8 @@ make sure you add the following:
                • the addin no longer requires administrator privileges to work (thanks to Michael Beck)
                • -
                • the existance of files is now checked (thanks to Pekka Pessi).
                • -
                • .odl and .inl files are recognised (thanks to Pekka Pessi).
                • +
                • the existence of files is now checked (thanks to Pekka Pessi).
                • +
                • .odl and .inl files are recognized (thanks to Pekka Pessi).
              @@ -8351,7 +8351,7 @@ make sure you add the following: if EXTRACT_PRIVATE is set to YES, instead of just the non-inherited private members.
            • Fixed autolink problem for grouped members.
            • -
            • Mutliple static global functions with the same name (but in different +
            • Multiple static global functions with the same name (but in different files), which were forward declared, could make doxygen put the wrong documentation block at the wrong global function.
            • Support for Norwegian was not enabled.
            • @@ -8378,7 +8378,7 @@ make sure you add the following:
            • Putting <a href="..."><img src="..."></a> in the docs will now work as expected for HTML.
            • Fixed problems with >pre>...>/pre> block in LaTeX.
            • -
            • Putting &ccedil; in the docs now preduces a c-cedille.
            • +
            • Putting &ccedil; in the docs now produces a c-cedille.
            @@ -8430,7 +8430,7 @@ make sure you add the following:

            Bug fixes

            • Fixed 0-pointer bug that could crash doxygen in some cases.
            • -
            • Starting a list in a brief JavaDoc-style description splitted +
            • Starting a list in a brief JavaDoc-style description split the list into two invalid parts if a list item ended with a dot.
            • Fixed a problem with linking to grouped class members.
            • Indenting of code fragment in LaTeX output was not always correct. @@ -8517,7 +8517,7 @@ make sure you add the following:
            • \ingroup can now be put in a one line comments (thanks to Patrick Ohly)
            • \ingroup in a comment block before a comma separated list of variables is now applied to all variables (as is the documentation - itself). (thanke to Patrick Ohly for the patch)
            • + itself). (thanks to Patrick Ohly for the patch)
            • @{ .. @} blocks can now be used for normal groups as well (thanks to Trevor Robinson for the patch). Here is an example:
              @@ -8623,7 +8623,7 @@ make sure you add the following:
               
              • Support for the Slovene language (thanks to Matjaz Ostroversnik)
              • Bit fields for struct members are now shown in the documentation.
              • -
              • Enabled "favourites" and "Full text-search" for the generated +
              • Enabled "favorites" and "Full text-search" for the generated HTML Help browser files.
              • Added support for M$-IDL properties. The "methods:" section now also works.
              • @@ -8678,9 +8678,9 @@ make sure you add the following: now always pointing to the correct file (thanks to Bill Soudan for the patch).
              • Fixed HTML bug in non-indexed namespace member lists.
              • -
              • Using `:' inside ID's caused problems for some - XML parsers. I'm now using "__" instead. Also removed @ from appearing - in the output when annonymous compounds were used.
              • +
              • Using ':' inside ID's caused problems for some + XML parsers, I'm now using "__" instead. Also removed @ from appearing + in the output when anonymous compounds were used.
              • Fixed output bug that is caused by nesting paragraph commands inside autolists.
              • Doxygen no longer generates source files for input files that @@ -8731,7 +8731,7 @@ make sure you add the following:
              • Added support for namespace aliases.
              • Added RTF patch from Alexander Bartolich. Here is his description of the changes: - "The following patch of rtgen.cpp allows to read *complete* style + "The following patch of rtfgen.cpp allows to read *complete* style definitions from rtfstyle. This includes \sbasedon, \snext, \additive and actual style names. @@ -8758,7 +8758,7 @@ make sure you add the following: and a[2]->func().
              • \em %className did not remove the %
              • In some cases namespace members ended up multiple times in the - documentatation.
              • + documentation.
              • Fixed a bug in the auto list generation.
              • \latexonly inside brief description did not work properly.
              • "Referenced By" list did not include constructors with @@ -8785,7 +8785,7 @@ make sure you add the following: item indicating where the todo item was found. The todo list (and all todo items) can be disabled by setting GENERATE_TODOLIST to NO.
              • <pre> ... </pre> blocks now behave as in plain HTML instead of - \code ... \endcode blocks. This also works for LaTeX ofcourse. + \code ... \endcode blocks. This also works for LaTeX of course. These blocks differ from \verbatim ... \endverbatim blocks in that commands can be used inside these blocks.
              @@ -8824,7 +8824,7 @@ make sure you add the following:
              Credits go to Joerg Baumann.
            • Included French and Czech language updates from Mathieu Despriée and - Petr Prikryl. Also included a language update for german from + Petr Prikryl. Also included a language update for German from Raimund Klein.
            • Doxygen will now do give proper warnings for formulas that do not end properly.
            • @@ -8896,7 +8896,7 @@ make sure you add the following: graphicx package instead of epsfig to simplify the use of pdflatex (thanks to Pier Giorgio for showing me how that works).
            • Reimplemented the system() call for Unix, so doxygen becomes - interruptable when calling external tools such as dot.
            • + interruptible when calling external tools such as dot.
            • Changed the way -w works. It can now also be used to generate template header and footers.
            @@ -8932,7 +8932,7 @@ make sure you add the following: set the file patterns for the include files (if left empty the FILE_PATTERNS will be used, which was also the old behaviour). -
          • Added a couple of commands for kdoc compatability: @p, +
          • Added a couple of commands for kdoc compatibility: @p, @li, @em. Also made @ref a bit less strict.
          • Portuguese translation by Rui Lopes.
          • @@ -8964,12 +8964,12 @@ make sure you add the following:
          • Global functions within anonymous namespace scopes did appear in the documentation with the anonymous scope marker used internally by doxygen.
          • -
          • "namespace{}",so without space was not recognised as a namespace.
          • +
          • "namespace{}",so without space was not recognized as a namespace.
          • If the search engine was used then running installdox on the generated html resulted in bogus links to the search engine.
          • Fixed some compiler warning on Solaris.
          • Changed grey by grey50 in dot.cpp to avoid PDF conversion problems.
          • -
          • A </pre> that was not preceeded by a whitespace was ignored
          • +
          • A </pre> that was not preceded by a whitespace was ignored
          • The methods operator<() and operator<<() were not automatically linked anymore.
          • Some special characters in LaTeX were eating up the blanks that @@ -9041,7 +9041,7 @@ make sure you add the following: which files #include (i.e. depend on) a given file. This graph is enabled by setting HAVE_DOT and INCLUDED_BY_GRAPH to YES.
          • added new configuration option EXTRACT_STATIC that can be used - to enable/disable the extraction of static file members. The behaviour + to enable/disable the extraction of static file members. The behavior of this option used to be linked with EXTRACT_PRIVATE.
          • Added two new configuration options MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT that let the user configure how big the @@ -9100,7 +9100,7 @@ make sure you add the following:

          Bug fixes

            -
          • the warning message in case of ambigous file matches was containing +
          • the warning message in case of ambiguous file matches was containing a bogus %s, which could even crash doxygen.
          • An autolist followed by a \retval, \param, or \exception did produced invalid output, resulting in a compile error in LaTeX.
          • @@ -9113,7 +9113,7 @@ make sure you add the following:
          • The hierarchy shown in the "Contents" part of the html help browser did not properly show the hierarchy when it contained undocumented classes.
          • -
          • explict compound specifiers in the return type could lead to +
          • explicit compound specifiers in the return type could lead to parse problems. Example:
                    enum SomeEnumType_e Func()
            @@ -9128,8 +9128,8 @@ make sure you add the following:
                    and links to the correct reimplemented member are generated.
          • \ingroup did not work when grouping enums
          • members of a module were not cross-referenced with the sources.
          • -
          • Function pointers like void ( *func )() where not c - orrectly parsed because of the extra spacing between +
          • Function pointers like void ( *func )() where not + correctly parsed because of the extra spacing between the `(' and the `*'.
          • The const in void func(int * const val /*< a value. */); was named part of the name, instead of the type.
          • @@ -9389,7 +9389,7 @@ make sure you add the following: template <class T> class S<C<T> > : public SB<C<T> > {};
          • #includes in code fragments where not hyperlinked. Operator - methods were also not correctly recognised.
          • + methods were also not correctly recognized.
          • C/C++ comments inside initializers where not handled properly.
          • If the type of an argument of a member definition was prefixed with a (redudant) scope name of an indirect base class, @@ -9418,7 +9418,7 @@ make sure you add the following: case file names with space were used.
          • back-references from source-lines to documentation only worked for those members of a member group that were explicitly documented.
          • -
          • doxygen did not distriguish between func(int a) and func(int a[]) +
          • doxygen did not distinguish between func(int a) and func(int a[]) which could cause documentation to end up at the wrong member in case over overloading.
          @@ -9502,7 +9502,7 @@ make sure you add the following:
        • Since 1.1.2, environment variable expansion in the config file always resulted in a single string for each expanded variable (just as if quotes were put around the environment variable). - The old behaviour is restored again.
        • + The old behavior is restored again.
        • removed redundant spaces in the man page output and fixed the tab alignment in code fragments.
        • typedef ( bla::*proc)(); was not properly parsed because of the @@ -9524,7 +9524,7 @@ make sure you add the following: dot graphs. The cause was likely to be multiple frees of the same pointer (but I have not been able to reproduce the crash myself). I've now reimplemented the deletion routine of the dot graph - respresentation, which hopefully fixes this problem.
        • + representation, which hopefully fixes this problem.
        • Elements of the configuration options in lists, which used quotes were broken up into smaller pieces anyway. This most notably broke PREDEFINED in some cases that worked before.
        • @@ -9553,7 +9553,7 @@ make sure you add the following: of the LaTeX output (doxygen.sty a.o.) was not generated (Thanks to Markus Lepper for reporting this).
        • Doxygen can now match arguments containing an explicit namespace - qualifier against arguments containing an implicit qualitifier + qualifier against arguments containing an implicit qualifier (i.e. imported via a using directive). An example (thanks to Karl Stroetmann):
          @@ -9619,7 +9619,7 @@ make sure you add the following:
                  

          Usage: A group is defined by a //@{ .. //@} block (or /*@{*/../*@}*/ if - you're addited to C style comments :-) Nesting of groups is not + you're addicted to C style comments :-) Nesting of groups is not allowed. Before the opening marker of a block a separate comment block should be placed. This block should contain the @name (or \name) command to specify the header of the group. @@ -9757,7 +9757,7 @@ make sure you add the following:

        • Fixed a bug in structure of the graphical class hierarchy (thanks to Paul Bohme for pointing me at this bug)
        • Non-function members can now also be documented if they - are inside annonymous namespaces, which themselves are nested in + are inside anonymous namespaces, which themselves are nested in named namespaces.
        • #defines can now grouped with \defgroup and \ingroup as well.
        • fixed a bug in the latex output of groups (thanks to Gregory Kurz @@ -9929,7 +9929,7 @@ make sure you add the following: /*! let's go to the bar */ class foo::bar { };
        • -
        • Members inside annonymous namespaces nested inside named namespaces +
        • Members inside anonymous namespaces nested inside named namespaces were not properly handled.
        • When documenting template specializations with the \class command, the second argument was not interpreted correctly.
        • @@ -10089,7 +10089,7 @@ make sure you add the following:
        • Three new section commands \pre, \post and \invariant are added to describe - preconditions, postcondictions and invariants respectively.
        • + preconditions, postconditions and invariants respectively.
        • Variable/enum initializers and define definitions are now included in documentation (unless the initializer/definition is more than 30 lines long)
        • @@ -10113,7 +10113,7 @@ make sure you add the following:
        • Autolinks to #defines looked like function macro even if they weren't.
        • Members that were hidden deep in an inheritance tree, got multiple scope prefixes in the "all members list", while a scope prefix to - the member in the base class was enough to use it unambiguishly.
        • + the member in the base class was enough to use it unambiguously.
        • \latexonly ... \endlatexonly in the main page produced erroneous text in refman.tex
        • The keywords in header and footer were only evaluated once.
        • diff --git a/doc/htmlcmds.doc b/doc/htmlcmds.doc index 605bf5a..57ddf6f 100644 --- a/doc/htmlcmds.doc +++ b/doc/htmlcmds.doc @@ -304,7 +304,7 @@ The list of entities with their descriptions has been taken from (getResolvedClass(this,getFileDef(),typeConstraint)); @@ -3655,7 +3655,7 @@ void ClassDefImpl::mergeMembers() { MemberDef *srcMd = srcMi->memberDef; bool found=FALSE; - bool ambigue=FALSE; + bool ambiguous=FALSE; bool hidden=FALSE; MemberNameInfoIterator dstMnii(*dstMni); MemberInfo *dstMi; @@ -3694,7 +3694,7 @@ void ClassDefImpl::mergeMembers() QCString scope=dstMi->scopePath.left(dstMi->scopePath.find(sep)+sepLen); if (scope!=dstMi->ambiguityResolutionScope.left(scope.length())) dstMi->ambiguityResolutionScope.prepend(scope); - ambigue=TRUE; + ambiguous=TRUE; } } else // same members @@ -3723,12 +3723,12 @@ void ClassDefImpl::mergeMembers() { dstMi->ambiguityResolutionScope.prepend(scope); } - ambigue=TRUE; + ambiguous=TRUE; } } } - //printf("member %s::%s hidden %d ambigue %d srcMi->ambigClass=%p\n", - // srcCd->name().data(),srcMd->name().data(),hidden,ambigue,srcMi->ambigClass); + //printf("member %s::%s hidden %d ambiguous %d srcMi->ambigClass=%p\n", + // srcCd->name().data(),srcMd->name().data(),hidden,ambiguous,srcMi->ambigClass); // TODO: fix the case where a member is hidden by inheritance // of a member with the same name but with another prototype, @@ -3757,7 +3757,7 @@ void ClassDefImpl::mergeMembers() MemberInfo *newMi = new MemberInfo(srcMd,prot,virt,TRUE); newMi->scopePath=bClass->name()+sep+srcMi->scopePath; - if (ambigue) + if (ambiguous) { //printf("$$ New member %s %s add scope %s::\n", // srcMi->ambiguityResolutionScope.data(), @@ -4733,7 +4733,7 @@ int ClassDefImpl::countAdditionalInheritedMembers() const } } } - //printf("countAdditonalInheritedMembers()=%d\n",totalCount); + //printf("countAdditionalInheritedMembers()=%d\n",totalCount); return totalCount; } diff --git a/src/code.l b/src/code.l index 60d6c7e..c73911a 100644 --- a/src/code.l +++ b/src/code.l @@ -1147,7 +1147,7 @@ static bool generateClassMemberLink(CodeOutputInterface &ol,MemberDef *xmd,const if (xd && xd->isLinkable()) { - //printf("g_currentDefiniton=%p g_currentMemberDef=%p xmd=%p g_insideBody=%d\n",g_currentDefinition,g_currentMemberDef,xmd,g_insideBody); + //printf("g_currentDefinition=%p g_currentMemberDef=%p xmd=%p g_insideBody=%d\n",g_currentDefinition,g_currentMemberDef,xmd,g_insideBody); if (xmd->templateMaster()) xmd = xmd->templateMaster(); diff --git a/src/commentcnv.l b/src/commentcnv.l index f144aec..3e5faba 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -496,7 +496,7 @@ void replaceComment(int offset); g_lastCommentContext = YY_START; BEGIN(Verbatim); } -. { /* any ather character */ +. { /* any other character */ copyToOutput(yytext,(int)yyleng); } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}") { /* end of verbatim block */ diff --git a/src/commentscan.l b/src/commentscan.l index 6e7d373..a1ce096 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -1970,7 +1970,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$" BEGIN(Comment); } {B}* { - if (!g_spaceBeforeIf.isEmpty()) // needed for 665313 in combation with bug620924 + if (!g_spaceBeforeIf.isEmpty()) // needed for 665313 in combination with bug620924 { addOutput(g_spaceBeforeIf); } diff --git a/src/condparser.h b/src/condparser.h index 09a4f74..1ad13b1 100644 --- a/src/condparser.h +++ b/src/condparser.h @@ -13,7 +13,7 @@ * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * - * C++ Expression parser for EXTABLED_SETIONS in Doxygen + * C++ Expression parser for ENABLED_SECTIONS in Doxygen * * Features used: * Operators: diff --git a/src/context.cpp b/src/context.cpp index 361bfa2..e5f4597 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -1079,7 +1079,7 @@ class TranslateContext::Private s_inst.addProperty("fileMembers", &Private::fileMembers); //%% string fileMembersDescription s_inst.addProperty("fileMembersDescription", &Private::fileMembersDescription); - //%% string relatedPagesDescripiton + //%% string relatedPagesDescription s_inst.addProperty("relatedPagesDesc", &Private::relatedPagesDesc); //%% string more s_inst.addProperty("more", &Private::more); @@ -1133,7 +1133,7 @@ class TranslateContext::Private s_inst.addProperty("referencesRelation", &Private::referencesRelation); //%% markerstring inheritedFrom s_inst.addProperty("inheritedFrom", &Private::inheritedFrom); - //%% string addtionalInheritedMembers + //%% string additionalInheritedMembers s_inst.addProperty("additionalInheritedMembers",&Private::additionalInheritedMembers); //%% string includeDependencyGraph:container_name s_inst.addProperty("includeDependencyGraph",&Private::includeDependencyGraph); @@ -8432,7 +8432,7 @@ TemplateVariant NamespaceMembersIndexContext::get(const char *name) const //------------------------------------------------------------------------ -//%% struct InheritanceGraph: a connected graph reprenting part of the overall inheritance tree +//%% struct InheritanceGraph: a connected graph representing part of the overall inheritance tree //%% { class InheritanceGraphContext::Private { @@ -10297,7 +10297,7 @@ void generateOutputViaTemplate() ctx->set("classMembersIndex",classMembersIndex.get()); //%% NamespaceMembersIndex namespaceMembersIndex: ctx->set("namespaceMembersIndex",namespaceMembersIndex.get()); - //%% SearchIndicaes searchindicaes + //%% SearchIndices searchIndices ctx->set("searchIndices",searchIndices.get()); //%% string space ctx->set("space"," "); diff --git a/src/declinfo.l b/src/declinfo.l index 0ac1516..c27af39 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -290,7 +290,7 @@ void parseFuncDecl(const QCString &decl,const SrcLangExt lang,QCString &cl,QCStr // yyextra->type.data(),yyextra->scope.data(),yyextra->name.data(),yyextra->args.data()); int nb = yyextra->name.findRev('['); - if (nb!=-1 && yyextra->args.isEmpty()) // correct for [] in yyextra->name ambigity (due to Java return yyextra->type allowing []) + if (nb!=-1 && yyextra->args.isEmpty()) // correct for [] in yyextra->name ambiguity (due to Java return yyextra->type allowing []) { yyextra->args.prepend(yyextra->name.right(yyextra->name.length()-nb)); yyextra->name=yyextra->name.left(nb); diff --git a/src/definition.cpp b/src/definition.cpp index 5b2136c..a6e58ae 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1001,7 +1001,7 @@ bool readCodeFragment(const char *fileName, } result = transcodeCharacterStringToUTF8(result); if (!result.isEmpty() && result.at(result.length()-1)!='\n') result += "\n"; - //fprintf(stderr,"readCodeFragement(%d-%d)=%s\n",startLine,endLine,result.data()); + //printf("readCodeFragment(%d-%d)=%s\n",startLine,endLine,result.data()); return found; } diff --git a/src/diagram.cpp b/src/diagram.cpp index 2dadc12..edc895d 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -107,7 +107,7 @@ class DiagramRowIterator : public QListIterator : QListIterator(d) {} }; -/** Class represeting the tree layout for the built-in class diagram. */ +/** Class representing the tree layout for the built-in class diagram. */ class TreeDiagram : public QList { public: @@ -308,7 +308,7 @@ QCString DiagramItem::label() const QCString result; if (!templSpec.isEmpty()) { - // we use classDef->name() here and not diplayName() in order + // we use classDef->name() here and not displayName() in order // to get the name used in the inheritance relation. QCString n = classDef->name(); if (/*n.right(2)=="-g" ||*/ n.right(2)=="-p") diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 5db8b99..ba792e1 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -94,7 +94,7 @@ static int g_dirCount=0; DirDefImpl::DirDefImpl(const char *path) : DefinitionImpl(path,1,1,path) { bool fullPathNames = Config_getBool(FULL_PATH_NAMES); - // get display name (stipping the paths mentioned in STRIP_FROM_PATH) + // get display name (stripping the paths mentioned in STRIP_FROM_PATH) // get short name (last part of path) m_shortName = path; m_diskName = path; diff --git a/src/docparser.cpp b/src/docparser.cpp index a22087e..6d5e777 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -4562,7 +4562,7 @@ void DocSimpleSect::appendLinkWord(const QCString &word) { p = (DocPara *)m_children.getLast(); - // Comma-seperate links. + // Comma-separate links. p->injectToken(TK_WORD,","); p->injectToken(TK_WHITESPACE," "); } diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 22b14a0..f0a6a83 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -329,8 +329,8 @@ static int yyread(char *buf,int max_size) //-------------------------------------------------------------------------- //#define REAL_YY_DECL int doctokenizerYYlex (void) -//#define YY_DECL static int local_doctokinizer(void) -//#define LOCAL_YY_DECL local_doctokinizer() +//#define YY_DECL static int local_doctokenizer(void) +//#define LOCAL_YY_DECL local_doctokenizer() %} diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp index 98c7ca7..c70128c 100644 --- a/src/dotdirdeps.cpp +++ b/src/dotdirdeps.cpp @@ -140,8 +140,8 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations) for (udi.toFirst();(udir=udi.current());++udi) // foreach used dir { const DirDef *usedDir=udir->dir(); - if ((dir!=dd || !udir->inherited()) && // only show direct dependendies for this dir - (usedDir!=dd || !udir->inherited()) && // only show direct dependendies for this dir + if ((dir!=dd || !udir->inherited()) && // only show direct dependencies for this dir + (usedDir!=dd || !udir->inherited()) && // only show direct dependencies for this dir !usedDir->isParentOf(dir) && // don't point to own parent dirsInGraph.find(usedDir->getOutputFileBase())) // only point to nodes that are in the graph { diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index bbffaf0..9b7ddb7 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -117,7 +117,7 @@ QCString DotGraph::writeGraph( EmbeddedOutputFormat ef, // html, latex, ... const char* path, // output folder const char* fileName, // name of the code file (for code patcher) - const char* relPath, // output folder relativ to code file + const char* relPath, // output folder relative to code file bool generateImageMap, // in case of bitmap, shall there be code generated? int graphId) // number of this graph in the current code, used in svg code { diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 4f4d13b..a68c339 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1317,7 +1317,7 @@ static void addClassToContext(const Entry *root) //printf("ClassDict.insert(%s)\n",fullName.data()); Doxygen::classSDict->append(fullName,cd); - if (cd->isGeneric()) // generics are also stored in a separate dictionary for fast lookup of instantions + if (cd->isGeneric()) // generics are also stored in a separate dictionary for fast lookup of instances { //printf("inserting generic '%s' cd=%p\n",fullName.data(),cd); Doxygen::genericsDict->insert(fullName,cd); @@ -6540,7 +6540,7 @@ static void findMember(const Entry *root, // first note that we pass: // (root->tArgLists ? root->tArgLists->last() : 0) - // for the template arguments fo the new "member." + // for the template arguments for the new "member." // this accurately reflects the template arguments of // the related function, which don't have to do with // those of the related class. @@ -9497,7 +9497,7 @@ static void parseFiles(const std::unique_ptr &root) } } } - else // normal pocessing + else // normal processing #endif { StringListIterator it(g_inputFiles); @@ -9588,7 +9588,7 @@ static QDict g_pathsVisited(1009); //---------------------------------------------------------------------------- // Read all files matching at least one pattern in 'patList' in the // directory represented by 'fi'. -// The directory is read iff the recusiveFlag is set. +// The directory is read iff the recursiveFlag is set. // The contents of all files is append to the input string int readDir(QFileInfo *fi, @@ -11924,7 +11924,7 @@ void generateOutput() cleanUpDoxygen(); - finializeSearchIndexer(); + finalizeSearchIndexer(); // Doxygen::symbolStorage->close(); QDir thisDir; thisDir.remove(Doxygen::objDBFileName); diff --git a/src/filedef.cpp b/src/filedef.cpp index f358dba..f00c82b 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -735,7 +735,7 @@ void FileDefImpl::writeClassDeclarations(OutputList &ol,const QCString &title,Cl void FileDefImpl::writeInlineClasses(OutputList &ol) { - // temporarily undo the disbling could be done by startMemberDocumentation() + // temporarily undo the disabling could be done by startMemberDocumentation() // as a result of setting SEPARATE_MEMBER_PAGES to YES; see bug730512 bool isEnabled = ol.isEnabled(OutputGenerator::Html); ol.enable(OutputGenerator::Html); diff --git a/src/fortrancode.l b/src/fortrancode.l index 303bbfb..72feb3d 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -17,7 +17,7 @@ */ /** - @todo - continutation lines not always recognized + @todo - continuation lines not always recognized - merging of use-statements with same module name and different only-names - rename part of use-statement - links to interface functions diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 161deae..a053910 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -141,7 +141,7 @@ static const char * inputString; static int inputPosition; static bool isFixedForm; static QCString inputStringPrepass; ///< Input string for prepass of line cont. '&' -static QCString inputStringSemi; ///< Input string after command separetor ';' +static QCString inputStringSemi; ///< Input string after command separator ';' static unsigned int inputPositionPrepass; static int lineCountPrepass = 0; @@ -1841,7 +1841,7 @@ static QCString extractFromParens(const QCString name) return extracted; } -/*! remove unuseful spaces from bind statement */ +/*! remove useless spaces from bind statement */ static QCString extractBind(const QCString name) { QCString parensPart = extractFromParens(name); @@ -2540,7 +2540,7 @@ static void subrHandleCommentBlock(const QCString &doc,bool brief) // strip direction loc_doc = loc_doc.right(loc_doc.length()-strlen(directionParam[SymbolModifiers::IN])); loc_doc.stripWhiteSpace(); - // in case of empty documentation or (now) just name, consider it as no documemntation + // in case of empty documentation or (now) just name, consider it as no documentation if (!loc_doc.isEmpty() && (loc_doc.lower() != argName.lower())) { handleCommentBlock(QCString("\n\n@param ") + directionParam[SymbolModifiers::IN] + " " + diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index 20cb6ca..c514102 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -93,7 +93,7 @@ HtmlHelpIndex::~HtmlHelpIndex() } /*! Stores an item in the index if it is not already present. - * Items are stored in alphetical order, by sorting on the + * Items are stored in alphabetical order, by sorting on the * concatenation of \a level1 and \a level2 (if present). * * \param level1 the string at level 1 in the index. diff --git a/src/languages.py b/src/languages.py index 5bb65cf..ea3f348 100755 --- a/src/languages.py +++ b/src/languages.py @@ -74,7 +74,7 @@ for f in new_list: tmp = tmp.replace("\n","") l = re.sub('[^"]*"([^"]*)".*','\\1',tmp) l1 = l.replace("-","") - # capatalize first letter + # capitalize first letter l = l.title() print("""\ "; diff --git a/src/markdown.cpp b/src/markdown.cpp index d1a6a63..f6720ea 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2021,7 +2021,7 @@ static int writeBlockQuote(GrowBuf &out,const char *data,int size) out.addStr("
          \n"); } } - else if (level add end markers + else if (level add end markers { for (l=level;l\" { *pCopySquareGString+=*yytext; pCopyQuotedGString=pCopySquareGString; diff --git a/src/searchindex.cpp b/src/searchindex.cpp index b21d587..06c5c75 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -1372,7 +1372,7 @@ void initSearchIndexer() } } -void finializeSearchIndexer() +void finalizeSearchIndexer() { delete Doxygen::searchIndex; } diff --git a/src/searchindex.h b/src/searchindex.h index 9a612ad..8cbe352 100644 --- a/src/searchindex.h +++ b/src/searchindex.h @@ -34,7 +34,7 @@ class MemberDef; /*! Initialize the search indexer */ void initSearchIndexer(); /*! Cleanup the search indexer */ -void finializeSearchIndexer(); +void finalizeSearchIndexer(); //------- server side search index ---------------------- diff --git a/src/sortdict.h b/src/sortdict.h index 0e0b5c1..203ae5e 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -244,7 +244,7 @@ class SDict return m_list->find(item); } - /*! Equavalent to find(). */ + /*! Equivalent to find(). */ T *operator[](const char *key) const { return m_dict->find(key); @@ -553,7 +553,7 @@ class SIntDict return m_dict->find(key); } - /*! Equavalent to find(). */ + /*! Equivalent to find(). */ T *operator[](int key) const { return m_dict->find(key); diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index dc0cc85..4192c28 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -1099,7 +1099,7 @@ static void insertMemberFunctionParams(int memberdef_id, const MemberDef *md, co static void insertMemberDefineParams(int memberdef_id,const MemberDef *md, const Definition *def) { if (md->argumentList().empty()) // special case for "foo()" to - // disguish it from "foo". + // distinguish it from "foo". { DBG_CTX(("no params\n")); } diff --git a/src/template.cpp b/src/template.cpp index 228da4d..173df74 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -4693,7 +4693,7 @@ void TemplateLexer::tokenize(QList &tokens) { state=StateBeginTemplate; } - else if (c!=' ' && c!='\t' && c!='\n') // non-whitepace text + else if (c!=' ' && c!='\t' && c!='\n') // non-whitespace text { emptyOutputLine=FALSE; } diff --git a/src/util.cpp b/src/util.cpp index 8e0884f..23ce18e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -955,7 +955,7 @@ class AccessStack */ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Definition *item) { - //printf("name().data(),item->name().data(),item->getOuterScope()->name().data()); static AccessStack accessStack; diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index 18985ff..1d9397b 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -194,7 +194,6 @@ class VhdlDocGen static void correctMemberProperties(MemberDef *md); static void writeSource(const MemberDef *mdef,OutputList& ol,const QCString & cname); - static void writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString &); static QCString parseForConfig(QCString & entity,QCString & arch); static QCString parseForBinding(QCString & entity,QCString & arch); diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index 39981a0..d6e3ac3 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -347,7 +347,7 @@ void VhdlParser::addCompInst(const char *n, const char* instName, const char* co current->write=genLabels.right(genLabels.length()-u); current->read=genLabels.left(u); } - //printf (" \n genlable: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine); + //printf (" \n genlabel: [%s] inst: [%s] name: [%s] %d\n",n,instName,comp,iLine); if (lastCompound) { diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index dfbf630..8532ac3 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -430,7 +430,7 @@ void writeXMLCodeBlock(FTextStream &t,FileDef *fd) fd, // fileDef -1, // startLine -1, // endLine - FALSE, // inlineFragement + FALSE, // inlineFragment 0, // memberDef TRUE // showLineNumbers ); @@ -900,7 +900,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream md->argsString()) // define { if (md->argumentList().empty()) // special case for "foo()" to - // disguish it from "foo". + // distinguish it from "foo". { t << " " << endl; } -- cgit v0.12 From c7716a291ca04369292d57e0a472bd2f350d1bf1 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 5 Nov 2019 15:29:14 +0100 Subject: Spelling corrections for addon directory Spelling corrections as in #561. The Doxyfiles have been regenerated to conform the current status (a.o. no obsolete tags) --- addon/doxmlparser/Doxyfile | 309 +++++++++++++++++++++++++--------- addon/doxmlparser/Doxyfile.impl | 307 ++++++++++++++++++++++++--------- addon/doxmlparser/include/doxmlintf.h | 2 +- addon/doxmlparser/test/main.cpp | 2 +- 4 files changed, 468 insertions(+), 152 deletions(-) diff --git a/addon/doxmlparser/Doxyfile b/addon/doxmlparser/Doxyfile index e95ee76..2cef6cf 100644 --- a/addon/doxmlparser/Doxyfile +++ b/addon/doxmlparser/Doxyfile @@ -1,176 +1,335 @@ -# Doxyfile 1.2.12-20011209 +# Doxyfile 1.8.17 #--------------------------------------------------------------------------- -# General configuration options +# Project related configuration options #--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = doxmlparser -PROJECT_NUMBER = +PROJECT_NUMBER = +PROJECT_BRIEF = +PROJECT_LOGO = OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English +OUTPUT_TEXT_DIRECTION = None +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +JAVADOC_BANNER = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +TCL_SUBST = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_SLICE = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 5 +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_PRIVATE = YES +EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PACKAGE = NO EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -STRIP_CODE_COMMENTS = YES CASE_SENSE_NAMES = YES -SHORT_NAMES = NO HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = YES +HIDE_COMPOUND_REFERENCE= NO SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO INLINE_INFO = YES SORT_MEMBER_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = NO SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = #--------------------------------------------------------------------------- -# configuration options related to warning and progress messages +# Configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES -WARN_FORMAT = -WARN_LOGFILE = +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO +WARN_FORMAT = +WARN_LOGFILE = #--------------------------------------------------------------------------- -# configuration options related to the input files +# Configuration options related to the input files #--------------------------------------------------------------------------- INPUT = include +INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.h RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- -# configuration options related to source browsing +# Configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index +# Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- -# configuration options related to the HTML output +# Configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES -HTML_OUTPUT = -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES +HTML_OUTPUT = +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = GENERATE_CHI = NO +CHM_INDEX_ENCODING = BINARY_TOC = NO TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO +ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = NO +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- -# configuration options related to the LaTeX output +# Configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO -LATEX_OUTPUT = +LATEX_OUTPUT = +LATEX_CMD_NAME = +MAKEINDEX_CMD_NAME = makeindex +LATEX_MAKEINDEX_CMD = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = #--------------------------------------------------------------------------- -# configuration options related to the RTF output +# Configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO -RTF_OUTPUT = +RTF_OUTPUT = COMPACT_RTF = NO RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO #--------------------------------------------------------------------------- -# configuration options related to the man page output +# Configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = +MAN_OUTPUT = +MAN_EXTENSION = +MAN_SUBDIR = MAN_LINKS = NO #--------------------------------------------------------------------------- -# configuration options related to the XML output +# Configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = YES +XML_OUTPUT = xml +XML_PROGRAMLISTING = YES +XML_NS_MEMB_FILE_SCOPE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output +# Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- -# Configuration::addtions related to external references +# Configuration options related to external references #--------------------------------------------------------------------------- TAGFILES = ../../qtools_docs/qtools.tag=../../../../qtools_docs/html -GENERATE_TAGFILE = +GENERATE_TAGFILE = ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO +DIA_PATH = +HIDE_UNDOC_RELATIONS = YES HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = CLASS_GRAPH = YES COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 TEMPLATE_RELATIONS = YES -HIDE_UNDOC_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1280 -MAX_DOT_GRAPH_HEIGHT = 1024 +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_PATH = +DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/addon/doxmlparser/Doxyfile.impl b/addon/doxmlparser/Doxyfile.impl index 88818ab..5bddcc4 100644 --- a/addon/doxmlparser/Doxyfile.impl +++ b/addon/doxmlparser/Doxyfile.impl @@ -1,178 +1,335 @@ -# Doxyfile 1.2.13.1 +# Doxyfile 1.8.17 #--------------------------------------------------------------------------- -# General configuration options +# Project related configuration options #--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = doxmlparser -PROJECT_NUMBER = +PROJECT_NUMBER = +PROJECT_BRIEF = +PROJECT_LOGO = OUTPUT_DIRECTORY = doc_impl +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English +OUTPUT_TEXT_DIRECTION = None +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +JAVADOC_BANNER = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +TCL_SUBST = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +OPTIMIZE_OUTPUT_SLICE = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 5 +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_PRIVATE = YES +EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PACKAGE = NO EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -STRIP_CODE_COMMENTS = YES CASE_SENSE_NAMES = YES -SHORT_NAMES = NO HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = YES +HIDE_COMPOUND_REFERENCE= NO SHOW_INCLUDE_FILES = YES -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO INLINE_INFO = YES SORT_MEMBER_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = NO SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = #--------------------------------------------------------------------------- -# configuration options related to warning and progress messages +# Configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES -WARN_FORMAT = -WARN_LOGFILE = +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO +WARN_FORMAT = +WARN_LOGFILE = #--------------------------------------------------------------------------- -# configuration options related to the input files +# Configuration options related to the input files #--------------------------------------------------------------------------- INPUT = src -FILE_PATTERNS = +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = RECURSIVE = NO -EXCLUDE = +EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- -# configuration options related to source browsing +# Configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index +# Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- -# configuration options related to the HTML output +# Configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES -HTML_OUTPUT = -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES +HTML_OUTPUT = +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = GENERATE_CHI = NO +CHM_INDEX_ENCODING = BINARY_TOC = NO TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO +ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = NO +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- -# configuration options related to the LaTeX output +# Configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO -LATEX_OUTPUT = +LATEX_OUTPUT = +LATEX_CMD_NAME = +MAKEINDEX_CMD_NAME = makeindex +LATEX_MAKEINDEX_CMD = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = +EXTRA_PACKAGES = +LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO +LATEX_EMOJI_DIRECTORY = #--------------------------------------------------------------------------- -# configuration options related to the RTF output +# Configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO -RTF_OUTPUT = +RTF_OUTPUT = COMPACT_RTF = NO RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO #--------------------------------------------------------------------------- -# configuration options related to the man page output +# Configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = +MAN_OUTPUT = +MAN_EXTENSION = +MAN_SUBDIR = MAN_LINKS = NO #--------------------------------------------------------------------------- -# configuration options related to the XML output +# Configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = YES +XML_OUTPUT = xml +XML_PROGRAMLISTING = YES +XML_NS_MEMB_FILE_SCOPE = NO +#--------------------------------------------------------------------------- +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output +# Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- -# Configuration options related to the preprocessor +# Configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = EXPAND_AS_DEFINED = DEFINE_CLS_IMPL SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- -# Configuration::addtions related to external references +# Configuration options related to external references #--------------------------------------------------------------------------- TAGFILES = ../../qtools_docs/qtools.tag=../../../../qtools_docs/html -GENERATE_TAGFILE = +GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO +DIA_PATH = +HIDE_UNDOC_RELATIONS = YES HAVE_DOT = YES +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = CLASS_GRAPH = YES COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 TEMPLATE_RELATIONS = YES -HIDE_UNDOC_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1280 -MAX_DOT_GRAPH_HEIGHT = 1024 +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_PATH = +DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/addon/doxmlparser/include/doxmlintf.h b/addon/doxmlparser/include/doxmlintf.h index 22cecdb..cb4a9eb 100644 --- a/addon/doxmlparser/include/doxmlintf.h +++ b/addon/doxmlparser/include/doxmlintf.h @@ -1114,7 +1114,7 @@ class IDoxygen virtual ICompoundIterator *memberByName(const char * name) const = 0; /*! Releases the memory for the object hierarchy obtained by - * createdObjecModelFromXML(). First release all iterators before calling + * createdObjectModel(). First release all iterators before calling * this function. */ virtual void release() = 0; diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp index 70c79da..0d1f95e 100644 --- a/addon/doxmlparser/test/main.cpp +++ b/addon/doxmlparser/test/main.cpp @@ -707,7 +707,7 @@ int main(int argc,char **argv) printf("==== inheritance graph ==== \n"); DumpGraph(cls->inheritanceGraph()); - printf("==== collabration graph ==== \n"); + printf("==== collaboration graph ==== \n"); DumpGraph(cls->collaborationGraph()); printf("==== base classes ==== \n"); -- cgit v0.12 From 83b138afee3405c1b08b671efccba5b3ec1ec45c Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 5 Nov 2019 15:58:43 +0100 Subject: Spelling corrections for libmscgen directory Spelling corrections as found by codespell. The original package was written by UK-English writing person so left the words in UK-English (upon request this can be changed as well to US-English spelling). --- libmscgen/gd.h | 4 ++-- libmscgen/mscgen_adraw.h | 2 +- libmscgen/mscgen_adraw_int.h | 2 +- libmscgen/mscgen_api.c | 8 ++++---- libmscgen/mscgen_gd_out.c | 2 +- libmscgen/mscgen_lexer.l | 2 +- libmscgen/mscgen_msc.h | 4 ++-- libmscgen/mscgen_usage.c | 2 +- libmscgen/mscgen_utf8.c | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libmscgen/gd.h b/libmscgen/gd.h index d6bbebd..c1a5754 100644 --- a/libmscgen/gd.h +++ b/libmscgen/gd.h @@ -333,7 +333,7 @@ typedef double (* interpolation_method )(double); (Previous versions of this library encouraged directly manipulating - the contents ofthe struct but we are attempting to move away from + the contents of the struct but we are attempting to move away from this practice so the fields are no longer documented here. If you need to poke at the internals of this struct, feel free to look at *gd.h*.) @@ -1572,7 +1572,7 @@ BGD_DECLARE(int) gdTransformAffineBoundingBox(gdRectPtr src, const double affine * * Constants: * GD_CMP_IMAGE - Actual image IS different - * GD_CMP_NUM_COLORS - Number of colors in pallette differ + * GD_CMP_NUM_COLORS - Number of colors in palette differ * GD_CMP_COLOR - Image colors differ * GD_CMP_SIZE_X - Image width differs * GD_CMP_SIZE_Y - Image heights differ diff --git a/libmscgen/mscgen_adraw.h b/libmscgen/mscgen_adraw.h index b2e11a3..9ac1037 100644 --- a/libmscgen/mscgen_adraw.h +++ b/libmscgen/mscgen_adraw.h @@ -253,7 +253,7 @@ ADraw; * image functions to be executed. * * \param[in] w The width of the output image. - * \param[in] h The height of the ouput image. + * \param[in] h The height of the oupput image. * \param[in] file The file to which the image should be written. * \param[in] fontName The name of the font to use for rendering. * \param[in] type The output type to generate. diff --git a/libmscgen/mscgen_adraw_int.h b/libmscgen/mscgen_adraw_int.h index 6f79ca4..1912fe1 100644 --- a/libmscgen/mscgen_adraw_int.h +++ b/libmscgen/mscgen_adraw_int.h @@ -29,7 +29,7 @@ * Preprocessor Macros ***************************************************************************/ -/* Define macro to supress unused parameter warnings */ +/* Define macro to suppress unused parameter warnings */ #ifndef UNUSED # ifdef __GNUC__ # define UNUSED __attribute__((unused)) diff --git a/libmscgen/mscgen_api.c b/libmscgen/mscgen_api.c index 31f5556..c5a9eb3 100644 --- a/libmscgen/mscgen_api.c +++ b/libmscgen/mscgen_api.c @@ -662,7 +662,7 @@ static char *getLine(const char *string, * \param x The x position at which the entity text should be centered. * \param y The y position where the text should be placed. * \param entLabel The label to render, which maybe \a NULL in which case - * no ouput is produced. + * no output is produced. * \param entUrl The URL for rendering the label as a hyperlink. This * maybe \a NULL if not required. * \param entId The text identifier for the arc. @@ -704,7 +704,7 @@ static void entityText(Context *ctx, /* Check if a URL is associated */ if(entUrl) { - /* If no explict colour has been set, make URLS blue */ + /* If no explicit colour has been set, make URLS blue */ ctx->drw.setPen(&ctx->drw, ADRAW_COL_BLUE); /* Image map output */ @@ -1431,7 +1431,7 @@ static void arcLine(Context *ctx, */ static Boolean checkMsc(Msc m) { - /* Check all arc entites are known */ + /* Check all arc entities are known */ MscResetArcIterator(m); do { @@ -1710,7 +1710,7 @@ int mscgen_generate(const char *inputFile, assert(startCol != -1); assert(endCol != -1 || isBroadcastArc(MscGetCurrentArcDest(m))); - /* Check for entity colouring if not set explicity on the arc */ + /* Check for entity colouring if not set explicitly on the arc */ if (arcTextColour == NULL) { arcTextColour = MscGetEntAttrib(m, startCol, MSC_ATTR_ARC_TEXT_COLOUR); diff --git a/libmscgen/mscgen_gd_out.c b/libmscgen/mscgen_gd_out.c index 263431e..8d8198c 100644 --- a/libmscgen/mscgen_gd_out.c +++ b/libmscgen/mscgen_gd_out.c @@ -119,7 +119,7 @@ static int getGdoPen(struct ADrawTag *ctx) /** Given a colour value, convert to a gd colour reference. - * This searches the current pallette of colours for the passed colour and + * This searches the current palette of colours for the passed colour and * returns an existing reference if possible. Otherwise a new colour reference * is allocated and returned. */ diff --git a/libmscgen/mscgen_lexer.l b/libmscgen/mscgen_lexer.l index 8410e07..52f5e05 100644 --- a/libmscgen/mscgen_lexer.l +++ b/libmscgen/mscgen_lexer.l @@ -142,7 +142,7 @@ NOTE|note yylval.arctype = MSC_ARC_NOTE; return %% /* Handle a new line of input. - * This counts the line number and duplicates the string incase we need + * This counts the line number and duplicates the string in case we need * it for error reporting. The line is then returned back for parsing * without the newline characters prefixed. */ diff --git a/libmscgen/mscgen_msc.h b/libmscgen/mscgen_msc.h index 2c75131..bcbdf3a 100644 --- a/libmscgen/mscgen_msc.h +++ b/libmscgen/mscgen_msc.h @@ -217,7 +217,7 @@ int MscGetEntityIndex(struct MscTag *m, const char *label); * @{ */ -/** Reset the entity interator. +/** Reset the entity iterator. * This moves the pointer to the current entity to the head of the list. */ void MscResetEntityIterator(Msc m); @@ -249,7 +249,7 @@ const char *MscGetEntAttrib(Msc m, unsigned int entIdx, MscAttribType a); * @{ */ -/** Reset the arc interator. +/** Reset the arc iterator. * This moves the pointer to the current arc to the head of the list. */ void MscResetArcIterator (Msc m); diff --git a/libmscgen/mscgen_usage.c b/libmscgen/mscgen_usage.c index 2126d44..5d448f8 100644 --- a/libmscgen/mscgen_usage.c +++ b/libmscgen/mscgen_usage.c @@ -61,7 +61,7 @@ void Usage(void) " to write output directly to stdout.\n" #ifdef USE_FREETYPE " -F Use specified font for PNG output. This must be a font specifier\n" -" compatbile with fontconfig (see 'fc-list'), and overrides the\n" +" compatible with fontconfig (see 'fc-list'), and overrides the\n" " MSCGEN_FONT environment variable if also set.\n" #endif " -p Print parsed msc output (for parser debug).\n" diff --git a/libmscgen/mscgen_utf8.c b/libmscgen/mscgen_utf8.c index 9614c47..e23eef3 100644 --- a/libmscgen/mscgen_utf8.c +++ b/libmscgen/mscgen_utf8.c @@ -95,7 +95,7 @@ Boolean Utf8Decode(const char *s, unsigned int *r, unsigned int *bytes) } } - /* Success if no NULL was encoutered */ + /* Success if no NULL was encountered */ return t == *bytes; } } -- cgit v0.12 From 04df92f43f9a11c30c5855013dd285b168c621f5 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 5 Nov 2019 17:38:09 +0100 Subject: Spelling corrections for qtools directory Spelling corrections as found by codespell and in #561. Some reported problems were already fixed, others are fixed here. --- qtools/qcstring.h | 2 +- qtools/qdict.doc | 2 +- qtools/qglobal.h | 2 +- qtools/qlist.doc | 2 +- qtools/qstring.cpp | 2 +- qtools/qtextcodec.cpp | 2 +- qtools/qtl.doc | 2 +- qtools/qvaluelist.doc | 6 +++--- qtools/qxml.cpp | 14 +++++++------- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/qtools/qcstring.h b/qtools/qcstring.h index f484207..c2a5dc3 100644 --- a/qtools/qcstring.h +++ b/qtools/qcstring.h @@ -329,7 +329,7 @@ public: return m_rep.at(i); } - /** Indexing operator. Equavalent to at(). */ + /** Indexing operator. Equivalent to at(). */ char &operator[]( int i ) const { return m_rep.at((uint)i); diff --git a/qtools/qdict.doc b/qtools/qdict.doc index a414d3f..bf1ea01 100644 --- a/qtools/qdict.doc +++ b/qtools/qdict.doc @@ -175,7 +175,7 @@ Setting \e caseSensitive to TRUE will treat "abc" and "Abc" as different keys. Setting it to FALSE will make the dictionary ignore case. - Case insensitive comparison includes the whole Unicode alphabeth. + Case insensitive comparison includes the whole Unicode alphabet. */ /*! diff --git a/qtools/qglobal.h b/qtools/qglobal.h index 8512f41..56b2d40 100644 --- a/qtools/qglobal.h +++ b/qtools/qglobal.h @@ -175,7 +175,7 @@ // -// Should be sorted most-authorative to least-authorative +// Should be sorted most-authoritative to least-authoritative #if defined(__SC__) #define _CC_SYM_ diff --git a/qtools/qlist.doc b/qtools/qlist.doc index 59cc971..4f97e35 100644 --- a/qtools/qlist.doc +++ b/qtools/qlist.doc @@ -858,7 +858,7 @@ /*! \fn type *QListIterator::operator*() - Asterix operator. Returns a pointer to the current iterator item. + Asterisk operator. Returns a pointer to the current iterator item. Same as current(). */ diff --git a/qtools/qstring.cpp b/qtools/qstring.cpp index 0e2b14a..e809d0d 100644 --- a/qtools/qstring.cpp +++ b/qtools/qstring.cpp @@ -11538,7 +11538,7 @@ static inline bool format(QChar::Decomposition tag, QString & str, Applies possible ligatures to a QString, useful when composition-rich text requires rendering with glyph-poor fonts, but also makes compositions such as QChar(0x0041) ('A') and QChar(0x0308) - (Unicode accent diaresis) giving QChar(0x00c4) (German A Umlaut). + (Unicode accent diaeresis) giving QChar(0x00c4) (German A Umlaut). */ void QString::compose() { diff --git a/qtools/qtextcodec.cpp b/qtools/qtextcodec.cpp index 842a72d..8ce266d 100644 --- a/qtools/qtextcodec.cpp +++ b/qtools/qtextcodec.cpp @@ -280,7 +280,7 @@ int QTextCodec::heuristicNameMatch(const char* hint) const } -// returns a string cotnaining the letters and numbers from input, +// returns a string containing the letters and numbers from input, // with a space separating run of a character class. e.g. "iso8859-1" // becomes "iso 8859 1" static QString lettersAndNumbers( const char * input ) diff --git a/qtools/qtl.doc b/qtools/qtl.doc index e83b177..8ce89bd 100644 --- a/qtools/qtl.doc +++ b/qtools/qtl.doc @@ -38,7 +38,7 @@ \title Qt Template library -Thq Qt Template Library is a set of templates within Qt dealing with +The Qt Template Library is a set of templates within Qt dealing with containers of objects. It provides a list of objects, a stack of objects, a map (or dictionary) from one type to another, and associated iterators and algorithms. diff --git a/qtools/qvaluelist.doc b/qtools/qvaluelist.doc index f7a0dde..9f34c8e 100644 --- a/qtools/qvaluelist.doc +++ b/qtools/qvaluelist.doc @@ -615,12 +615,12 @@ /*! \fn T& QValueListIterator::operator*() - Asterix operator. Returns a reference to the current iterator item. + Asterisk operator. Returns a reference to the current iterator item. */ /*! \fn const T& QValueListIterator::operator*() const - Asterix operator. Returns a reference to the current iterator item. + Asterisk operator. Returns a reference to the current iterator item. */ /*! @@ -726,7 +726,7 @@ /*! \fn const T& QValueListConstIterator::operator*() const - Asterix operator. Returns a reference to the current iterator item. + Asterisk operator. Returns a reference to the current iterator item. */ /*! diff --git a/qtools/qxml.cpp b/qtools/qxml.cpp index 4138a28..f8a4e0d 100644 --- a/qtools/qxml.cpp +++ b/qtools/qxml.cpp @@ -778,7 +778,7 @@ void QXmlInputSource::setData( const QString& dat ) } /*! - Read the XML file from the byte array; try to recoginize the encoding. + Read the XML file from the byte array; try to recognize the encoding. */ // ### The input source should not do the encoding detection! void QXmlInputSource::readInput( QByteArray& rawData ) @@ -1895,7 +1895,7 @@ private: Quick start. */ -//guaranteed not to be a characater +//guaranteed not to be a character const QChar QXmlSimpleReader::QEOF = QChar((ushort)0xffff); /*! @@ -2609,7 +2609,7 @@ bool QXmlSimpleReader::parseElementAttribute( QString &prefix, QString &uri, QSt } } } else { - // no namespace delcaration + // no namespace declaration d->namespaceSupport.processName( name(), TRUE, uri, lname ); d->attList.qnameList.append( name() ); d->attList.uriList.append( uri ); @@ -3036,7 +3036,7 @@ parseError: Precondition: the beginning '<' of the PI is already read and the head stand on the '?' of ' Date: Tue, 5 Nov 2019 18:52:56 +0100 Subject: Simple nospam email address When having a simple nospam email address coded like: ``` /** \file * Big Unknown */ ``` this results in the warning: ``` aa.c:2: warning: Unsupported xml/html tag found ``` and in the HTML output it looks like: ``` Big Unknown ``` instead of: ``` Big Unknown ``` (Found in a couple of open source projects). --- src/doctokenizer.l | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 22b14a0..59a0a9d 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -345,6 +345,7 @@ CITESCHAR [a-z_A-Z0-9\x80-\xFF\-\?] CITEECHAR [a-z_A-Z0-9\x80-\xFF\-\+:\/\?] CITEID {CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)*|"\""{CITESCHAR}{CITEECHAR}*("."{CITESCHAR}{CITEECHAR}*)*"\"" MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z_A-Z0-9\-]+ +MAILADR2 {BLANK}*[a-z_A-Z0-9+-]+({BLANK}*[Dd][Oo][Tt]{BLANK}*[a-z_A-Z0-9+-]+)?{BLANK}*[Aa][Tt]{BLANK}*[a-z_A-Z0-9-]+({BLANK}*[Dd][Oo][Tt]{BLANK}*[a-z_A-Z0-9\-]+)+{BLANK}*[a-z_A-Z0-9\-]+{BLANK}* OPTSTARS ("//"{BLANK}*)?"*"*{BLANK}* LISTITEM {BLANK}*[-]("#")?{WS} MLISTITEM {BLANK}*[+*]{WS} @@ -655,6 +656,10 @@ REFWORD_NOCV {FILEMASK}|{LABELID}|{REFWORD2_NOCV}|{REFWORD3}|{REFWORD4_NOCV} g_token->isEMailAddr=TRUE; return TK_URL; } +"<"{MAILADR2}">" { // anti spame mail address + g_token->name=yytext; + return TK_WORD; + } "$"{ID}":"[^:\n$][^\n$]*"$" { /* RCS tag */ QCString tagName(yytext+1); int index=tagName.find(':'); -- cgit v0.12 From b32afdbd35624376000aaf12d09930e311692c53 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 5 Nov 2019 19:49:17 +0100 Subject: issue #7302: Determination of anonymous is too restrictive --- src/classdef.cpp | 27 +++----------- src/classdef.h | 1 - src/classlist.cpp | 6 +-- src/context.cpp | 15 ++++---- src/definition.cpp | 43 +++++++++++----------- src/definition.h | 5 +++ src/definitionimpl.h | 3 ++ src/doxygen.cpp | 16 ++++---- src/index.cpp | 6 +-- src/memberdef.cpp | 24 ++++++------ src/perlmodgen.cpp | 4 +- src/sqlite3gen.cpp | 8 ++-- src/tooltip.cpp | 5 +-- src/util.cpp | 2 +- src/xmlgen.cpp | 9 ++--- testing/071/namespace_a_namespace_1_1_0d0.xml | 8 ++-- ...xml__namespace__members__in__file__scope_8h.xml | 4 +- 17 files changed, 88 insertions(+), 98 deletions(-) diff --git a/src/classdef.cpp b/src/classdef.cpp index 7ce6bf1..9c2ab53 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -133,7 +133,6 @@ class ClassDefImpl : public DefinitionImpl, public ClassDef virtual MemberDef *isSmartPointer() const; virtual bool isJavaEnum() const; virtual bool isGeneric() const; - virtual bool isAnonymous() const; virtual const ClassSDict *innerClasses() const; virtual QCString title() const; virtual QCString generatedFromFiles() const; @@ -423,8 +422,6 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef { return getCdAlias()->isJavaEnum(); } virtual bool isGeneric() const { return getCdAlias()->isGeneric(); } - virtual bool isAnonymous() const - { return getCdAlias()->isAnonymous(); } virtual const ClassSDict *innerClasses() const { return getCdAlias()->innerClasses(); } virtual QCString title() const @@ -687,8 +684,6 @@ class ClassDefImpl::IMPL bool isGeneric; - bool isAnonymous; - uint64 spec; QCString metaData; @@ -751,7 +746,6 @@ void ClassDefImpl::IMPL::init(const char *defFileName, const char *name, isLocal=FALSE; } isGeneric = (lang==SrcLangExt_CSharp || lang==SrcLangExt_Java) && QCString(name).find('<')!=-1; - isAnonymous = QCString(name).find('@')!=-1; } ClassDefImpl::IMPL::IMPL() : vhdlSummaryTitles(17) @@ -835,6 +829,10 @@ QCString ClassDefImpl::displayName(bool includeScope) const n=className(); } } + if (isAnonymous()) + { + n = removeAnonymousScopes(n); + } QCString sep=getLanguageSpecificSeparator(lang); if (sep!="::") { @@ -849,14 +847,7 @@ QCString ClassDefImpl::displayName(bool includeScope) const // n = n.left(n.length()-2); //} //printf("ClassDefImpl::displayName()=%s\n",n.data()); - if (n.find('@')!=-1) - { - return removeAnonymousScopes(n); - } - else - { - return n; - } + return n; } // inserts a base/super class in the inheritance list @@ -3077,7 +3068,7 @@ void ClassDefImpl::writeMemberList(OutputList &ol) const //printf("%s: Member %s of class %s md->protection()=%d mi->prot=%d prot=%d inherited=%d\n", // name().data(),md->name().data(),cd->name().data(),md->protection(),mi->prot,prot,mi->inherited); - if (cd && !md->name().isEmpty() && md->name()[0]!='@') + if (cd && !md->name().isEmpty() && !md->isAnonymous()) { bool memberWritten=FALSE; if (cd->isLinkable() && md->isLinkable()) @@ -5299,7 +5290,6 @@ bool ClassDefImpl::isSliceLocal() const void ClassDefImpl::setName(const char *name) { - m_impl->isAnonymous = QCString(name).find('@')!=-1; DefinitionImpl::setName(name); } @@ -5308,11 +5298,6 @@ void ClassDefImpl::setMetaData(const char *md) m_impl->metaData = md; } -bool ClassDefImpl::isAnonymous() const -{ - return m_impl->isAnonymous; -} - QCString ClassDefImpl::collaborationGraphFileName() const { return m_impl->collabFileName; diff --git a/src/classdef.h b/src/classdef.h index c9cc806..3158c50 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -302,7 +302,6 @@ class ClassDef : virtual public Definition virtual bool isJavaEnum() const = 0; virtual bool isGeneric() const = 0; - virtual bool isAnonymous() const = 0; virtual const ClassSDict *innerClasses() const = 0; virtual QCString title() const = 0; diff --git a/src/classlist.cpp b/src/classlist.cpp index 6928c52..2b284b1 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -72,7 +72,7 @@ bool ClassSDict::declVisible(const ClassDef::CompoundType *filter) const ClassDef *cd=0; for (sdi.toFirst();(cd=sdi.current());++sdi) { - if (cd->name().find('@')==-1 && + if (!cd->isAnonymous() && (filter==0 || *filter==cd->compoundType()) ) { @@ -103,7 +103,7 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f for (sdi.toFirst();(cd=sdi.current());++sdi) { //printf(" ClassSDict::writeDeclaration for %s\n",cd->name().data()); - if (cd->name().find('@')==-1 && + if (!cd->isAnonymous() && !cd->isExtension() && (cd->protection()!=Private || extractPrivate) && (filter==0 || *filter==cd->compoundType()) @@ -137,7 +137,7 @@ void ClassSDict::writeDocumentation(OutputList &ol,const Definition * container) // cd->name().data(),cd->getOuterScope(),cd->isLinkableInProject(),cd->isEmbeddedInOuterScope(), // container,cd->partOfGroups() ? cd->partOfGroups()->count() : 0); - if (cd->name().find('@')==-1 && + if (!cd->isAnonymous() && cd->isLinkableInProject() && cd->isEmbeddedInOuterScope() && !cd->isAlias() && diff --git a/src/context.cpp b/src/context.cpp index 361bfa2..0dd81af 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -2353,7 +2353,7 @@ class ClassContext::Private : public DefinitionContext const ClassDef *cd; for (sdi.toFirst();(cd=sdi.current());++sdi) { - if (cd->name().find('@')==-1 && + if (!cd->isAnonymous() && cd->isLinkableInProject() && cd->isEmbeddedInOuterScope() && cd->partOfGroups()==0 @@ -2941,7 +2941,7 @@ class NamespaceContext::Private : public DefinitionContextname().find('@')==-1 && + if (!cd->isAnonymous() && cd->isLinkableInProject() && cd->isEmbeddedInOuterScope() && cd->partOfGroups()==0) @@ -3405,7 +3405,7 @@ class FileContext::Private : public DefinitionContext const ClassDef *cd; for (sdi.toFirst();(cd=sdi.current());++sdi) { - if (cd->name().find('@')==-1 && + if (!cd->isAnonymous() && cd->isLinkableInProject() && cd->isEmbeddedInOuterScope() && cd->partOfGroups()==0) @@ -4450,8 +4450,7 @@ class MemberContext::Private : public DefinitionContext } TemplateVariant isAnonymous() const { - QCString name = m_memberDef->name(); - return !name.isEmpty() && name.at(0)=='@'; + return m_memberDef->isAnonymous(); } TemplateVariant anonymousType() const { @@ -5725,7 +5724,7 @@ class ModuleContext::Private : public DefinitionContext const ClassDef *cd; for (sdi.toFirst();(cd=sdi.current());++sdi) { - if (cd->name().find('@')==-1 && + if (!cd->isAnonymous() && cd->isLinkableInProject() && cd->isEmbeddedInOuterScope() && cd->partOfGroups()==0) @@ -6543,7 +6542,7 @@ class NestingContext::Private : public GenericNodeListContext const NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { - if (nd->localName().find('@')==-1 && + if (!nd->isAnonymous() && (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) { bool hasChildren = namespaceHasVisibleChild(nd,addClasses,false,ClassDef::Class); @@ -8799,7 +8798,7 @@ class AllMembersListContext::Private : public GenericNodeListContext { MemberDef *md=mi->memberDef; const ClassDef *cd=md->getClassDef(); - if (cd && !md->name().isEmpty() && md->name()[0]!='@') + if (cd && !md->isAnonymous()) { if ((cd->isLinkable() && md->isLinkable()) || (!cd->isArtificial() && !hideUndocMembers && diff --git a/src/definition.cpp b/src/definition.cpp index 5b2136c..1a166fe 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -51,22 +51,21 @@ class DefinitionImpl::IMPL { public: - IMPL(); ~IMPL(); void init(const char *df, const char *n); void setDefFileName(const QCString &df); - SectionDict *sectionDict; // dictionary of all sections, not accessible + SectionDict *sectionDict = 0; // dictionary of all sections, not accessible - MemberSDict *sourceRefByDict; - MemberSDict *sourceRefsDict; + MemberSDict *sourceRefByDict = 0; + MemberSDict *sourceRefsDict = 0; std::vector xrefListItems; - GroupList *partOfGroups; + GroupList *partOfGroups = 0; - DocInfo *details; // not exported - DocInfo *inbodyDocs; // not exported - BriefInfo *brief; // not exported - BodyInfo *body; // not exported + DocInfo *details = 0; // not exported + DocInfo *inbodyDocs = 0; // not exported + BriefInfo *brief = 0; // not exported + BodyInfo *body = 0; // not exported QCString briefSignatures; QCString docSignatures; @@ -75,16 +74,17 @@ class DefinitionImpl::IMPL QCString qualifiedName; QCString ref; // reference to external documentation - bool hidden; - bool isArtificial; + bool hidden = FALSE; + bool isArtificial = FALSE; + bool isAnonymous = FALSE; - Definition *outerScope; // not owner + Definition *outerScope = 0; // not owner // where the item was defined QCString defFileName; QCString defFileExt; - SrcLangExt lang; + SrcLangExt lang = SrcLangExt_Unknown; QCString id; // clang unique id @@ -96,13 +96,6 @@ class DefinitionImpl::IMPL Cookie *cookie; }; -DefinitionImpl::IMPL::IMPL() - : sectionDict(0), sourceRefByDict(0), sourceRefsDict(0), - partOfGroups(0), - details(0), inbodyDocs(0), brief(0), body(0), hidden(FALSE), isArtificial(FALSE), - outerScope(0), lang(SrcLangExt_Unknown) -{ -} DefinitionImpl::IMPL::~IMPL() { @@ -304,7 +297,7 @@ DefinitionImpl::DefinitionImpl(const char *df,int dl,int dc, const char *d,bool isSymbol) { m_impl = new DefinitionImpl::IMPL; - m_impl->name = name; + setName(name); m_impl->defLine = dl; m_impl->defColumn = dc; m_impl->init(df,name); @@ -406,6 +399,9 @@ void DefinitionImpl::setName(const char *name) { if (name==0) return; m_impl->name = name; + m_impl->isAnonymous = m_impl->name.isEmpty() || + m_impl->name.at(0)=='@' || + m_impl->name.find("::@")!=-1; } void DefinitionImpl::setId(const char *id) @@ -2203,6 +2199,11 @@ QCString DefinitionImpl::name() const return m_impl->name; } +bool DefinitionImpl::isAnonymous() const +{ + return m_impl->isAnonymous; +} + int DefinitionImpl::getDefLine() const { return m_impl->defLine; diff --git a/src/definition.h b/src/definition.h index d458683..b3ece2c 100644 --- a/src/definition.h +++ b/src/definition.h @@ -112,6 +112,11 @@ class Definition : public DefinitionIntf /*! Returns the name of the definition */ virtual QCString name() const = 0; + /*! Returns TRUE iff this definition has an artificially generated name + * (typically starting with a @) that is used for nameless definitions + */ + virtual bool isAnonymous() const = 0; + /*! Returns the name of the definition as it appears in the output */ virtual QCString displayName(bool includeScope=TRUE) const = 0; diff --git a/src/definitionimpl.h b/src/definitionimpl.h index 036c875..2d8886d 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -32,6 +32,7 @@ class DefinitionImpl : virtual public Definition virtual bool isAlias() const { return FALSE; } virtual QCString name() const; + virtual bool isAnonymous() const; virtual QCString localName() const; virtual QCString qualifiedName() const; virtual QCString symbolName() const; @@ -142,6 +143,8 @@ class DefinitionAliasImpl : virtual public Definition virtual bool isAlias() const { return TRUE; } virtual QCString name() const { return m_def->name(); } + virtual bool isAnonymous() const + { return m_def->isAnonymous(); } virtual QCString localName() const { return m_def->localName(); } virtual QCString qualifiedName() const diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 4f4d13b..bf282b6 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1604,7 +1604,7 @@ static void processTagLessClasses(ClassDef *rootCd, if (type.find(icd->name())!=-1) // matching tag less struct/union { QCString name = md->name(); - if (name.at(0)=='@') name = "__unnamed__"; + if (md->isAnonymous()) name = "__unnamed__"; if (!prefix.isEmpty()) name.prepend(prefix+"."); //printf(" found %s for class %s\n",name.data(),cd->name().data()); ClassDef *ncd = createTagLessInstance(rootCd,icd,name); @@ -2461,7 +2461,7 @@ static MemberDef *addVariableToFile( QCString def; // determine the definition of the global variable - if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@' && + if (nd && !nd->isAnonymous() && !Config_getBool(HIDE_SCOPE_NAMES) ) // variable is inside a namespace, so put the scope before the name @@ -2616,7 +2616,7 @@ static MemberDef *addVariableToFile( addMemberToGroups(root,md); md->setRefItems(root->sli); - if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') + if (nd && !nd->isAnonymous()) { md->setNamespace(nd); nd->insertMember(md); @@ -7027,7 +7027,7 @@ static void findEnums(const Entry *root) mnsd=Doxygen::memberNameSDict; isGlobal=FALSE; } - else if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') // found enum inside namespace + else if (nd) // found enum inside namespace { mnsd=Doxygen::functionNameSDict; isGlobal=TRUE; @@ -7076,7 +7076,7 @@ static void findEnums(const Entry *root) baseType.prepend(" : "); } - if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') + if (nd) { if (isRelated || Config_getBool(HIDE_SCOPE_NAMES)) { @@ -7095,7 +7095,7 @@ static void findEnums(const Entry *root) // even if we have already added the enum to a namespace, we still // also want to add it to other appropriate places such as file // or class. - if (isGlobal) + if (isGlobal && (nd==0 || !nd->isAnonymous())) { if (!defSet) md->setDefinition(name+baseType); if (fd==0 && root->parent()) @@ -7204,7 +7204,7 @@ static void addEnumValuesToEnums(const Entry *root) mnsd=Doxygen::memberNameSDict; isGlobal=FALSE; } - else if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') // found enum inside namespace + else if (nd && !nd->isAnonymous()) // found enum inside namespace { //printf("Enum in namespace '%s'::'%s'\n",nd->name().data(),name.data()); mnsd=Doxygen::functionNameSDict; @@ -7312,7 +7312,7 @@ static void addEnumValuesToEnums(const Entry *root) { //printf("found enum value with same name %s in scope %s\n", // fmd->name().data(),fmd->getOuterScope()->name().data()); - if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') + if (nd && !nd->isAnonymous()) { const NamespaceDef *fnd=fmd->getNamespaceDef(); if (fnd==nd) // enum value is inside a namespace diff --git a/src/index.cpp b/src/index.cpp index 1acd941..edc302b 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -368,7 +368,7 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, { const MemberList *enumList = md->enumFieldList(); bool isDir = enumList!=0 && md->isEnumerate(); - bool isAnonymous = md->name().find('@')!=-1; + bool isAnonymous = md->isAnonymous(); static bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); static bool extractStatic = Config_getBool(EXTRACT_STATIC); if (!isAnonymous && @@ -1660,7 +1660,7 @@ static void writeNamespaceTree(const NamespaceSDict *nsDict,FTVHelp *ftv, const NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { - if (nd->localName().find('@')==-1 && + if (!nd->isAnonymous() && (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) { @@ -4060,7 +4060,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* { const MemberList *enumList = md->enumFieldList(); bool isDir = enumList!=0 && md->isEnumerate(); - if (md->isVisible() && md->name().find('@')==-1) + if (md->isVisible() && !md->isAnonymous()) { Doxygen::indexList->addContentsItem(isDir, md->name(),md->getReference(), diff --git a/src/memberdef.cpp b/src/memberdef.cpp index b79bd50..9b6967b 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -1771,7 +1771,7 @@ QCString MemberDefImpl::getOutputFileBase() const return baseName; } } - else if (nspace && nspace->isLinkableInProject()) + else if (nspace) { baseName=nspace->getOutputFileBase(); } @@ -1877,7 +1877,7 @@ void MemberDefImpl::_computeLinkableInProject() m_isLinkableCached = templateMaster()->isLinkableInProject() ? 2 : 1; return; } - if (name().isEmpty() || name().at(0)=='@') + if (isAnonymous()) { //printf("name invalid\n"); m_isLinkableCached = 1; // not a valid or a dummy name @@ -2257,10 +2257,10 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, ol.startMemberDeclaration(); // start a new member declaration - bool isAnonymous = annoClassDef || m_impl->annMemb || m_impl->annEnumType; + bool isAnonType = annoClassDef || m_impl->annMemb || m_impl->annEnumType; ///printf("startMemberItem for %s\n",name().data()); ol.startMemberItem(anchor(), - isAnonymous ? 1 : !m_impl->tArgList.empty() ? 3 : 0, + isAnonType ? 1 : !m_impl->tArgList.empty() ? 3 : 0, inheritId ); @@ -2301,9 +2301,9 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, // *** write template lists if (m_impl->tArgList.hasParameters() && getLanguage()==SrcLangExt_Cpp) { - if (!isAnonymous) ol.startMemberTemplateParams(); + if (!isAnonType) ol.startMemberTemplateParams(); writeTemplatePrefix(ol,m_impl->tArgList); - if (!isAnonymous) ol.endMemberTemplateParams(anchor(),inheritId); + if (!isAnonType) ol.endMemberTemplateParams(anchor(),inheritId); } // *** write type @@ -2343,7 +2343,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, QCString varName=ltype.right(ltype.length()-ir).stripWhiteSpace(); //printf(">>>>>> ltype='%s' varName='%s'\n",ltype.data(),varName.data()); ol.docify("}"); - if (varName.isEmpty() && (name().isEmpty() || name().at(0)=='@')) + if (varName.isEmpty() && isAnonymous()) { ol.docify(";"); } @@ -2425,13 +2425,13 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, } // *** write name - if (!name().isEmpty() && name().at(0)!='@') // hide anonymous stuff + if (!isAnonymous()) // hide anonymous stuff { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); static bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); static bool extractStatic = Config_getBool(EXTRACT_STATIC); //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d hasDocumentation=%d\n",name().data(),gd,getGroupDef(),inGroup,isLinkable(),hasDocumentation()); - if (!(name().isEmpty() || name().at(0)=='@') && // name valid + if (!name().isEmpty() && // name valid (hasDocumentation() || isReference()) && // has docs !(m_impl->prot==Private && !extractPrivate && (m_impl->virt==Normal || !extractPrivateVirtual) && m_impl->mtype!=MemberType_Friend) && // hidden due to protection !(isStatic() && getClassDef()==0 && !extractStatic) // hidden due to static-ness @@ -2479,7 +2479,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, } // add to index - if (isEnumerate() && name().at(0)=='@') + if (isEnumerate() && isAnonymous()) { // don't add to index } @@ -3202,7 +3202,7 @@ QCString MemberDefImpl::displayDefinition() const QCString title = name(); if (isEnumerate()) { - if (title.at(0)=='@') + if (isAnonymous()) { ldef = title = "anonymous enum"; if (!m_impl->enumBaseType.isEmpty()) @@ -3221,7 +3221,7 @@ QCString MemberDefImpl::displayDefinition() const } else if (isEnumValue()) { - if (ldef.at(0)=='@') + if (isAnonymous()) { ldef=ldef.mid(2); } diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index c8f9273..be226b7 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -1792,9 +1792,9 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) // + standard member sections // + detailed member documentation // - examples using the class - + if (cd->isReference()) return; // skip external references. - if (cd->name().find('@')!=-1) return; // skip anonymous compounds. + if (cd->isAnonymous()) return; // skip anonymous compounds. if (cd->templateMaster()!=0) return; // skip generated template instances. m_output.openHash() diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index dc0cc85..cb92788 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -1125,7 +1125,7 @@ static void associateMember(const MemberDef *md, struct Refid member_refid, stru // TODO: skip EnumValue only to guard against recording refids and member records // for enumvalues until we can support documenting them as entities. if (md->memberType()==MemberType_EnumValue) return; - if (md->name().at(0)!='@') // skip anonymous members + if (!md->isAnonymous()) // skip anonymous members { bindIntParameter(member_insert, ":scope_rowid", scope_refid.rowid); bindIntParameter(member_insert, ":memberdef_rowid", member_refid.rowid); @@ -1276,7 +1276,7 @@ static void writeInnerClasses(const ClassSDict *cl, struct Refid outer_refid) const ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) { - if (!cd->isHidden() && cd->name().find('@')==-1) // skip anonymous scopes + if (!cd->isHidden() && !cd->isAnonymous()) { struct Refid inner_refid = insertRefid(cd->getOutputFileBase()); @@ -1365,7 +1365,7 @@ static void writeInnerNamespaces(const NamespaceSDict *nl, struct Refid outer_re const NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { - if (!nd->isHidden() && nd->name().find('@')==-1) // skip anonymous scopes + if (!nd->isHidden() && !nd->isAnonymous()) { struct Refid inner_refid = insertRefid(nd->getOutputFileBase()); @@ -1954,7 +1954,7 @@ static void generateSqlite3ForClass(const ClassDef *cd) if (cd->isReference()) return; // skip external references. if (cd->isHidden()) return; // skip hidden classes. - if (cd->name().find('@')!=-1) return; // skip anonymous compounds. + if (cd->isAnonymous()) return; // skip anonymous compounds. if (cd->templateMaster()!=0) return; // skip generated template instances. struct Refid refid = insertRefid(cd->getOutputFileBase()); diff --git a/src/tooltip.cpp b/src/tooltip.cpp index a30a85c..8cc1f87 100644 --- a/src/tooltip.cpp +++ b/src/tooltip.cpp @@ -115,10 +115,9 @@ void TooltipManager::writeTooltips(CodeOutputInterface &ol) if (d->definitionType()==Definition::TypeMember) { MemberDef *md = dynamic_cast(d); - decl = md->declaration(); - if (!decl.isEmpty() && decl.at(0)=='@') // hide enum values + if (!md->isAnonymous()) { - decl.resize(0); + decl = md->declaration(); } } ol.writeTooltip(di.currentKey(), // id diff --git a/src/util.cpp b/src/util.cpp index 8e0884f..9cdf810 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8646,7 +8646,7 @@ bool namespaceHasVisibleChild(const NamespaceDef *nd,bool includeClasses,bool fi const NamespaceDef *cnd; for (cnli.toFirst();(cnd=cnli.current());++cnli) { - if (cnd->isLinkableInProject() && cnd->localName().find('@')==-1) + if (cnd->isLinkableInProject() && !cnd->isAnonymous()) { return TRUE; } diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index dfbf630..4950778 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -514,7 +514,6 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream // enum values are written as part of the enum if (md->memberType()==MemberType_EnumValue) return; if (md->isHidden()) return; - //if (md->name().at(0)=='@') return; // anonymous member // group members are only visible in their group //if (def->definitionType()!=Definition::TypeGroup && md->getGroupDef()) return; @@ -1090,7 +1089,7 @@ static void writeListOfAllMembers(const ClassDef *cd,FTextStream &t) for (mii.toFirst();(mi=mii.current());++mii) { const MemberDef *md=mi->memberDef; - if (md->name().at(0)!='@') // skip anonymous members + if (!md->isAnonymous()) { Protection prot = mi->prot; Specifier virt=md->virtualness(); @@ -1132,7 +1131,7 @@ static void writeInnerClasses(const ClassSDict *cl,FTextStream &t) const ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) { - if (!cd->isHidden() && cd->name().find('@')==-1) // skip anonymous scopes + if (!cd->isHidden() && !cd->isAnonymous()) { t << " isHidden() && nd->name().find('@')==-1) // skip anonymous scopes + if (!nd->isHidden() && !nd->isAnonymous()) { t << " getOutputFileBase() << "\">" << convertToXML(nd->name()) << "" << endl; @@ -1247,7 +1246,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) if (cd->isReference()) return; // skip external references. if (cd->isHidden()) return; // skip hidden classes. - if (cd->name().find('@')!=-1) return; // skip anonymous compounds. + if (cd->isAnonymous()) return; // skip anonymous compounds. if (cd->templateMaster()!=0) return; // skip generated template instances. if (cd->isArtificial()) return; // skip artificially created classes diff --git a/testing/071/namespace_a_namespace_1_1_0d0.xml b/testing/071/namespace_a_namespace_1_1_0d0.xml index 14f5a51..d439723 100644 --- a/testing/071/namespace_a_namespace_1_1_0d0.xml +++ b/testing/071/namespace_a_namespace_1_1_0d0.xml @@ -3,24 +3,24 @@ ANamespace::@0 - + Boolean - + False - + True - + FileNotFound diff --git a/testing/078/078__xml__namespace__members__in__file__scope_8h.xml b/testing/078/078__xml__namespace__members__in__file__scope_8h.xml index 1198549..078c5ad 100644 --- a/testing/078/078__xml__namespace__members__in__file__scope_8h.xml +++ b/testing/078/078__xml__namespace__members__in__file__scope_8h.xml @@ -4,7 +4,7 @@ 078_xml_namespace_members_in_file_scope.h Namespace - + Enum @@ -18,7 +18,7 @@ - + void void Namespace::foo () -- cgit v0.12 From 03fb8168b060f33fe6011604fb4b08549df36865 Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 6 Nov 2019 12:37:28 +0100 Subject: Better warning message in case of illegal command When having a problem like: ``` /** \file * * \link Something \see nothing2 \endlink * * \link Something @see nothing3 \endlink */ ``` We will get a.o. the warnings: ``` .../aa.h:3: warning: Illegal command see as part of a \link .../aa.h:5: warning: Illegal command see as part of a \link ``` it is not clear what the problem is. With this patch we get a little bit clearer warning: ``` .../aa.h:3: warning: Illegal command \see as part of a \link .../aa.h:5: warning: Illegal command @see as part of a \link ``` --- src/docparser.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index a22087e..568f7ed 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -803,14 +803,15 @@ static bool findDocsForMemberOrCompound(const char *commandName, inline void errorHandleDefaultToken(DocNode *parent,int tok, QList &children,const char *txt) { + char *cmd_start = "\\"; switch (tok) { case TK_COMMAND_AT: - // fall through + cmd_start = "@"; case TK_COMMAND_BS: children.append(new DocWord(parent,TK_COMMAND_CHAR(tok) + g_token->name)); warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a %s", - qPrint(TK_COMMAND_CHAR(tok) + g_token->name), txt); + qPrint(cmd_start + g_token->name),txt); break; case TK_SYMBOL: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found found as part of a %s", @@ -2312,6 +2313,7 @@ void DocSecRefList::parse() { if (tok==TK_COMMAND_AT || tok == TK_COMMAND_BS) { + char *cmd_start = (tok==TK_COMMAND_AT ? "@" : "\\"); switch (Mappers::cmdMapper->map(g_token->name)) { case CMD_SECREFITEM: @@ -2339,7 +2341,7 @@ void DocSecRefList::parse() goto endsecreflist; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\secreflist", - qPrint(g_token->name)); + qPrint(cmd_start + g_token->name)); goto endsecreflist; } } @@ -2646,9 +2648,11 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) { if (!defaultHandleToken(this,tok,m_children,FALSE)) { + char *cmd_start = "\\"; switch (tok) { case TK_COMMAND_AT: + cmd_start = "@"; // fall through case TK_COMMAND_BS: switch (Mappers::cmdMapper->map(g_token->name)) @@ -2661,7 +2665,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) goto endlink; default: warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\link", - qPrint(g_token->name)); + qPrint(cmd_start + g_token->name)); break; } break; @@ -3793,9 +3797,11 @@ int DocHtmlDescTitle::parse() { if (!defaultHandleToken(this,tok,m_children)) { + char *cmd_start = "\\"; switch (tok) { case TK_COMMAND_AT: + cmd_start = "@"; // fall through case TK_COMMAND_BS: { @@ -3866,8 +3872,8 @@ int DocHtmlDescTitle::parse() break; default: - warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command \\%s found as part of a
          tag", - qPrint(g_token->name)); + warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s found as part of a
          tag", + qPrint(cmd_start + g_token->name)); } } break; -- cgit v0.12 From fa2e951d698c99feac64f5a480142482781ef8b8 Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 6 Nov 2019 12:55:51 +0100 Subject: Better warning message in case of illegal command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correcting compilation errors and warnings like: ``` error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive] char *cmd_start = (tok==TK_COMMAND_AT ? "@" : "\\"); warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] char *cmd_start = "\\"; ``` --- src/docparser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index 568f7ed..ff21ce4 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -803,7 +803,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, inline void errorHandleDefaultToken(DocNode *parent,int tok, QList &children,const char *txt) { - char *cmd_start = "\\"; + const char *cmd_start = "\\"; switch (tok) { case TK_COMMAND_AT: @@ -2313,7 +2313,7 @@ void DocSecRefList::parse() { if (tok==TK_COMMAND_AT || tok == TK_COMMAND_BS) { - char *cmd_start = (tok==TK_COMMAND_AT ? "@" : "\\"); + const char *cmd_start = (tok==TK_COMMAND_AT ? "@" : "\\"); switch (Mappers::cmdMapper->map(g_token->name)) { case CMD_SECREFITEM: @@ -2648,7 +2648,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) { if (!defaultHandleToken(this,tok,m_children,FALSE)) { - char *cmd_start = "\\"; + const char *cmd_start = "\\"; switch (tok) { case TK_COMMAND_AT: @@ -3797,7 +3797,7 @@ int DocHtmlDescTitle::parse() { if (!defaultHandleToken(this,tok,m_children)) { - char *cmd_start = "\\"; + const char *cmd_start = "\\"; switch (tok) { case TK_COMMAND_AT: -- cgit v0.12 From 2001c933292d3dd25ebc6634dab62aab7389c5bc Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 6 Nov 2019 18:46:24 +0100 Subject: Output of unknown xml/html tag When having a problem like: ``` /** \file - Just name - name plus subname - name plus twice subname - name plus subname subname="" */ ``` we get correctly the warnings: ``` .../aa.h:3: warning: Unsupported xml/html tag found .../aa.h:4: warning: Unsupported xml/html tag found .../aa.h:5: warning: Unsupported xml/html tag found .../aa.h:6: warning: Unsupported xml/html tag found ``` but the output doesn't look good as there is `=""` added: ``` Just name name plus subname name plus twice subname name plus subname subname="" ``` This patch fixes this output. --- src/docparser.cpp | 2 +- src/doctokenizer.h | 1 + src/doctokenizer.l | 31 +++++++++++++++++++++---------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index a22087e..f3ccbf5 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -6286,7 +6286,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta break; case HTML_UNKNOWN: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported xml/html tag <%s> found", qPrint(tagName)); - m_children.append(new DocWord(this, "<"+tagName+tagHtmlAttribs.toString()+">")); + m_children.append(new DocWord(this, "<"+tagName+g_token->attribsStr+">")); break; case XML_INHERITDOC: handleInheritDoc(); diff --git a/src/doctokenizer.h b/src/doctokenizer.h index f89069c..e95c4c0 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -100,6 +100,7 @@ struct TokenInfo HtmlAttribList attribs; bool endTag; bool emptyTag; + QCString attribsStr; // whitespace QCString chars; diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 22b14a0..016b621 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -39,6 +39,7 @@ #include "doxygen.h" #include "portable.h" #include "cite.h" +#include "growbuf.h" #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 @@ -177,6 +178,10 @@ static void processSection() static void handleHtmlTag() { + static GrowBuf growBuf; + growBuf.clear(); + g_token->attribsStr=""; + QCString tagText=yytext; g_token->attribs.clear(); g_token->endTag = FALSE; @@ -207,54 +212,58 @@ static void handleHtmlTag() { char c=tagText.at(i); // skip spaces - while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); } + while (i<(int)yyleng && isspace((uchar)c)) { growBuf.addChar(c);c=tagText.at(++i); } // check for end of the tag if (c == '>') break; // Check for XML style "empty" tag. if (c == '/') { + growBuf.addChar(c); g_token->emptyTag = TRUE; break; } startName=i; // search for end of name - while (i<(int)yyleng && !isspace((uchar)c) && c!='=' && c!= '>') { c=tagText.at(++i); } + while (i<(int)yyleng && !isspace((uchar)c) && c!='=' && c!= '>') { growBuf.addChar(c);c=tagText.at(++i); } endName=i; HtmlAttrib opt; opt.name = tagText.mid(startName,endName-startName).lower(); // skip spaces - while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); } + while (i<(int)yyleng && isspace((uchar)c)) { growBuf.addChar(c);c=tagText.at(++i); } if (tagText.at(i)=='=') // option has value { + growBuf.addChar(c); c=tagText.at(++i); // skip spaces - while (i<(int)yyleng && isspace((uchar)c)) { c=tagText.at(++i); } + while (i<(int)yyleng && isspace((uchar)c)) { growBuf.addChar(c);c=tagText.at(++i); } if (tagText.at(i)=='\'') // option '...' { + growBuf.addChar(c); c=tagText.at(++i); startAttrib=i; // search for matching quote - while (i<(int)yyleng && c!='\'') { c=tagText.at(++i); } + while (i<(int)yyleng && c!='\'') { growBuf.addChar(c);c=tagText.at(++i); } endAttrib=i; - if (i<(int)yyleng) c=tagText.at(++i); + if (i<(int)yyleng) {growBuf.addChar(c);c=tagText.at(++i);} } else if (tagText.at(i)=='"') // option "..." { + growBuf.addChar(c); c=tagText.at(++i); startAttrib=i; // search for matching quote - while (i<(int)yyleng && c!='"') { c=tagText.at(++i); } + while (i<(int)yyleng && c!='"') { growBuf.addChar(c);c=tagText.at(++i); } endAttrib=i; - if (i<(int)yyleng) c=tagText.at(++i); + if (i<(int)yyleng) {growBuf.addChar(c);c=tagText.at(++i);} } else // value without any quotes { startAttrib=i; // search for separator or end symbol - while (i<(int)yyleng && !isspace((uchar)c) && c!='>') { c=tagText.at(++i); } + while (i<(int)yyleng && !isspace((uchar)c) && c!='>') { growBuf.addChar(c);c=tagText.at(++i); } endAttrib=i; - if (i<(int)yyleng) c=tagText.at(++i); + if (i<(int)yyleng) {growBuf.addChar(c);c=tagText.at(++i);} } opt.value = tagText.mid(startAttrib,endAttrib-startAttrib); if (opt.name == "align") opt.value = opt.value.lower(); @@ -271,6 +280,8 @@ static void handleHtmlTag() // opt.name.data(),opt.value.data()); g_token->attribs.append(&opt); } + growBuf.addChar(0); + g_token->attribsStr = growBuf.get(); } static QCString stripEmptyLines(const QCString &s) -- cgit v0.12 From aa33a2a657b70e61208c07d9861d0f721e8e68b2 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Wed, 6 Nov 2019 19:59:05 +0100 Subject: Update of generated VhdlParser files. --- vhdlparser/VhdlParserConstants.h | 2 +- vhdlparser/VhdlParserTokenManager.cc | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vhdlparser/VhdlParserConstants.h b/vhdlparser/VhdlParserConstants.h index b70ba42..fe51270 100644 --- a/vhdlparser/VhdlParserConstants.h +++ b/vhdlparser/VhdlParserConstants.h @@ -430,7 +430,7 @@ const int DEFAULT = 0; static const JJChar tokenImage_arr_20[] = {0x22, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_21[] = -{0x22, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x5f, 0x67, 0x75, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x65, 0x65, 0x22, 0}; +{0x22, 0x61, 0x73, 0x73, 0x75, 0x6d, 0x65, 0x5f, 0x67, 0x75, 0x61, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_22[] = {0x22, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x22, 0}; static const JJChar tokenImage_arr_23[] = diff --git a/vhdlparser/VhdlParserTokenManager.cc b/vhdlparser/VhdlParserTokenManager.cc index 29ce7cb..7187449 100644 --- a/vhdlparser/VhdlParserTokenManager.cc +++ b/vhdlparser/VhdlParserTokenManager.cc @@ -2491,25 +2491,25 @@ static const unsigned long long jjtoSkip[] = { switch(curChar) { case 65: - return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x8000000ULL); + return jjMoveStringLiteralDfa12_0(active0, 0x200000ULL, active1, 0x8000000ULL); case 69: if ((active0 & 0x20000ULL) != 0L) { jjmatchedKind = 17; jjmatchedPos = 11; } - return jjMoveStringLiteralDfa12_0(active0, 0x200000ULL, active1, 0L); + break; case 79: return jjMoveStringLiteralDfa12_0(active0, 0x40000000ULL, active1, 0L); case 97: - return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x8000000ULL); + return jjMoveStringLiteralDfa12_0(active0, 0x200000ULL, active1, 0x8000000ULL); case 101: if ((active0 & 0x20000ULL) != 0L) { jjmatchedKind = 17; jjmatchedPos = 11; } - return jjMoveStringLiteralDfa12_0(active0, 0x200000ULL, active1, 0L); + break; case 111: return jjMoveStringLiteralDfa12_0(active0, 0x40000000ULL, active1, 0L); default : -- cgit v0.12 From 2702af59b09e68ad2db9eff7ef4ae5594deb15ae Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 9 Nov 2019 14:00:44 +0100 Subject: Fixed use of uninitialized data in VHDL generator --- src/vhdldocgen.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 3585230..90d4829 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -717,7 +717,7 @@ static QMap > packages; MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName) { - ClassDef* cd,*ecd; + ClassDef* cd,*ecd=0; MemberDef *mdef=0; cd=getClass(className); @@ -793,9 +793,11 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem if (!packages.contains(ecd)) VhdlDocGen::findAllPackages(ecd); } - QMap >::Iterator cList=packages.find(ecd); - if (cList.key()!=0) - { + if (ecd) + { + QMap >::Iterator cList=packages.find(ecd); + if (cList!=packages.end()) + { QList mlist=cList.data(); for (uint j=0;j Date: Sat, 9 Nov 2019 14:01:22 +0100 Subject: Make preprocess code reentrant --- src/doxygen.cpp | 10 +- src/doxygen.h | 2 + src/pre.h | 16 +- src/pre.l | 4689 ++++++++++++++++++++++++++++--------------------------- 4 files changed, 2383 insertions(+), 2334 deletions(-) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index bf282b6..b0b3e67 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -171,6 +171,7 @@ bool Doxygen::generatingXmlOutput = FALSE; bool Doxygen::markdownSupport = TRUE; GenericsSDict *Doxygen::genericsDict; DocGroup Doxygen::docGroup; +Preprocessor *Doxygen::preprocessor = 0; // locally accessible globals static std::unordered_map< std::string, const Entry* > g_classEntries; @@ -9395,7 +9396,7 @@ static void parseFile(ParserInterface *parser, BufStr inBuf(fi.size()+4096); msg("Preprocessing %s...\n",fn); readInputFile(fileName,inBuf); - preprocessFile(fileName,inBuf,preBuf); + Doxygen::preprocessor->processFile(fileName,inBuf,preBuf); } else // no preprocessing { @@ -10078,7 +10079,7 @@ void initDoxygen() portable_correct_path(); Doxygen::runningTime.start(); - initPreprocessor(); + Doxygen::preprocessor = new Preprocessor(); Doxygen::parserManager = new ParserManager; Doxygen::parserManager->registerDefaultParser( new FileParser); @@ -10182,7 +10183,7 @@ void cleanUpDoxygen() delete Doxygen::globalScope; delete Doxygen::xrefLists; delete Doxygen::parserManager; - cleanUpPreprocessor(); + delete Doxygen::preprocessor; delete theTranslator; delete g_outputList; Mappers::freeMappers(); @@ -10662,7 +10663,7 @@ void adjustConfiguration() while (s) { QFileInfo fi(s); - addSearchDir(fi.absFilePath().utf8()); + Doxygen::preprocessor->addSearchDir(fi.absFilePath().utf8()); s=includePath.next(); } @@ -11266,7 +11267,6 @@ void parseInput() // we are done with input scanning now, so free up the buffers used by flex // (can be around 4MB) - preFreeScanner(); scanFreeScanner(); pyscanFreeScanner(); diff --git a/src/doxygen.h b/src/doxygen.h index c8eee7c..a23a678 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -60,6 +60,7 @@ class FormulaList; class FormulaDict; class FormulaNameDict; class SectionDict; +class Preprocessor; struct MemberGroupInfo; typedef QList StringList; @@ -152,6 +153,7 @@ class Doxygen static bool markdownSupport; static GenericsSDict *genericsDict; static DocGroup docGroup; + static Preprocessor *preprocessor; }; void initDoxygen(); diff --git a/src/pre.h b/src/pre.h index 190673f..193ab60 100644 --- a/src/pre.h +++ b/src/pre.h @@ -20,10 +20,16 @@ class BufStr; -void initPreprocessor(); -void cleanUpPreprocessor(); -void addSearchDir(const char *dir); -void preprocessFile(const char *fileName,BufStr &input,BufStr &output); -void preFreeScanner(); +class Preprocessor +{ + public: + Preprocessor(); + ~Preprocessor(); + void processFile(const char *fileName,BufStr &input,BufStr &output); + void addSearchDir(const char *dir); + private: + class Private; + Private *p; +}; #endif diff --git a/src/pre.l b/src/pre.l index 5e46110..0541b46 100644 --- a/src/pre.l +++ b/src/pre.l @@ -16,6 +16,8 @@ */ %option never-interactive %option prefix="preYY" +%option reentrant +%option extra-type="struct preYY_state *" %{ @@ -96,7 +98,8 @@ class DefineManager { public: /** Creates an empty container for defines */ - DefinesPerFile() : m_defines(257), m_includedFiles(17) + DefinesPerFile(DefineManager *parent) + : m_parent(parent), m_defines(257), m_includedFiles(17) { m_defines.setAutoDelete(TRUE); } @@ -126,24 +129,25 @@ class DefineManager } void collectDefines(DefineDict *dict,QDict &includeStack); private: + DefineManager *m_parent; DefineDict m_defines; QDict m_includedFiles; }; public: friend class DefinesPerFile; - /** Returns a reference to the singleton */ - static DefineManager &instance() + + /** Creates a new DefineManager object */ + DefineManager() : m_fileMap(1009), m_contextDefines(1009) { - if (theInstance==0) theInstance = new DefineManager; - return *theInstance; + m_fileMap.setAutoDelete(TRUE); } - /** Deletes the singleton */ - static void deleteInstance() + + /** Destroys the object */ + virtual ~DefineManager() { - delete theInstance; - theInstance = 0; } + /** Starts a context in which defines are collected. * Called at the start of a new file that is preprocessed. * @param fileName the name of the file to process. @@ -157,7 +161,7 @@ class DefineManager if (dpf==0) { //printf("New file!\n"); - dpf = new DefinesPerFile; + dpf = new DefinesPerFile(this); m_fileMap.insert(fileName,dpf); } } @@ -182,7 +186,7 @@ class DefineManager if (dpf==0) { //printf("New file!\n"); - dpf = new DefinesPerFile; + dpf = new DefinesPerFile(this); m_fileMap.insert(fileName,dpf); } else @@ -211,7 +215,7 @@ class DefineManager DefinesPerFile *dpf = m_fileMap.find(fileName); if (dpf==0) { - dpf = new DefinesPerFile; + dpf = new DefinesPerFile(this); m_fileMap.insert(fileName,dpf); } dpf->addDefine(def); @@ -228,7 +232,7 @@ class DefineManager DefinesPerFile *dpf = m_fileMap.find(fromFileName); if (dpf==0) { - dpf = new DefinesPerFile; + dpf = new DefinesPerFile(this); m_fileMap.insert(fromFileName,dpf); } dpf->addInclude(toFileName); @@ -248,9 +252,8 @@ class DefineManager { return m_contextDefines; } - private: - static DefineManager *theInstance; + private: /** Helper function to collect all define for a given file */ void collectDefinesForFile(const char *fileName,DefineDict *dict) { @@ -270,23 +273,10 @@ class DefineManager return m_fileMap.find(fileName); } - /** Creates a new DefineManager object */ - DefineManager() : m_fileMap(1009), m_contextDefines(1009) - { - m_fileMap.setAutoDelete(TRUE); - } - - /** Destroys the object */ - virtual ~DefineManager() - { - } - QDict m_fileMap; DefineDict m_contextDefines; }; -/** Singleton instance */ -DefineManager *DefineManager::theInstance = 0; /** Collects all defines for a file and all files that the file includes. * This function will recursively call itself for each file. @@ -304,7 +294,7 @@ void DefineManager::DefinesPerFile::collectDefines( for (di.toFirst();(di.current());++di) { QCString incFile = di.currentKey(); - DefinesPerFile *dpf = DefineManager::instance().find(incFile); + DefinesPerFile *dpf = m_parent->find(incFile); if (dpf && includeStack.find(incFile)==0) { //printf(" processing include %s\n",incFile.data()); @@ -334,1903 +324,560 @@ void DefineManager::DefinesPerFile::collectDefines( * scanner's state */ -static int g_yyLineNr = 1; -static int g_yyMLines = 1; -static int g_yyColNr = 1; -static QCString g_yyFileName; -static FileDef *g_yyFileDef; -static FileDef *g_inputFileDef; -static int g_ifcount = 0; -static QStrList *g_pathList = 0; -static QStack g_includeStack; -static QDict *g_argDict; -static int g_defArgs = -1; -static QCString g_defName; -static QCString g_defText; -static QCString g_defLitText; -static QCString g_defArgsStr; -static QCString g_defExtraSpacing; -static bool g_defVarArgs; -static int g_level; -static int g_lastCContext; -static int g_lastCPPContext; -static QArray g_levelGuard; -static BufStr *g_inputBuf; -static int g_inputBufPos; -static BufStr *g_outputBuf; -static int g_roundCount; -static bool g_quoteArg; -static DefineDict *g_expandedDict; -static int g_findDefArgContext; -static bool g_expectGuard; -static QCString g_guardName; -static QCString g_lastGuardName; -static QCString g_incName; -static QCString g_guardExpr; -static int g_curlyCount; -static bool g_nospaces; // add extra spaces during macro expansion - -static bool g_macroExpansion; // from the configuration -static bool g_expandOnlyPredef; // from the configuration -static int g_commentCount; -static bool g_insideComment; -static bool g_isImported; -static QCString g_blockName; -static int g_condCtx; -static bool g_skip; -static QStack g_condStack; -static bool g_insideCS; // C# has simpler preprocessor -static bool g_isSource; - -static bool g_lexInit = FALSE; -static int g_fenceSize = 0; -static bool g_ccomment; -static QCString g_delimiter; - -//DefineDict* getGlobalDefineDict() -//{ -// return g_globalDefineDict; -//} - -static void setFileName(const char *name) -{ - bool ambig; - QFileInfo fi(name); - g_yyFileName=fi.absFilePath().utf8(); - g_yyFileDef=findFileDef(Doxygen::inputNameDict,g_yyFileName,ambig); - if (g_yyFileDef==0) // if this is not an input file check if it is an - // include file - { - g_yyFileDef=findFileDef(Doxygen::includeNameDict,g_yyFileName,ambig); - } - //printf("setFileName(%s) g_yyFileName=%s g_yyFileDef=%p\n", - // name,g_yyFileName.data(),g_yyFileDef); - if (g_yyFileDef && g_yyFileDef->isReference()) g_yyFileDef=0; - g_insideCS = getLanguageFromFileName(g_yyFileName)==SrcLangExt_CSharp; - g_isSource = guessSection(g_yyFileName); -} - -static void incrLevel() -{ - g_level++; - g_levelGuard.resize(g_level); - g_levelGuard[g_level-1]=FALSE; - //printf("%s line %d: incrLevel %d\n",g_yyFileName.data(),g_yyLineNr,g_level); -} - -static void decrLevel() +struct preYY_state { - //printf("%s line %d: decrLevel %d\n",g_yyFileName.data(),g_yyLineNr,g_level); - if (g_level > 0) - { - g_level--; - g_levelGuard.resize(g_level); - } - else - { - warn(g_yyFileName,g_yyLineNr,"More #endif's than #if's found.\n"); - } -} - -static bool otherCaseDone() -{ - if (g_level==0) - { - warn(g_yyFileName,g_yyLineNr,"Found an #else without a preceding #if.\n"); - return TRUE; - } - else - { - return g_levelGuard[g_level-1]; - } -} + preYY_state() : allIncludes(10009) {} + int yyLineNr = 1; + int yyMLines = 1; + int yyColNr = 1; + QCString yyFileName; + FileDef *yyFileDef; + FileDef *inputFileDef; + int ifcount = 0; + QStrList *pathList = 0; + QStack includeStack; + QDict *argDict; + int defArgs = -1; + QCString defName; + QCString defText; + QCString defLitText; + QCString defArgsStr; + QCString defExtraSpacing; + bool defVarArgs; + int level; + int lastCContext; + int lastCPPContext; + QArray levelGuard; + BufStr *inputBuf; + int inputBufPos; + BufStr *outputBuf; + int roundCount; + bool quoteArg; + DefineDict *expandedDict; + int findDefArgContext; + bool expectGuard; + QCString guardName; + QCString lastGuardName; + QCString incName; + QCString guardExpr; + int curlyCount; + bool nospaces; // add extra spaces during macro expansion + + bool macroExpansion; // from the configuration + bool expandOnlyPredef; // from the configuration + int commentCount; + bool insideComment; + bool isImported; + QCString blockName; + int condCtx; + bool skip; + QStack condStack; + bool insideCS; // C# has simpler preprocessor + bool isSource; + + int fenceSize = 0; + bool ccomment; + QCString delimiter; + QDict allIncludes; + DefineManager defineManager; +}; -static void setCaseDone(bool value) -{ - g_levelGuard[g_level-1]=value; -} +// stateless functions +static QCString escapeAt(const char *text); +static QCString extractTrailingComment(const char *s); +static char resolveTrigraph(char c); + +// statefull functions +static inline void outputArray(yyscan_t yyscanner,const char *a,int len); +static inline void outputChar(yyscan_t yyscanner,char c); +static QCString expandMacro(yyscan_t yyscanner,const QCString &name); +static void readIncludeFile(yyscan_t yyscanner,const QCString &inc); +static void incrLevel(yyscan_t yyscanner); +static void decrLevel(yyscan_t yyscanner); +static void setCaseDone(yyscan_t yyscanner,bool value); +static bool otherCaseDone(yyscan_t yyscanner); +static bool computeExpression(yyscan_t yyscanner,const QCString &expr); +static void startCondSection(yyscan_t yyscanner,const char *sectId); +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 QDict g_allIncludes(10009); +/* ----------------------------------------------------------------- */ -static FileState *checkAndOpenFile(const QCString &fileName,bool &alreadyIncluded) -{ - alreadyIncluded = FALSE; - FileState *fs = 0; - //printf("checkAndOpenFile(%s)\n",fileName.data()); - QFileInfo fi(fileName); - if (fi.exists() && fi.isFile()) - { - static QStrList &exclPatterns = Config_getList(EXCLUDE_PATTERNS); - if (patternMatch(fi,&exclPatterns)) return 0; +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); - QCString absName = fi.absFilePath().utf8(); +/* ----------------------------------------------------------------- */ - // global guard - if (g_curlyCount==0) // not #include inside { ... } - { - if (g_allIncludes.find(absName)!=0) - { - alreadyIncluded = TRUE; - //printf(" already included 1\n"); - return 0; // already done - } - g_allIncludes.insert(absName,(void *)0x8); - } - // check include stack for absName +%} - QStack tmpStack; - g_includeStack.setAutoDelete(FALSE); - while ((fs=g_includeStack.pop())) - { - if (fs->fileName==absName) alreadyIncluded=TRUE; - tmpStack.push(fs); - } - while ((fs=tmpStack.pop())) - { - g_includeStack.push(fs); - } - g_includeStack.setAutoDelete(TRUE); +ID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* +B [ \t] +BN [ \t\r\n] +RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" +RAWEND ")"[^ \t\(\)\\]{0,16}\" +CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) - if (alreadyIncluded) - { - //printf(" already included 2\n"); - return 0; - } - //printf("#include %s\n",absName.data()); +%option noyywrap - fs = new FileState(fi.size()+4096); - alreadyIncluded = FALSE; - if (!readInputFile(absName,fs->fileBuf)) - { // error - //printf(" error reading\n"); - delete fs; - fs=0; - } - else - { - fs->oldFileBuf = g_inputBuf; - fs->oldFileBufPos = g_inputBufPos; - } - } - return fs; -} +%x Start +%x Command +%x SkipCommand +%x SkipLine +%x SkipString +%x CopyLine +%x CopyString +%x CopyStringCs +%x CopyStringFtn +%x CopyStringFtnDouble +%x CopyRawString +%x Include +%x IncludeID +%x EndImport +%x DefName +%x DefineArg +%x DefineText +%x SkipCPPBlock +%x Ifdef +%x Ifndef +%x SkipCComment +%x ArgCopyCComment +%x CopyCComment +%x SkipVerbatim +%x SkipCPPComment +%x RemoveCComment +%x RemoveCPPComment +%x Guard +%x DefinedExpr1 +%x DefinedExpr2 +%x SkipDoubleQuote +%x SkipSingleQuote +%x UndefName +%x IgnoreLine +%x FindDefineArgs +%x ReadString +%x CondLineC +%x CondLineCpp +%x SkipCond -static FileState *findFile(const char *fileName,bool localInclude,bool &alreadyIncluded) -{ - //printf("** findFile(%s,%d) g_yyFileName=%s\n",fileName,localInclude,g_yyFileName.data()); - if (portable_isAbsolutePath(fileName)) - { - FileState *fs = checkAndOpenFile(fileName,alreadyIncluded); - if (fs) - { - setFileName(fileName); - g_yyLineNr=1; - return fs; - } - else if (alreadyIncluded) - { - return 0; - } - } - if (localInclude && !g_yyFileName.isEmpty()) - { - QFileInfo fi(g_yyFileName); - if (fi.exists()) - { - QCString absName = QCString(fi.dirPath(TRUE).data())+"/"+fileName; - FileState *fs = checkAndOpenFile(absName,alreadyIncluded); - if (fs) - { - setFileName(absName); - g_yyLineNr=1; - return fs; - } - else if (alreadyIncluded) - { - return 0; - } - } - } - if (g_pathList==0) - { - return 0; - } - char *s=g_pathList->first(); - while (s) - { - QCString absName = (QCString)s+"/"+fileName; - //printf(" Looking for %s in %s\n",fileName,s); - FileState *fs = checkAndOpenFile(absName,alreadyIncluded); - if (fs) - { - setFileName(absName); - g_yyLineNr=1; - //printf(" -> found it\n"); - return fs; - } - else if (alreadyIncluded) - { - return 0; - } +%% - s=g_pathList->next(); - } - return 0; -} +<*>\x06 +<*>\x00 +<*>\r +<*>"??"[=/'()!<>-] { // Trigraph + unput(resolveTrigraph(yytext[2])); + } +^{B}*"#" { BEGIN(Command); yyextra->yyColNr+=yyleng; yyextra->yyMLines=0;} +^{B}*/[^#] { + outputArray(yyscanner,yytext,(int)yyleng); + BEGIN(CopyLine); + } +^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors? + int i; + for (i=(int)yyleng-1;i>=0;i--) + { + unput(yytext[i]); + } + BEGIN(CopyLine); + } +^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n | // function list macro with one (...) argument, e.g. for K_GLOBAL_STATIC_WITH_ARGS +^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n { // function like macro + bool skipFuncMacros = Config_getBool(SKIP_FUNCTION_MACROS); + QCString name(yytext); + name=name.left(name.find('(')).stripWhiteSpace(); -static QCString extractTrailingComment(const char *s) -{ - if (s==0) return ""; - int i=strlen(s)-1; - while (i>=0) - { - char c=s[i]; - switch (c) - { - case '/': - { - i--; - if (i>=0 && s[i]=='*') // end of a comment block - { - i--; - while (i>0 && !(s[i-1]=='/' && s[i]=='*')) i--; - if (i==0) - { - i++; - } - // only /*!< or /**< are treated as a comment for the macro name, - // otherwise the comment is treated as part of the macro definition - return ((s[i+1]=='*' || s[i+1]=='!') && s[i+2]=='<') ? &s[i-1] : ""; - } - else - { - return ""; - } - } - break; - // whitespace or line-continuation - case ' ': - case '\t': - case '\r': - case '\n': - case '\\': - break; - default: - return ""; - } - i--; - } - return ""; -} - -static int getNextChar(const QCString &expr,QCString *rest,uint &pos); -static int getCurrentChar(const QCString &expr,QCString *rest,uint pos); -static void unputChar(const QCString &expr,QCString *rest,uint &pos,char c); -static void expandExpression(QCString &expr,QCString *rest,int pos); - -static QCString stringize(const QCString &s) -{ - QCString result; - uint i=0; - bool inString=FALSE; - bool inChar=FALSE; - char c,pc; - while (i'%s'\n",s.data(),result.data()); - return result; -} - -/*! Execute all ## operators in expr. - * If the macro name before or after the operator contains a no-rescan - * marker (@-) then this is removed (before the concatenated macro name - * may be expanded again. - */ -static void processConcatOperators(QCString &expr) -{ - //printf("processConcatOperators: in='%s'\n",expr.data()); - QRegExp r("[ \\t\\n]*##[ \\t\\n]*"); - int l,n,i=0; - if (expr.isEmpty()) return; - while ((n=r.match(expr,i,&l))!=-1) - { - //printf("Match: '%s'\n",expr.data()+i); - if (n+l+1<(int)expr.length() && expr.at(n+l)=='@' && expr.at(n+l+1)=='-') - { - // remove no-rescan marker after ID - l+=2; - } - //printf("found '%s'\n",expr.mid(n,l).data()); - // remove the ## operator and the surrounding whitespace - expr=expr.left(n)+expr.right(expr.length()-n-l); - int k=n-1; - while (k>=0 && isId(expr.at(k))) k--; - if (k>0 && expr.at(k)=='-' && expr.at(k-1)=='@') - { - // remove no-rescan marker before ID - expr=expr.left(k-1)+expr.right(expr.length()-k-1); - n-=2; - } - i=n; - } - //printf("processConcatOperators: out='%s'\n",expr.data()); -} - -static void yyunput (int c,char *buf_ptr ); -static void returnCharToStream(char c) -{ - unput(c); -} - -static inline void addTillEndOfString(const QCString &expr,QCString *rest, - uint &pos,char term,QCString &arg) -{ - int cc; - while ((cc=getNextChar(expr,rest,pos))!=EOF && cc!=0) - { - if (cc=='\\') arg+=(char)cc,cc=getNextChar(expr,rest,pos); - else if (cc==term) return; - arg+=(char)cc; - } -} - -/*! replaces the function macro \a def whose argument list starts at - * \a pos in expression \a expr. - * Notice that this routine may scan beyond the \a expr string if needed. - * In that case the characters will be read from the input file. - * The replacement string will be returned in \a result and the - * length of the (unexpanded) argument list is stored in \a len. - */ -static bool replaceFunctionMacro(const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result) -{ - //printf("replaceFunctionMacro(expr=%s,rest=%s,pos=%d,def=%s) level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),g_level); - uint j=pos; - len=0; - result.resize(0); - int cc; - while ((cc=getCurrentChar(expr,rest,j))!=EOF && isspace(cc)) - { - len++; - getNextChar(expr,rest,j); - } - if (cc!='(') - { - unputChar(expr,rest,j,' '); - return FALSE; - } - getNextChar(expr,rest,j); // eat the '(' character - - QDict argTable; // list of arguments - argTable.setAutoDelete(TRUE); - QCString arg; - int argCount=0; - bool done=FALSE; - - // PHASE 1: read the macro arguments - if (def->nargs==0) - { - while ((cc=getNextChar(expr,rest,j))!=EOF && cc!=0) - { - char c = (char)cc; - if (c==')') break; - } - } - else - { - while (!done && (argCountnargs || def->varArgs) && - ((cc=getNextChar(expr,rest,j))!=EOF && cc!=0) - ) - { - char c=(char)cc; - if (c=='(') // argument is a function => search for matching ) - { - int level=1; - arg+=c; - //char term='\0'; - while ((cc=getNextChar(expr,rest,j))!=EOF && cc!=0) - { - char c=(char)cc; - //printf("processing %c: term=%c (%d)\n",c,term,term); - if (c=='\'' || c=='\"') // skip ('s and )'s inside strings - { - arg+=c; - addTillEndOfString(expr,rest,j,c,arg); - } - if (c==')') - { - level--; - arg+=c; - if (level==0) break; - } - else if (c=='(') - { - level++; - arg+=c; - } - else - arg+=c; - } - } - else if (c==')' || c==',') // last or next argument found - { - if (c==',' && argCount==def->nargs-1 && def->varArgs) - { - arg=arg.stripWhiteSpace(); - arg+=','; - } - else - { - QCString argKey; - argKey.sprintf("@%d",argCount++); // key name - arg=arg.stripWhiteSpace(); - // add argument to the lookup table - argTable.insert(argKey, new QCString(arg)); - arg.resize(0); - if (c==')') // end of the argument list - { - done=TRUE; - } - } - } - else if (c=='\"') // append literal strings - { - arg+=c; - bool found=FALSE; - while (!found && (cc=getNextChar(expr,rest,j))!=EOF && cc!=0) - { - found = cc=='"'; - if (cc=='\\') - { - c=(char)cc; - arg+=c; - if ((cc=getNextChar(expr,rest,j))==EOF || cc==0) break; - } - c=(char)cc; - arg+=c; - } - } - else if (c=='\'') // append literal characters - { - arg+=c; - bool found=FALSE; - while (!found && (cc=getNextChar(expr,rest,j))!=EOF && cc!=0) - { - found = cc=='\''; - if (cc=='\\') - { - c=(char)cc; - arg+=c; - if ((cc=getNextChar(expr,rest,j))==EOF || cc==0) break; - } - c=(char)cc; - arg+=c; - } - } - else if (c=='/') // possible start of a comment - { - char prevChar = '\0'; - arg+=c; - if ((cc=getCurrentChar(expr,rest,j)) == '*') // we have a comment - { - while ((cc=getNextChar(expr,rest,j))!=EOF && cc!=0) - { - c=(char)cc; - arg+=c; - if (c == '/' && prevChar == '*') break; // we have an end of comment - prevChar = c; - } - } - } - else // append other characters - { - arg+=c; - } - } - } - - // PHASE 2: apply the macro function - if (argCount==def->nargs || // same number of arguments - (argCount>=def->nargs-1 && def->varArgs)) // variadic macro with at least as many - // params as the non-variadic part (see bug731985) - { - uint k=0; - // substitution of all formal arguments - QCString resExpr; - const QCString d=def->definition.stripWhiteSpace(); - //printf("Macro definition: %s\n",d.data()); - bool inString=FALSE; - while (k copy it (is unescaped later) - { - k+=2; - resExpr+="@@"; // we unescape these later - } - else if (d.at(k+1)=='-') // no-rescan marker - { - k+=2; - resExpr+="@-"; - } - else // argument marker => read the argument number - { - QCString key="@"; - QCString *subst=0; - bool hash=FALSE; - int l=k-1; - // search for ## backward - if (l>=0 && d.at(l)=='"') l--; - while (l>=0 && d.at(l)==' ') l--; - if (l>0 && d.at(l)=='#' && d.at(l-1)=='#') hash=TRUE; - k++; - // scan the number - while (k='0' && d.at(k)<='9') key+=d.at(k++); - if (!hash) - { - // search for ## forward - l=k; - if (l<(int)d.length() && d.at(l)=='"') l++; - while (l<(int)d.length() && d.at(l)==' ') l++; - if (l<(int)d.length()-1 && d.at(l)=='#' && d.at(l+1)=='#') hash=TRUE; - } - //printf("request key %s result %s\n",key.data(),argTable[key]->data()); - if (key.length()>1 && (subst=argTable[key])) - { - QCString substArg=*subst; - //printf("substArg='%s'\n",substArg.data()); - // only if no ## operator is before or after the argument - // marker we do macro expansion. - if (!hash) expandExpression(substArg,0,0); - if (inString) - { - //printf("'%s'=stringize('%s')\n",stringize(*subst).data(),subst->data()); - - // if the marker is inside a string (because a # was put - // before the macro name) we must escape " and \ characters - resExpr+=stringize(substArg); - } - else - { - if (hash && substArg.isEmpty()) - { - resExpr+="@E"; // empty argument will be remove later on - } - else if (g_nospaces) - { - resExpr+=substArg; - } - else - { - resExpr+=" "+substArg+" "; - } - } - } - } - } - else // no marker, just copy - { - if (!inString && d.at(k)=='\"') - { - inString=TRUE; // entering a literal string - } - else if (inString && d.at(k)=='\"' && (d.at(k-1)!='\\' || d.at(k-2)=='\\')) - { - inString=FALSE; // leaving a literal string - } - resExpr+=d.at(k++); - } - } - len=j-pos; - result=resExpr; - //printf("result after substitution '%s' expr='%s'\n", - // result.data(),expr.mid(pos,len).data()); - return TRUE; - } - return FALSE; -} - - -/*! returns the next identifier in string \a expr by starting at position \a p. - * The position of the identifier is returned (or -1 if nothing is found) - * and \a l is its length. Any quoted strings are skipping during the search. - */ -static int getNextId(const QCString &expr,int p,int *l) -{ - int n; - while (p<(int)expr.length()) - { - char c=expr.at(p++); - if (isdigit(c)) // skip number - { - while (p<(int)expr.length() && isId(expr.at(p))) p++; - } - else if (isalpha(c) || c=='_') // read id - { - n=p-1; - while (p<(int)expr.length() && isId(expr.at(p))) p++; - *l=p-n; - return n; - } - else if (c=='"') // skip string - { - char ppc=0,pc=c; - if (p<(int)expr.length()) c=expr.at(p); - while (p<(int)expr.length() && (c!='"' || (pc=='\\' && ppc!='\\'))) - // continue as long as no " is found, but ignoring \", but not \\" - { - ppc=pc; - pc=c; - c=expr.at(p); - p++; - } - if (p<(int)expr.length()) ++p; // skip closing quote - } - else if (c=='/') // skip C Comment - { - //printf("Found C comment at p=%d\n",p); - char pc=c; - if (p<(int)expr.length()) - { - c=expr.at(p); - if (c=='*') // Start of C comment - { - p++; - while (p<(int)expr.length() && !(pc=='*' && c=='/')) - { - pc=c; - c=expr.at(p++); - } - } - } - //printf("Found end of C comment at p=%d\n",p); - } - } - return -1; -} - -/*! performs recursive macro expansion on the string \a expr - * starting at position \a pos. - * May read additional characters from the input while re-scanning! - * If \a expandAll is \c TRUE then all macros in the expression are - * expanded, otherwise only the first is expanded. - */ -static void expandExpression(QCString &expr,QCString *rest,int pos) -{ - //printf("expandExpression(%s,%s)\n",expr.data(),rest ? rest->data() : 0); - QCString macroName; - QCString expMacro; - bool definedTest=FALSE; - int i=pos,l,p,len; - while ((p=getNextId(expr,i,&l))!=-1) // search for an macro name - { - bool replaced=FALSE; - macroName=expr.mid(p,l); - //printf("macroName=%s\n",macroName.data()); - if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker? - { - if (g_expandedDict->find(macroName)==0) // expand macro - { - Define *def=DefineManager::instance().isDefined(macroName); - if (macroName=="defined") - { - //printf("found defined inside macro definition '%s'\n",expr.right(expr.length()-p).data()); - definedTest=TRUE; - } - else if (definedTest) // macro name was found after defined - { - if (def) expMacro = " 1 "; else expMacro = " 0 "; - replaced=TRUE; - len=l; - definedTest=FALSE; - } - else if (def && def->nargs==-1) // simple macro - { - // substitute the definition of the macro - //printf("macro '%s'->'%s'\n",macroName.data(),def->definition.data()); - if (g_nospaces) - { - expMacro=def->definition.stripWhiteSpace(); - } - else - { - expMacro=" "+def->definition.stripWhiteSpace()+" "; - } - //expMacro=def->definition.stripWhiteSpace(); - replaced=TRUE; - len=l; - //printf("simple macro expansion='%s'->'%s'\n",macroName.data(),expMacro.data()); - } - else if (def && def->nargs>=0) // function macro - { - replaced=replaceFunctionMacro(expr,rest,p+l,len,def,expMacro); - len+=l; - } - - if (replaced) // expand the macro and rescan the expression - { - //printf("replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data()); - QCString resultExpr=expMacro; - QCString restExpr=expr.right(expr.length()-len-p); - processConcatOperators(resultExpr); - if (def && !def->nonRecursive) - { - g_expandedDict->insert(macroName,def); - expandExpression(resultExpr,&restExpr,0); - g_expandedDict->remove(macroName); - } - expr=expr.left(p)+resultExpr+restExpr; - i=p; - //printf("new expression: %s\n",expr.data()); - } - else // move to the next macro name - { - //printf("moving to the next macro old=%d new=%d\n",i,p+l); - i=p+l; - } - } - else // move to the next macro name - { - expr=expr.left(p)+"@-"+expr.right(expr.length()-p); - //printf("macro already expanded, moving to the next macro expr=%s\n",expr.data()); - i=p+l+2; - //i=p+l; - } - } - else // no re-scan marker found, skip the macro name - { - //printf("skipping marked macro\n"); - i=p+l; - } - } -} - -/*! @brief Process string or character literal. - * - * \a inputStr should point to the start of a string or character literal. - * the routine will return a pointer to just after the end of the literal - * the character making up the literal will be added to \a result. - */ -const char *processUntilMatchingTerminator(const char *inputStr,QCString &result) -{ - if (inputStr==0) return inputStr; - char term = *inputStr; // capture start character of the literal - if (term!='\'' && term!='"') return inputStr; // not a valid literal - char c=term; - // output start character - result+=c; - inputStr++; - while ((c=*inputStr)) // while inside the literal - { - if (c==term) // found end marker of the literal - { - // output end character and stop - result+=c; - inputStr++; - break; - } - else if (c=='\\') // escaped character, process next character - // as well without checking for end marker. - { - result+=c; - inputStr++; - c=*inputStr; - if (c==0) break; // unexpected end of string after escape character - } - result+=c; - inputStr++; - } - return inputStr; -} - -/*! replaces all occurrences of @@@@ in \a s by @@ - * and removes all occurrences of @@E. - * All identifiers found are replaced by 0L - */ -QCString removeIdsAndMarkers(const char *s) -{ - //printf("removeIdsAndMarkers(%s)\n",s); - const char *p=s; - char c; - bool inNum=FALSE; - QCString result; - if (p) - { - while ((c=*p)) - { - if (c=='@') // replace @@ with @ and remove @E - { - if (*(p+1)=='@') - { - result+=c; - } - else if (*(p+1)=='E') - { - // skip - } - p+=2; - } - else if (isdigit(c)) // number - { - result+=c; - p++; - inNum=TRUE; - } - else if (c=='\'') // quoted character - { - p = processUntilMatchingTerminator(p,result); - } - else if (c=='d' && !inNum) // identifier starting with a 'd' - { - if (qstrncmp(p,"defined ",8)==0 || qstrncmp(p,"defined(",8)==0) - // defined keyword - { - p+=7; // skip defined - } - else - { - result+="0L"; - p++; - while ((c=*p) && isId(c)) p++; - } - } - else if ((isalpha(c) || c=='_') && !inNum) // replace identifier with 0L - { - result+="0L"; - p++; - while ((c=*p) && isId(c)) p++; - while ((c=*p) && isspace((uchar)c)) p++; - if (*p=='(') // undefined function macro - { - p++; - int count=1; - while ((c=*p++)) - { - if (c=='(') count++; - else if (c==')') - { - count--; - if (count==0) break; - } - else if (c=='/') - { - char pc=c; - c=*++p; - if (c=='*') // start of C comment - { - while (*p && !(pc=='*' && c=='/')) // search end of comment - { - pc=c; - c=*++p; - } - p++; - } - } - } - } - } - else if (c=='/') // skip C comments - { - char pc=c; - c=*++p; - if (c=='*') // start of C comment - { - while (*p && !(pc=='*' && c=='/')) // search end of comment - { - pc=c; - c=*++p; - } - p++; - } - else // oops, not comment but division - { - result+=pc; - goto nextChar; - } - } - else - { -nextChar: - result+=c; - char lc=tolower(c); - if (!isId(lc) && lc!='.' /*&& lc!='-' && lc!='+'*/) inNum=FALSE; - p++; - } - } - } - //printf("removeIdsAndMarkers(%s)=%s\n",s,result.data()); - return result; -} - -/*! replaces all occurrences of @@ in \a s by @ - * \par assumption: - * \a s only contains pairs of @@'s - */ -QCString removeMarkers(const char *s) -{ - const char *p=s; - char c; - QCString result; - if (p) - { - while ((c=*p)) - { - switch(c) - { - case '@': // replace @@ with @ - { - if (*(p+1)=='@') - { - result+=c; - } - p+=2; - } - break; - case '/': // skip C comments - { - result+=c; - char pc=c; - c=*++p; - if (c=='*') // start of C comment - { - while (*p && !(pc=='*' && c=='/')) // search end of comment - { - if (*p=='@' && *(p+1)=='@') - result+=c,p++; - else - result+=c; - pc=c; - c=*++p; - } - if (*p) result+=c,p++; - } - } - break; - case '"': // skip string literals - case '\'': // skip char literals - p = processUntilMatchingTerminator(p,result); - break; - default: - { - result+=c; - p++; - } - break; - } - } - } - //printf("RemoveMarkers(%s)=%s\n",s,result.data()); - return result; -} - -/*! compute the value of the expression in string \a expr. - * If needed the function may read additional characters from the input. - */ - -bool computeExpression(const QCString &expr) -{ - QCString e=expr; - expandExpression(e,0,0); - //printf("after expansion '%s'\n",e.data()); - e = removeIdsAndMarkers(e); - if (e.isEmpty()) return FALSE; - //printf("parsing '%s'\n",e.data()); - return parseconstexp(g_yyFileName,g_yyLineNr,e); -} - -/*! expands the macro definition in \a name - * If needed the function may read additional characters from the input - */ - -QCString expandMacro(const QCString &name) -{ - QCString n=name; - expandExpression(n,0,0); - n=removeMarkers(n); - //printf("expandMacro '%s'->'%s'\n",name.data(),n.data()); - return n; -} - -Define *newDefine() -{ - Define *def=new Define; - def->name = g_defName; - def->definition = g_defText.stripWhiteSpace(); - def->nargs = g_defArgs; - def->fileName = g_yyFileName; - def->fileDef = g_yyFileDef; - def->lineNr = g_yyLineNr-g_yyMLines; - def->columnNr = g_yyColNr; - def->varArgs = g_defVarArgs; - //printf("newDefine: %s %s file: %s\n",def->name.data(),def->definition.data(), - // def->fileDef ? def->fileDef->name().data() : def->fileName.data()); - //printf("newDefine: '%s'->'%s'\n",def->name.data(),def->definition.data()); - if (!def->name.isEmpty() && Doxygen::expandAsDefinedDict[def->name]) - { - def->isPredefined=TRUE; - } - return def; -} - -void addDefine() -{ - if (g_skip) return; // do not add this define as it is inside a - // conditional section (cond command) that is disabled. - if (!Doxygen::gatherDefines) return; - - //printf("addDefine %s %s\n",g_defName.data(),g_defArgsStr.data()); - //ArgumentList *al = new ArgumentList; - //stringToArgumentList(g_defArgsStr,al); - MemberDef *md=createMemberDef( - g_yyFileName,g_yyLineNr-g_yyMLines,g_yyColNr, - "#define",g_defName,g_defArgsStr,0, - Public,Normal,FALSE,Member,MemberType_Define,ArgumentList(),ArgumentList(),""); - if (!g_defArgsStr.isEmpty()) - { - ArgumentList argList; - //printf("addDefine() g_defName='%s' g_defArgsStr='%s'\n",g_defName.data(),g_defArgsStr.data()); - stringToArgumentList(g_defArgsStr,argList); - md->setArgumentList(argList); - } - //printf("Setting initializer for '%s' to '%s'\n",g_defName.data(),g_defText.data()); - int l=g_defLitText.find('\n'); - if (l>0 && g_defLitText.left(l).stripWhiteSpace()=="\\") - { - // strip first line if it only contains a slash - g_defLitText = g_defLitText.right(g_defLitText.length()-l-1); - } - else if (l>0) - { - // align the items on the first line with the items on the second line - int k=l+1; - const char *p=g_defLitText.data()+k; - char c; - while ((c=*p++) && (c==' ' || c=='\t')) k++; - g_defLitText=g_defLitText.mid(l+1,k-l-1)+g_defLitText.stripWhiteSpace(); - } - md->setInitializer(g_defLitText.stripWhiteSpace()); - - //printf("pre.l: md->setFileDef(%p)\n",g_inputFileDef); - md->setFileDef(g_inputFileDef); - md->setDefinition("#define "+g_defName); - - MemberName *mn=Doxygen::functionNameSDict->find(g_defName); - if (mn==0) - { - mn = new MemberName(g_defName); - Doxygen::functionNameSDict->append(g_defName,mn); - } - mn->append(md); - if (g_yyFileDef) - { - g_yyFileDef->insertMember(md); - } - - //Define *d; - //if ((d=defineDict[g_defName])==0) defineDict.insert(g_defName,newDefine()); -} - -static inline void outputChar(char c) -{ - if (g_includeStack.isEmpty() || g_curlyCount>0) g_outputBuf->addChar(c); -} - -static inline void outputArray(const char *a,int len) -{ - if (g_includeStack.isEmpty() || g_curlyCount>0) g_outputBuf->addArray(a,len); -} - -static void readIncludeFile(const QCString &inc) -{ - static bool searchIncludes = Config_getBool(SEARCH_INCLUDES); - uint i=0; - - // find the start of the include file name - while (i0 && inc.at(s-1)=='"'; - - // find the end of the include file name - while (is) // valid include file name found - { - // extract include path+name - QCString incFileName=inc.mid(s,i-s).stripWhiteSpace(); - - QCString dosExt = incFileName.right(4); - if (dosExt==".exe" || dosExt==".dll" || dosExt==".tlb") - { - // skip imported binary files (e.g. M$ type libraries) - return; - } - - QCString oldFileName = g_yyFileName; - FileDef *oldFileDef = g_yyFileDef; - int oldLineNr = g_yyLineNr; - //printf("Searching for '%s'\n",incFileName.data()); - - // absIncFileName avoids difficulties for incFileName starting with "../" (bug 641336) - QCString absIncFileName = incFileName; - { - QFileInfo fi(g_yyFileName); - if (fi.exists()) - { - QCString absName = QCString(fi.dirPath(TRUE).data())+"/"+incFileName; - QFileInfo fi2(absName); - if (fi2.exists()) - { - absIncFileName=fi2.absFilePath().utf8(); - } - else if (searchIncludes) // search in INCLUDE_PATH as well - { - QStrList &includePath = Config_getList(INCLUDE_PATH); - char *s=includePath.first(); - while (s) - { - QFileInfo fi(s); - if (fi.exists() && fi.isDir()) - { - QCString absName = QCString(fi.absFilePath().utf8())+"/"+incFileName; - //printf("trying absName=%s\n",absName.data()); - QFileInfo fi2(absName); - if (fi2.exists()) - { - absIncFileName=fi2.absFilePath().utf8(); - break; - } - //printf( "absIncFileName = %s\n", absIncFileName.data() ); - } - s=includePath.next(); - } - } - //printf( "absIncFileName = %s\n", absIncFileName.data() ); - } - } - DefineManager::instance().addInclude(g_yyFileName,absIncFileName); - DefineManager::instance().addFileToContext(absIncFileName); - - // findFile will overwrite g_yyFileDef if found - FileState *fs; - bool alreadyIncluded = FALSE; - //printf("calling findFile(%s)\n",incFileName.data()); - if ((fs=findFile(incFileName,localInclude,alreadyIncluded))) // see if the include file can be found - { - //printf("Found include file!\n"); - if (Debug::isFlagSet(Debug::Preprocessor)) - { - for (i=0;iaddIncludeDependency(ambig ? 0 : incFd,incFileName,localInclude,g_isImported,FALSE); - // add included by dependency - if (g_yyFileDef) - { - //printf("Adding include dependency %s->%s\n",oldFileDef->name().data(),incFileName.data()); - g_yyFileDef->addIncludedByDependency(oldFileDef,oldFileDef->docName(),localInclude,g_isImported); - } - } - else if (g_inputFileDef) - { - g_inputFileDef->addIncludeDependency(0,absIncFileName,localInclude,g_isImported,TRUE); - } - fs->bufState = YY_CURRENT_BUFFER; - fs->lineNr = oldLineNr; - fs->fileName = oldFileName; - fs->curlyCount = g_curlyCount; - g_curlyCount = 0; - // push the state on the stack - g_includeStack.push(fs); - // set the scanner to the include file - - // Deal with file changes due to - // #include's within { .. } blocks - QCString lineStr(g_yyFileName.length()+20); - lineStr.sprintf("# 1 \"%s\" 1\n",g_yyFileName.data()); - outputArray(lineStr.data(),lineStr.length()); - - DBG_CTX((stderr,"Switching to include file %s\n",incFileName.data())); - g_expectGuard=TRUE; - g_inputBuf = &fs->fileBuf; - g_inputBufPos=0; - yy_switch_to_buffer(yy_create_buffer(0, YY_BUF_SIZE)); - } - else - { - //printf(" calling findFile(%s) alreadyInc=%d\n",incFileName.data(),alreadyIncluded); - if (oldFileDef) - { - bool ambig; - //QCString absPath = incFileName; - //if (QDir::isRelativePath(incFileName)) - //{ - // absPath = QDir::cleanDirPath(oldFileDef->getPath()+"/"+incFileName); - // //printf("%s + %s -> resolved path %s\n",oldFileDef->getPath().data(),incFileName.data(),absPath.data()); - //} - - // change to absolute name for bug 641336 - FileDef *fd = findFileDef(Doxygen::inputNameDict,absIncFileName,ambig); - //printf("%s::findFileDef(%s)=%p\n",oldFileDef->name().data(),incFileName.data(),fd); - // add include dependency to the file in which the #include was found - oldFileDef->addIncludeDependency(ambig ? 0 : fd,incFileName,localInclude,g_isImported,FALSE); - // add included by dependency - if (fd) - { - //printf("Adding include dependency (2) %s->%s ambig=%d\n",oldFileDef->name().data(),fd->name().data(),ambig); - fd->addIncludedByDependency(oldFileDef,oldFileDef->docName(),localInclude,g_isImported); - } - } - else if (g_inputFileDef) - { - g_inputFileDef->addIncludeDependency(0,absIncFileName,localInclude,g_isImported,TRUE); - } - if (Debug::isFlagSet(Debug::Preprocessor)) - { - if (alreadyIncluded) - { - Debug::print(Debug::Preprocessor,0,"#include %s: already included! skipping...\n",qPrint(incFileName)); - } - else - { - Debug::print(Debug::Preprocessor,0,"#include %s: not found! skipping...\n",qPrint(incFileName)); - } - //printf("error: include file %s not found\n",yytext); - } - if (g_curlyCount>0 && !alreadyIncluded) // failed to find #include inside { ... } - { - warn(g_yyFileName,g_yyLineNr,"include file %s not found, perhaps you forgot to add its directory to INCLUDE_PATH?",incFileName.data()); - } - } - } -} - -/* ----------------------------------------------------------------- */ - -static void startCondSection(const char *sectId) -{ - //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); - CondParser prs; - bool expResult = prs.parse(g_yyFileName,g_yyLineNr,sectId); - g_condStack.push(new CondCtx(g_yyLineNr,sectId,g_skip)); - if (!expResult) - { - g_skip=TRUE; - } - //printf(" expResult=%d skip=%d\n",expResult,g_skip); -} - -static void endCondSection() -{ - if (g_condStack.isEmpty()) - { - g_skip=FALSE; - } - else - { - CondCtx *ctx = g_condStack.pop(); - g_skip=ctx->skip; - delete ctx; - } - //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); -} - -static void forceEndCondSection() -{ - while (!g_condStack.isEmpty()) - { - delete g_condStack.pop(); - } - g_skip=FALSE; -} - -static QCString escapeAt(const char *text) -{ - QCString result; - if (text) - { - char c; - const char *p=text; - while ((c=*p++)) - { - if (c=='@') result+="@@"; else result+=c; - } - } - return result; -} - -static char resolveTrigraph(char c) -{ - switch (c) - { - case '=': return '#'; - case '/': return '\\'; - case '\'': return '^'; - case '(': return '['; - case ')': return ']'; - case '!': return '|'; - case '<': return '{'; - case '>': return '}'; - case '-': return '~'; - } - return '?'; -} - -/* ----------------------------------------------------------------- */ - -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); - -static int yyread(char *buf,int max_size) -{ - int bytesInBuf = g_inputBuf->curPos()-g_inputBufPos; - int bytesToCopy = QMIN(max_size,bytesInBuf); - memcpy(buf,g_inputBuf->data()+g_inputBufPos,bytesToCopy); - g_inputBufPos+=bytesToCopy; - return bytesToCopy; -} - -/* ----------------------------------------------------------------- */ - -%} - -ID [a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* -B [ \t] -BN [ \t\r\n] -RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" -RAWEND ")"[^ \t\(\)\\]{0,16}\" -CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) - -%option noyywrap - -%x Start -%x Command -%x SkipCommand -%x SkipLine -%x SkipString -%x CopyLine -%x CopyString -%x CopyStringCs -%x CopyStringFtn -%x CopyStringFtnDouble -%x CopyRawString -%x Include -%x IncludeID -%x EndImport -%x DefName -%x DefineArg -%x DefineText -%x SkipCPPBlock -%x Ifdef -%x Ifndef -%x SkipCComment -%x ArgCopyCComment -%x CopyCComment -%x SkipVerbatim -%x SkipCPPComment -%x RemoveCComment -%x RemoveCPPComment -%x Guard -%x DefinedExpr1 -%x DefinedExpr2 -%x SkipDoubleQuote -%x SkipSingleQuote -%x UndefName -%x IgnoreLine -%x FindDefineArgs -%x ReadString -%x CondLineC -%x CondLineCpp -%x SkipCond - -%% - -<*>\x06 -<*>\x00 -<*>\r -<*>"??"[=/'()!<>-] { // Trigraph - unput(resolveTrigraph(yytext[2])); - } -^{B}*"#" { BEGIN(Command); g_yyColNr+=yyleng; g_yyMLines=0;} -^{B}*/[^#] { - outputArray(yytext,(int)yyleng); - BEGIN(CopyLine); - } -^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors? - int i; - for (i=(int)yyleng-1;i>=0;i--) - { - unput(yytext[i]); - } - BEGIN(CopyLine); - } -^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n | // function list macro with one (...) argument, e.g. for K_GLOBAL_STATIC_WITH_ARGS -^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n { // function like macro - static bool skipFuncMacros = Config_getBool(SKIP_FUNCTION_MACROS); - QCString name(yytext); - name=name.left(name.find('(')).stripWhiteSpace(); - - Define *def=0; - if (skipFuncMacros && - name!="Q_PROPERTY" && - !( - (g_includeStack.isEmpty() || g_curlyCount>0) && - g_macroExpansion && - (def=DefineManager::instance().isDefined(name)) && - /*macroIsAccessible(def) &&*/ - (!g_expandOnlyPredef || def->isPredefined) - ) - ) - { - outputChar('\n'); - g_yyLineNr++; - } - else // don't skip - { - int i; - for (i=(int)yyleng-1;i>=0;i--) - { - unput(yytext[i]); - } - BEGIN(CopyLine); - } - } -"extern"{BN}{0,80}"\"C\""*{BN}{0,80}"{" { - QCString text=yytext; - g_yyLineNr+=text.contains('\n'); - outputArray(yytext,(int)yyleng); - } -{RAWBEGIN} { - g_delimiter = yytext+2; - g_delimiter=g_delimiter.left(g_delimiter.length()-1); - outputArray(yytext,(int)yyleng); - BEGIN(CopyRawString); - } -"{" { // count brackets inside the main file - if (g_includeStack.isEmpty()) - { - g_curlyCount++; - } - outputChar(*yytext); - } -"}" { // count brackets inside the main file - if (g_includeStack.isEmpty() && g_curlyCount>0) - { - g_curlyCount--; - } - outputChar(*yytext); - } -"'"\\[0-7]{1,3}"'" { - outputArray(yytext,(int)yyleng); - } -"'"\\."'" { - outputArray(yytext,(int)yyleng); - } -"'"."'" { - outputArray(yytext,(int)yyleng); - } -@\" { - if (getLanguageFromFileName(g_yyFileName)!=SrcLangExt_CSharp) REJECT; - outputArray(yytext,(int)yyleng); - BEGIN( CopyStringCs ); - } -\" { - outputChar(*yytext); - if (getLanguageFromFileName(g_yyFileName)!=SrcLangExt_Fortran) - { - BEGIN( CopyString ); - } - else - { - BEGIN( CopyStringFtnDouble ); - } - } -\' { - if (getLanguageFromFileName(g_yyFileName)!=SrcLangExt_Fortran) REJECT; - outputChar(*yytext); - BEGIN( CopyStringFtn ); - } -[^\"\\\r\n]+ { - outputArray(yytext,(int)yyleng); - } -[^\"\r\n]+ { - outputArray(yytext,(int)yyleng); - } -\\. { - outputArray(yytext,(int)yyleng); - } -\" { - outputChar(*yytext); - BEGIN( CopyLine ); - } -[^\"\\\r\n]+ { - outputArray(yytext,(int)yyleng); - } -\\. { - outputArray(yytext,(int)yyleng); - } -\" { - outputChar(*yytext); - BEGIN( CopyLine ); - } -[^\'\\\r\n]+ { - outputArray(yytext,(int)yyleng); - } -\\. { - outputArray(yytext,(int)yyleng); - } -\' { - outputChar(*yytext); - BEGIN( CopyLine ); - } -{RAWEND} { - outputArray(yytext,(int)yyleng); - QCString delimiter = yytext+1; - delimiter=delimiter.left(delimiter.length()-1); - if (delimiter==g_delimiter) - { - BEGIN( CopyLine ); - } - } -[^)]+ { - outputArray(yytext,(int)yyleng); - } -. { - outputChar(*yytext); - } -{ID}/{BN}{0,80}"(" { - g_expectGuard = FALSE; - Define *def=0; - //def=g_globalDefineDict->find(yytext); - //def=DefineManager::instance().isDefined(yytext); - //printf("Search for define %s found=%d g_includeStack.isEmpty()=%d " - // "g_curlyCount=%d g_macroExpansion=%d g_expandOnlyPredef=%d " - // "isPreDefined=%d\n",yytext,def ? 1 : 0, - // g_includeStack.isEmpty(),g_curlyCount,g_macroExpansion,g_expandOnlyPredef, - // def ? def->isPredefined : -1 - // ); - if ((g_includeStack.isEmpty() || g_curlyCount>0) && - g_macroExpansion && - (def=DefineManager::instance().isDefined(yytext)) && - /*(def->isPredefined || macroIsAccessible(def)) && */ - (!g_expandOnlyPredef || def->isPredefined) - ) - { - //printf("Found it! #args=%d\n",def->nargs); - g_roundCount=0; - g_defArgsStr=yytext; - if (def->nargs==-1) // no function macro - { - QCString result = def->isPredefined ? def->definition : expandMacro(g_defArgsStr); - outputArray(result,result.length()); - } - else // zero or more arguments - { - g_findDefArgContext = CopyLine; - BEGIN(FindDefineArgs); - } - } - else - { - outputArray(yytext,(int)yyleng); - } - } -{ID} { - Define *def=0; - if ((g_includeStack.isEmpty() || g_curlyCount>0) && - g_macroExpansion && - (def=DefineManager::instance().isDefined(yytext)) && - def->nargs==-1 && - /*(def->isPredefined || macroIsAccessible(def)) &&*/ - (!g_expandOnlyPredef || def->isPredefined) - ) - { - QCString result=def->isPredefined ? def->definition : expandMacro(yytext); - outputArray(result,result.length()); - } - else - { - outputArray(yytext,(int)yyleng); - } - } -"\\"\r?/\n { // strip line continuation characters - if (getLanguageFromFileName(g_yyFileName)==SrcLangExt_Fortran) outputChar(*yytext); - } -. { - outputChar(*yytext); - } -\n { - outputChar('\n'); - BEGIN(Start); - g_yyLineNr++; - g_yyColNr=1; - } -"(" { - g_defArgsStr+='('; - g_roundCount++; - } -")" { - g_defArgsStr+=')'; - g_roundCount--; - if (g_roundCount==0) - { - QCString result=expandMacro(g_defArgsStr); - //printf("g_defArgsStr='%s'->'%s'\n",g_defArgsStr.data(),result.data()); - if (g_findDefArgContext==CopyLine) - { - outputArray(result,result.length()); - BEGIN(g_findDefArgContext); - } - else // g_findDefArgContext==IncludeID - { - readIncludeFile(result); - g_nospaces=FALSE; - BEGIN(Start); - } - } - } - /* -")"{B}*"(" { - g_defArgsStr+=yytext; - } - */ -{CHARLIT} { - g_defArgsStr+=yytext; - } -"/*"[*]? { - g_defArgsStr+=yytext; - BEGIN(ArgCopyCComment); - } -\" { - g_defArgsStr+=*yytext; - BEGIN(ReadString); - } -' { - if (getLanguageFromFileName(g_yyFileName)!=SrcLangExt_Fortran) REJECT; - g_defArgsStr+=*yytext; - BEGIN(ReadString); - } -\n { - g_defArgsStr+=' '; - g_yyLineNr++; - outputChar('\n'); - } -"@" { - g_defArgsStr+="@@"; - } -. { - g_defArgsStr+=*yytext; - } -[^*\n]+ { - g_defArgsStr+=yytext; - } -"*/" { - g_defArgsStr+=yytext; - BEGIN(FindDefineArgs); - } -\n { - g_defArgsStr+=' '; - g_yyLineNr++; - outputChar('\n'); - } -. { - g_defArgsStr+=yytext; - } -"\"" { - g_defArgsStr+=*yytext; - BEGIN(FindDefineArgs); - } -"'" { - if (getLanguageFromFileName(g_yyFileName)!=SrcLangExt_Fortran) REJECT; - g_defArgsStr+=*yytext; - BEGIN(FindDefineArgs); - } + Define *def=0; + if (skipFuncMacros && + name!="Q_PROPERTY" && + !( + (yyextra->includeStack.isEmpty() || yyextra->curlyCount>0) && + yyextra->macroExpansion && + (def=yyextra->defineManager.isDefined(name)) && + /*macroIsAccessible(def) &&*/ + (!yyextra->expandOnlyPredef || def->isPredefined) + ) + ) + { + outputChar(yyscanner,'\n'); + yyextra->yyLineNr++; + } + else // don't skip + { + int i; + for (i=(int)yyleng-1;i>=0;i--) + { + unput(yytext[i]); + } + BEGIN(CopyLine); + } + } +"extern"{BN}{0,80}"\"C\""*{BN}{0,80}"{" { + QCString text=yytext; + yyextra->yyLineNr+=text.contains('\n'); + outputArray(yyscanner,yytext,(int)yyleng); + } +{RAWBEGIN} { + yyextra->delimiter = yytext+2; + yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); + outputArray(yyscanner,yytext,(int)yyleng); + BEGIN(CopyRawString); + } +"{" { // count brackets inside the main file + if (yyextra->includeStack.isEmpty()) + { + yyextra->curlyCount++; + } + outputChar(yyscanner,*yytext); + } +"}" { // count brackets inside the main file + if (yyextra->includeStack.isEmpty() && yyextra->curlyCount>0) + { + yyextra->curlyCount--; + } + outputChar(yyscanner,*yytext); + } +"'"\\[0-7]{1,3}"'" { + outputArray(yyscanner,yytext,(int)yyleng); + } +"'"\\."'" { + outputArray(yyscanner,yytext,(int)yyleng); + } +"'"."'" { + outputArray(yyscanner,yytext,(int)yyleng); + } +@\" { + if (getLanguageFromFileName(yyextra->yyFileName)!=SrcLangExt_CSharp) REJECT; + outputArray(yyscanner,yytext,(int)yyleng); + BEGIN( CopyStringCs ); + } +\" { + outputChar(yyscanner,*yytext); + if (getLanguageFromFileName(yyextra->yyFileName)!=SrcLangExt_Fortran) + { + BEGIN( CopyString ); + } + else + { + BEGIN( CopyStringFtnDouble ); + } + } +\' { + if (getLanguageFromFileName(yyextra->yyFileName)!=SrcLangExt_Fortran) REJECT; + outputChar(yyscanner,*yytext); + BEGIN( CopyStringFtn ); + } +[^\"\\\r\n]+ { + outputArray(yyscanner,yytext,(int)yyleng); + } +[^\"\r\n]+ { + outputArray(yyscanner,yytext,(int)yyleng); + } +\\. { + outputArray(yyscanner,yytext,(int)yyleng); + } +\" { + outputChar(yyscanner,*yytext); + BEGIN( CopyLine ); + } +[^\"\\\r\n]+ { + outputArray(yyscanner,yytext,(int)yyleng); + } +\\. { + outputArray(yyscanner,yytext,(int)yyleng); + } +\" { + outputChar(yyscanner,*yytext); + BEGIN( CopyLine ); + } +[^\'\\\r\n]+ { + outputArray(yyscanner,yytext,(int)yyleng); + } +\\. { + outputArray(yyscanner,yytext,(int)yyleng); + } +\' { + outputChar(yyscanner,*yytext); + BEGIN( CopyLine ); + } +{RAWEND} { + outputArray(yyscanner,yytext,(int)yyleng); + QCString delimiter = yytext+1; + delimiter=delimiter.left(delimiter.length()-1); + if (delimiter==yyextra->delimiter) + { + BEGIN( CopyLine ); + } + } +[^)]+ { + outputArray(yyscanner,yytext,(int)yyleng); + } +. { + outputChar(yyscanner,*yytext); + } +{ID}/{BN}{0,80}"(" { + yyextra->expectGuard = FALSE; + Define *def=0; + //def=yyextra->globalDefineDict->find(yytext); + //def=yyextra->defineManager.isDefined(yytext); + //printf("Search for define %s found=%d yyextra->includeStack.isEmpty()=%d " + // "yyextra->curlyCount=%d yyextra->macroExpansion=%d yyextra->expandOnlyPredef=%d " + // "isPreDefined=%d\n",yytext,def ? 1 : 0, + // yyextra->includeStack.isEmpty(),yyextra->curlyCount,yyextra->macroExpansion,yyextra->expandOnlyPredef, + // def ? def->isPredefined : -1 + // ); + if ((yyextra->includeStack.isEmpty() || yyextra->curlyCount>0) && + yyextra->macroExpansion && + (def=yyextra->defineManager.isDefined(yytext)) && + /*(def->isPredefined || macroIsAccessible(def)) && */ + (!yyextra->expandOnlyPredef || def->isPredefined) + ) + { + //printf("Found it! #args=%d\n",def->nargs); + yyextra->roundCount=0; + yyextra->defArgsStr=yytext; + if (def->nargs==-1) // no function macro + { + QCString result = def->isPredefined ? def->definition : expandMacro(yyscanner,yyextra->defArgsStr); + outputArray(yyscanner,result,result.length()); + } + else // zero or more arguments + { + yyextra->findDefArgContext = CopyLine; + BEGIN(FindDefineArgs); + } + } + else + { + outputArray(yyscanner,yytext,(int)yyleng); + } + } +{ID} { + Define *def=0; + if ((yyextra->includeStack.isEmpty() || yyextra->curlyCount>0) && + yyextra->macroExpansion && + (def=yyextra->defineManager.isDefined(yytext)) && + def->nargs==-1 && + /*(def->isPredefined || macroIsAccessible(def)) &&*/ + (!yyextra->expandOnlyPredef || def->isPredefined) + ) + { + QCString result=def->isPredefined ? def->definition : expandMacro(yyscanner,yytext); + outputArray(yyscanner,result,result.length()); + } + else + { + outputArray(yyscanner,yytext,(int)yyleng); + } + } +"\\"\r?/\n { // strip line continuation characters + if (getLanguageFromFileName(yyextra->yyFileName)==SrcLangExt_Fortran) outputChar(yyscanner,*yytext); + } +. { + outputChar(yyscanner,*yytext); + } +\n { + outputChar(yyscanner,'\n'); + BEGIN(Start); + yyextra->yyLineNr++; + yyextra->yyColNr=1; + } +"(" { + yyextra->defArgsStr+='('; + yyextra->roundCount++; + } +")" { + yyextra->defArgsStr+=')'; + yyextra->roundCount--; + if (yyextra->roundCount==0) + { + QCString result=expandMacro(yyscanner,yyextra->defArgsStr); + //printf("yyextra->defArgsStr='%s'->'%s'\n",yyextra->defArgsStr.data(),result.data()); + if (yyextra->findDefArgContext==CopyLine) + { + outputArray(yyscanner,result,result.length()); + BEGIN(yyextra->findDefArgContext); + } + else // yyextra->findDefArgContext==IncludeID + { + readIncludeFile(yyscanner,result); + yyextra->nospaces=FALSE; + BEGIN(Start); + } + } + } + /* +")"{B}*"(" { + yyextra->defArgsStr+=yytext; + } + */ +{CHARLIT} { + yyextra->defArgsStr+=yytext; + } +"/*"[*]? { + yyextra->defArgsStr+=yytext; + BEGIN(ArgCopyCComment); + } +\" { + yyextra->defArgsStr+=*yytext; + BEGIN(ReadString); + } +' { + if (getLanguageFromFileName(yyextra->yyFileName)!=SrcLangExt_Fortran) REJECT; + yyextra->defArgsStr+=*yytext; + BEGIN(ReadString); + } +\n { + yyextra->defArgsStr+=' '; + yyextra->yyLineNr++; + outputChar(yyscanner,'\n'); + } +"@" { + yyextra->defArgsStr+="@@"; + } +. { + yyextra->defArgsStr+=*yytext; + } +[^*\n]+ { + yyextra->defArgsStr+=yytext; + } +"*/" { + yyextra->defArgsStr+=yytext; + BEGIN(FindDefineArgs); + } +\n { + yyextra->defArgsStr+=' '; + yyextra->yyLineNr++; + outputChar(yyscanner,'\n'); + } +. { + yyextra->defArgsStr+=yytext; + } +"\"" { + yyextra->defArgsStr+=*yytext; + BEGIN(FindDefineArgs); + } +"'" { + if (getLanguageFromFileName(yyextra->yyFileName)!=SrcLangExt_Fortran) REJECT; + yyextra->defArgsStr+=*yytext; + BEGIN(FindDefineArgs); + } "//"|"/*" { - g_defArgsStr+=yytext; + yyextra->defArgsStr+=yytext; } \\/\r?\n { // line continuation } \\. { - g_defArgsStr+=yytext; + yyextra->defArgsStr+=yytext; } . { - g_defArgsStr+=*yytext; + yyextra->defArgsStr+=*yytext; } ("include"|"import"){B}+/{ID} { - g_isImported = yytext[1]=='m'; - if (g_macroExpansion) + yyextra->isImported = yytext[1]=='m'; + if (yyextra->macroExpansion) BEGIN(IncludeID); } ("include"|"import"){B}*[<"] { - g_isImported = yytext[1]=='m'; + yyextra->isImported = yytext[1]=='m'; char c[2]; c[0]=yytext[yyleng-1];c[1]='\0'; - g_incName=c; + yyextra->incName=c; BEGIN(Include); } ("cmake")?"define"{B}+ { //printf("!!!DefName\n"); - g_yyColNr+=yyleng; + yyextra->yyColNr+=yyleng; BEGIN(DefName); } "ifdef"/{B}*"(" { - incrLevel(); - g_guardExpr.resize(0); + incrLevel(yyscanner); + yyextra->guardExpr.resize(0); BEGIN(DefinedExpr2); } "ifdef"/{B}+ { //printf("Pre.l: ifdef\n"); - incrLevel(); - g_guardExpr.resize(0); + incrLevel(yyscanner); + yyextra->guardExpr.resize(0); BEGIN(DefinedExpr1); } "ifndef"/{B}*"(" { - incrLevel(); - g_guardExpr="! "; + incrLevel(yyscanner); + yyextra->guardExpr="! "; BEGIN(DefinedExpr2); } "ifndef"/{B}+ { - incrLevel(); - g_guardExpr="! "; + incrLevel(yyscanner); + yyextra->guardExpr="! "; BEGIN(DefinedExpr1); } "if"/[ \t(!] { - incrLevel(); - g_guardExpr.resize(0); + incrLevel(yyscanner); + yyextra->guardExpr.resize(0); BEGIN(Guard); } ("elif"|"else"{B}*"if")/[ \t(!] { - if (!otherCaseDone()) + if (!otherCaseDone(yyscanner)) { - g_guardExpr.resize(0); + yyextra->guardExpr.resize(0); BEGIN(Guard); } else { - g_ifcount=0; + yyextra->ifcount=0; BEGIN(SkipCPPBlock); } } "else"/[^a-z_A-Z0-9\x80-\xFF] { - //printf("else g_levelGuard[%d]=%d\n",g_level-1,g_levelGuard[g_level-1]); - if (otherCaseDone()) + //printf("else yyextra->levelGuard[%d]=%d\n",yyextra->level-1,yyextra->levelGuard[yyextra->level-1]); + if (otherCaseDone(yyscanner)) { - g_ifcount=0; + yyextra->ifcount=0; BEGIN(SkipCPPBlock); } else { - setCaseDone(TRUE); - //g_levelGuard[g_level-1]=TRUE; + setCaseDone(yyscanner,TRUE); + //yyextra->levelGuard[yyextra->level-1]=TRUE; } } "undef"{B}+ { BEGIN(UndefName); } ("elif"|"else"{B}*"if")/[ \t(!] { - if (!otherCaseDone()) + if (!otherCaseDone(yyscanner)) { - g_guardExpr.resize(0); + yyextra->guardExpr.resize(0); BEGIN(Guard); } } "endif"/[^a-z_A-Z0-9\x80-\xFF] { //printf("Pre.l: #endif\n"); - decrLevel(); + decrLevel(yyscanner); } \n { - outputChar('\n'); + outputChar(yyscanner,'\n'); BEGIN(Start); - g_yyLineNr++; + yyextra->yyLineNr++; } "pragma"{B}+"once" { - g_expectGuard = FALSE; + yyextra->expectGuard = FALSE; } {ID} { // unknown directive BEGIN(IgnoreLine); } \\[\r]?\n { - outputChar('\n'); - g_yyLineNr++; + outputChar(yyscanner,'\n'); + yyextra->yyLineNr++; } . -. {g_yyColNr+=yyleng;} +. {yyextra->yyColNr+=yyleng;} {ID} { Define *def; - if ((def=DefineManager::instance().isDefined(yytext)) + if ((def=yyextra->defineManager.isDefined(yytext)) /*&& !def->isPredefined*/ && !def->nonRecursive ) @@ -2241,9 +888,9 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) BEGIN(Start); } \\[\r]?\n { - outputChar('\n'); - g_guardExpr+=' '; - g_yyLineNr++; + outputChar(yyscanner,'\n'); + yyextra->guardExpr+=' '; + yyextra->yyLineNr++; } "defined"/{B}*"(" { BEGIN(DefinedExpr2); @@ -2251,45 +898,45 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) "defined"/{B}+ { BEGIN(DefinedExpr1); } -{ID} { g_guardExpr+=yytext; } -"@" { g_guardExpr+="@@"; } -. { g_guardExpr+=*yytext; } +{ID} { yyextra->guardExpr+=yytext; } +"@" { yyextra->guardExpr+="@@"; } +. { yyextra->guardExpr+=*yytext; } \n { unput(*yytext); //printf("Guard: '%s'\n", - // g_guardExpr.data()); - bool guard=computeExpression(g_guardExpr); - setCaseDone(guard); - //printf("if g_levelGuard[%d]=%d\n",g_level-1,g_levelGuard[g_level-1]); + // yyextra->guardExpr.data()); + bool guard=computeExpression(yyscanner,yyextra->guardExpr); + setCaseDone(yyscanner,guard); + //printf("if yyextra->levelGuard[%d]=%d\n",yyextra->level-1,yyextra->levelGuard[yyextra->level-1]); if (guard) { BEGIN(Start); } else { - g_ifcount=0; + yyextra->ifcount=0; BEGIN(SkipCPPBlock); } } -\\\n { g_yyLineNr++; outputChar('\n'); } +\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); } {ID} { - if (DefineManager::instance().isDefined(yytext) || g_guardName==yytext) - g_guardExpr+=" 1L "; + if (yyextra->defineManager.isDefined(yytext) || yyextra->guardName==yytext) + yyextra->guardExpr+=" 1L "; else - g_guardExpr+=" 0L "; - g_lastGuardName=yytext; + yyextra->guardExpr+=" 0L "; + yyextra->lastGuardName=yytext; BEGIN(Guard); } {ID} { - if (DefineManager::instance().isDefined(yytext) || g_guardName==yytext) - g_guardExpr+=" 1L "; + if (yyextra->defineManager.isDefined(yytext) || yyextra->guardName==yytext) + yyextra->guardExpr+=" 1L "; else - g_guardExpr+=" 0L "; - g_lastGuardName=yytext; + yyextra->guardExpr+=" 0L "; + yyextra->lastGuardName=yytext; } \n { // should not happen, handle anyway - g_yyLineNr++; - g_ifcount=0; + yyextra->yyLineNr++; + yyextra->ifcount=0; BEGIN(SkipCPPBlock); } ")" { @@ -2298,29 +945,29 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) . ^{B}*"#" { BEGIN(SkipCommand); } ^{B}*/[^#] { BEGIN(SkipLine); } -\n { g_yyLineNr++; outputChar('\n'); } +\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); } . "if"(("n")?("def"))?/[ \t(!] { - incrLevel(); - g_ifcount++; - //printf("#if... depth=%d\n",g_ifcount); + incrLevel(yyscanner); + yyextra->ifcount++; + //printf("#if... depth=%d\n",yyextra->ifcount); } "else" { - //printf("Else! g_ifcount=%d otherCaseDone=%d\n",g_ifcount,otherCaseDone()); - if (g_ifcount==0 && !otherCaseDone()) + //printf("Else! yyextra->ifcount=%d otherCaseDone=%d\n",yyextra->ifcount,otherCaseDone()); + if (yyextra->ifcount==0 && !otherCaseDone(yyscanner)) { - setCaseDone(TRUE); - //outputChar('\n'); + setCaseDone(yyscanner,TRUE); + //outputChar(yyscanner,'\n'); BEGIN(Start); } } ("elif"|"else"{B}*"if")/[ \t(!] { - if (g_ifcount==0) + if (yyextra->ifcount==0) { - if (!otherCaseDone()) + if (!otherCaseDone(yyscanner)) { - g_guardExpr.resize(0); - g_lastGuardName.resize(0); + yyextra->guardExpr.resize(0); + yyextra->lastGuardName.resize(0); BEGIN(Guard); } else @@ -2330,17 +977,17 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } } "endif" { - g_expectGuard = FALSE; - decrLevel(); - if (--g_ifcount<0) + yyextra->expectGuard = FALSE; + decrLevel(yyscanner); + if (--yyextra->ifcount<0) { - //outputChar('\n'); + //outputChar(yyscanner,'\n'); BEGIN(Start); } } \n { - outputChar('\n'); - g_yyLineNr++; + outputChar(yyscanner,'\n'); + yyextra->yyLineNr++; BEGIN(SkipCPPBlock); } {ID} { // unknown directive @@ -2356,18 +1003,18 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) "//"/[^\n]* { } "//"[^\n]* { - g_lastCPPContext=YY_START; + yyextra->lastCPPContext=YY_START; BEGIN(RemoveCPPComment); } "/*"/[^\n]* { } "/*"/[^\n]* { - g_lastCContext=YY_START; + yyextra->lastCContext=YY_START; BEGIN(RemoveCComment); } \n { - outputChar('\n'); - g_yyLineNr++; + outputChar(yyscanner,'\n'); + yyextra->yyLineNr++; BEGIN(SkipCPPBlock); } [^"\\\n]+ { } @@ -2377,21 +1024,21 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } . { } {ID}{B}*/"(" { - g_nospaces=TRUE; - g_roundCount=0; - g_defArgsStr=yytext; - g_findDefArgContext = IncludeID; + yyextra->nospaces=TRUE; + yyextra->roundCount=0; + yyextra->defArgsStr=yytext; + yyextra->findDefArgContext = IncludeID; BEGIN(FindDefineArgs); } {ID} { - g_nospaces=TRUE; - readIncludeFile(expandMacro(yytext)); + yyextra->nospaces=TRUE; + readIncludeFile(yyscanner,expandMacro(yyscanner,yytext)); BEGIN(Start); } [^\">\n]+[\">] { - g_incName+=yytext; - readIncludeFile(g_incName); - if (g_isImported) + yyextra->incName+=yytext; + readIncludeFile(yyscanner,yyextra->incName); + if (yyextra->isImported) { BEGIN(EndImport); } @@ -2404,391 +1051,391 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) BEGIN(Start); } \\[\r]?"\n" { - outputChar('\n'); - g_yyLineNr++; + outputChar(yyscanner,'\n'); + yyextra->yyLineNr++; } . { } {ID}/("\\\n")*"(" { // define with argument //printf("Define() '%s'\n",yytext); - delete g_argDict; - g_argDict = new QDict(31); - g_argDict->setAutoDelete(TRUE); - g_defArgs = 0; - g_defArgsStr.resize(0); - g_defText.resize(0); - g_defLitText.resize(0); - g_defName = yytext; - g_defVarArgs = FALSE; - g_defExtraSpacing.resize(0); + delete yyextra->argDict; + yyextra->argDict = new QDict(31); + yyextra->argDict->setAutoDelete(TRUE); + yyextra->defArgs = 0; + yyextra->defArgsStr.resize(0); + yyextra->defText.resize(0); + yyextra->defLitText.resize(0); + yyextra->defName = yytext; + yyextra->defVarArgs = FALSE; + yyextra->defExtraSpacing.resize(0); BEGIN(DefineArg); } {ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard" //printf("Define '%s'\n",yytext); - delete g_argDict; g_argDict=0; - g_defArgs = -1; - g_defArgsStr.resize(0); - g_defName = yytext; - g_defName = g_defName.left(g_defName.length()-1).stripWhiteSpace(); - g_defVarArgs = FALSE; + delete yyextra->argDict; yyextra->argDict=0; + yyextra->defArgs = -1; + yyextra->defArgsStr.resize(0); + yyextra->defName = yytext; + yyextra->defName = yyextra->defName.left(yyextra->defName.length()-1).stripWhiteSpace(); + yyextra->defVarArgs = FALSE; //printf("Guard check: %s!=%s || %d\n", - // g_defName.data(),g_lastGuardName.data(),g_expectGuard); - if (g_curlyCount>0 || g_defName!=g_lastGuardName || !g_expectGuard) + // yyextra->defName.data(),yyextra->lastGuardName.data(),yyextra->expectGuard); + if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard) { // define may appear in the output - QCString tmp=(QCString)"#define "+g_defName; - outputArray(tmp.data(),tmp.length()); - g_quoteArg=FALSE; - g_insideComment=FALSE; - g_lastGuardName.resize(0); - g_defText="1"; - g_defLitText="1"; + QCString tmp=(QCString)"#define "+yyextra->defName; + outputArray(yyscanner,tmp.data(),tmp.length()); + yyextra->quoteArg=FALSE; + yyextra->insideComment=FALSE; + yyextra->lastGuardName.resize(0); + yyextra->defText="1"; + yyextra->defLitText="1"; BEGIN(DefineText); } else // define is a guard => hide { //printf("Found a guard %s\n",yytext); - g_defText.resize(0); - g_defLitText.resize(0); + yyextra->defText.resize(0); + yyextra->defLitText.resize(0); BEGIN(Start); } - g_expectGuard=FALSE; + yyextra->expectGuard=FALSE; } {ID}/{B}*"\n" { // empty define - delete g_argDict; g_argDict=0; - g_defArgs = -1; - g_defName = yytext; - g_defArgsStr.resize(0); - g_defText.resize(0); - g_defLitText.resize(0); - g_defVarArgs = FALSE; + delete yyextra->argDict; yyextra->argDict=0; + yyextra->defArgs = -1; + yyextra->defName = yytext; + yyextra->defArgsStr.resize(0); + yyextra->defText.resize(0); + yyextra->defLitText.resize(0); + yyextra->defVarArgs = FALSE; //printf("Guard check: %s!=%s || %d\n", - // g_defName.data(),g_lastGuardName.data(),g_expectGuard); - if (g_curlyCount>0 || g_defName!=g_lastGuardName || !g_expectGuard) + // yyextra->defName.data(),yyextra->lastGuardName.data(),yyextra->expectGuard); + if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard) { // define may appear in the output - QCString tmp=(QCString)"#define "+g_defName; - outputArray(tmp.data(),tmp.length()); - g_quoteArg=FALSE; - g_insideComment=FALSE; - if (g_insideCS) g_defText="1"; // for C#, use "1" as define text + QCString tmp=(QCString)"#define "+yyextra->defName; + outputArray(yyscanner,tmp.data(),tmp.length()); + yyextra->quoteArg=FALSE; + yyextra->insideComment=FALSE; + if (yyextra->insideCS) yyextra->defText="1"; // for C#, use "1" as define text BEGIN(DefineText); } else // define is a guard => hide { //printf("Found a guard %s\n",yytext); - g_guardName = yytext; - g_lastGuardName.resize(0); + yyextra->guardName = yytext; + yyextra->lastGuardName.resize(0); BEGIN(Start); } - g_expectGuard=FALSE; + yyextra->expectGuard=FALSE; } {ID}/{B}* { // define with content //printf("Define '%s'\n",yytext); - delete g_argDict; g_argDict=0; - g_defArgs = -1; - g_defArgsStr.resize(0); - g_defText.resize(0); - g_defLitText.resize(0); - g_defName = yytext; - g_defVarArgs = FALSE; - QCString tmp=(QCString)"#define "+g_defName+g_defArgsStr; - outputArray(tmp.data(),tmp.length()); - g_quoteArg=FALSE; - g_insideComment=FALSE; + delete yyextra->argDict; yyextra->argDict=0; + yyextra->defArgs = -1; + yyextra->defArgsStr.resize(0); + yyextra->defText.resize(0); + yyextra->defLitText.resize(0); + yyextra->defName = yytext; + yyextra->defVarArgs = FALSE; + QCString tmp=(QCString)"#define "+yyextra->defName+yyextra->defArgsStr; + outputArray(yyscanner,tmp.data(),tmp.length()); + yyextra->quoteArg=FALSE; + yyextra->insideComment=FALSE; BEGIN(DefineText); } "\\\n" { - g_defExtraSpacing+="\n"; - g_yyLineNr++; + yyextra->defExtraSpacing+="\n"; + yyextra->yyLineNr++; } -","{B}* { g_defArgsStr+=yytext; } -"("{B}* { g_defArgsStr+=yytext; } +","{B}* { yyextra->defArgsStr+=yytext; } +"("{B}* { yyextra->defArgsStr+=yytext; } {B}*")"{B}* { - g_defArgsStr+=yytext; - QCString tmp=(QCString)"#define "+g_defName+g_defArgsStr+g_defExtraSpacing; - outputArray(tmp.data(),tmp.length()); - g_quoteArg=FALSE; - g_insideComment=FALSE; + yyextra->defArgsStr+=yytext; + QCString tmp=(QCString)"#define "+yyextra->defName+yyextra->defArgsStr+yyextra->defExtraSpacing; + outputArray(yyscanner,tmp.data(),tmp.length()); + yyextra->quoteArg=FALSE; + yyextra->insideComment=FALSE; BEGIN(DefineText); } "..." { // Variadic macro - g_defVarArgs = TRUE; - g_defArgsStr+=yytext; - g_argDict->insert("__VA_ARGS__",new int(g_defArgs)); - g_defArgs++; + yyextra->defVarArgs = TRUE; + yyextra->defArgsStr+=yytext; + yyextra->argDict->insert("__VA_ARGS__",new int(yyextra->defArgs)); + yyextra->defArgs++; } {ID}{B}*("..."?) { //printf("Define addArg(%s)\n",yytext); QCString argName=yytext; - g_defVarArgs = yytext[yyleng-1]=='.'; - if (g_defVarArgs) // strip ellipsis + yyextra->defVarArgs = yytext[yyleng-1]=='.'; + if (yyextra->defVarArgs) // strip ellipsis { argName=argName.left(argName.length()-3); } argName = argName.stripWhiteSpace(); - g_defArgsStr+=yytext; - g_argDict->insert(argName,new int(g_defArgs)); - g_defArgs++; + yyextra->defArgsStr+=yytext; + yyextra->argDict->insert(argName,new int(yyextra->defArgs)); + yyextra->defArgs++; } /* "/ **"|"/ *!" { - g_defText+=yytext; - g_defLitText+=yytext; - g_insideComment=TRUE; + yyextra->defText+=yytext; + yyextra->defLitText+=yytext; + yyextra->insideComment=TRUE; } "* /" { - g_defText+=yytext; - g_defLitText+=yytext; - g_insideComment=FALSE; + yyextra->defText+=yytext; + yyextra->defLitText+=yytext; + yyextra->insideComment=FALSE; } */ "/*"[!*]? { - g_defText+=yytext; - g_defLitText+=yytext; - g_lastCContext=YY_START; - g_commentCount=1; + yyextra->defText+=yytext; + yyextra->defLitText+=yytext; + yyextra->lastCContext=YY_START; + yyextra->commentCount=1; BEGIN(CopyCComment); } "//"[!/]? { - outputArray(yytext,(int)yyleng); - g_lastCPPContext=YY_START; - g_defLitText+=' '; + outputArray(yyscanner,yytext,(int)yyleng); + yyextra->lastCPPContext=YY_START; + yyextra->defLitText+=' '; BEGIN(SkipCPPComment); } [/]?"*/" { - if (yytext[0]=='/') outputChar('/'); - outputChar('*');outputChar('/'); - if (--g_commentCount<=0) + if (yytext[0]=='/') outputChar(yyscanner,'/'); + outputChar(yyscanner,'*');outputChar(yyscanner,'/'); + if (--yyextra->commentCount<=0) { - if (g_lastCContext==Start) + if (yyextra->lastCContext==Start) // small hack to make sure that ^... rule will // match when going to Start... Example: "/*...*/ some stuff..." { YY_CURRENT_BUFFER->yy_at_bol=1; } - BEGIN(g_lastCContext); + BEGIN(yyextra->lastCContext); } } "//"("/")* { - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } "/*" { - outputChar('/');outputChar('*'); - //g_commentCount++; + outputChar(yyscanner,'/');outputChar(yyscanner,'*'); + //yyextra->commentCount++; } [\\@][\\@]("f{"|"f$"|"f[") { - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } ^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - static bool markdownSupport = Config_getBool(MARKDOWN_SUPPORT); + bool markdownSupport = Config_getBool(MARKDOWN_SUPPORT); if (!markdownSupport) { REJECT; } else { - outputArray(yytext,(int)yyleng); - g_fenceSize=yyleng; + outputArray(yyscanner,yytext,(int)yyleng); + yyextra->fenceSize=yyleng; BEGIN(SkipVerbatim); } } ^({B}*"*"+)?{B}{0,3}"```"[`]* { - static bool markdownSupport = Config_getBool(MARKDOWN_SUPPORT); + bool markdownSupport = Config_getBool(MARKDOWN_SUPPORT); if (!markdownSupport) { REJECT; } else { - outputArray(yytext,(int)yyleng); - g_fenceSize=yyleng; + outputArray(yyscanner,yytext,(int)yyleng); + yyextra->fenceSize=yyleng; BEGIN(SkipVerbatim); } } [\\@][\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"code"("{"[^}]*"}")?){BN}+ { - outputArray(yytext,(int)yyleng); - g_yyLineNr+=QCString(yytext).contains('\n'); + outputArray(yyscanner,yytext,(int)yyleng); + yyextra->yyLineNr+=QCString(yytext).contains('\n'); } [\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"code"("{"[^}]*"}")?){BN}+ { - outputArray(yytext,(int)yyleng); - g_yyLineNr+=QCString(yytext).contains('\n'); - g_fenceSize=0; + outputArray(yyscanner,yytext,(int)yyleng); + yyextra->yyLineNr+=QCString(yytext).contains('\n'); + yyextra->fenceSize=0; if (yytext[1]=='f') { - g_blockName="f"; + yyextra->blockName="f"; } else { QCString bn=&yytext[1]; int i = bn.find('{'); // for \code{.c} if (i!=-1) bn=bn.left(i); - g_blockName=bn.stripWhiteSpace(); + yyextra->blockName=bn.stripWhiteSpace(); } BEGIN(SkipVerbatim); } [\\@][\\@]"cond"[ \t]+ { // escaped @cond - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } [\\@]"cond"[ \t]+ { // conditional section - g_ccomment=TRUE; - g_condCtx=YY_START; + yyextra->ccomment=TRUE; + yyextra->condCtx=YY_START; BEGIN(CondLineCpp); } [\\@]"cond"[ \t]+ { // conditional section - g_ccomment=FALSE; - g_condCtx=YY_START; + yyextra->ccomment=FALSE; + yyextra->condCtx=YY_START; BEGIN(CondLineC); } [!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ { - startCondSection(yytext); - if (g_skip) + startCondSection(yyscanner,yytext); + if (yyextra->skip) { if (YY_START==CondLineC) { // end C comment - outputArray("*/",2); - g_ccomment=TRUE; + outputArray(yyscanner,"*/",2); + yyextra->ccomment=TRUE; } else { - g_ccomment=FALSE; + yyextra->ccomment=FALSE; } BEGIN(SkipCond); } else { - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } . { // non-guard character unput(*yytext); - startCondSection(" "); - if (g_skip) + startCondSection(yyscanner," "); + if (yyextra->skip) { if (YY_START==CondLineC) { // end C comment - outputArray("*/",2); - g_ccomment=TRUE; + outputArray(yyscanner,"*/",2); + yyextra->ccomment=TRUE; } else { - g_ccomment=FALSE; + yyextra->ccomment=FALSE; } BEGIN(SkipCond); } else { - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } [\\@]"cond"[ \t\r]*/\n { // no guard if (YY_START==SkipCComment) { - g_ccomment=TRUE; + yyextra->ccomment=TRUE; // end C comment - outputArray("*/",2); + outputArray(yyscanner,"*/",2); } else { - g_ccomment=FALSE; + yyextra->ccomment=FALSE; } - g_condCtx=YY_START; - startCondSection(" "); + yyextra->condCtx=YY_START; + startCondSection(yyscanner," "); BEGIN(SkipCond); } -\n { g_yyLineNr++; outputChar('\n'); } +\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); } . { } [^\/\!*\\@\n]+ { } -"//"[/!] { g_ccomment=FALSE; } -"/*"[*!] { g_ccomment=TRUE; } +"//"[/!] { yyextra->ccomment=FALSE; } +"/*"[*!] { yyextra->ccomment=TRUE; } [\\@][\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] { - if (!g_skip) + if (!yyextra->skip) { - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } } [\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] { - bool oldSkip = g_skip; - endCondSection(); - if (oldSkip && !g_skip) + bool oldSkip = yyextra->skip; + endCondSection(yyscanner); + if (oldSkip && !yyextra->skip) { - if (g_ccomment) + if (yyextra->ccomment) { - outputArray("/** ",4); + outputArray(yyscanner,"/** ",4); } - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } [\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] { - bool oldSkip = g_skip; - endCondSection(); - if (oldSkip && !g_skip) + bool oldSkip = yyextra->skip; + endCondSection(yyscanner); + if (oldSkip && !yyextra->skip) { - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}") { /* end of verbatim block */ - outputArray(yytext,(int)yyleng); - if (yytext[1]=='f' && g_blockName=="f") + outputArray(yyscanner,yytext,(int)yyleng); + if (yytext[1]=='f' && yyextra->blockName=="f") { BEGIN(SkipCComment); } - else if (&yytext[4]==g_blockName) + else if (&yytext[4]==yyextra->blockName) { BEGIN(SkipCComment); } } ^({B}*"*"+)?{B}{0,3}"~~~"[~]* { - outputArray(yytext,(int)yyleng); - if (g_fenceSize==yyleng) + outputArray(yyscanner,yytext,(int)yyleng); + if (yyextra->fenceSize==yyleng) { BEGIN(SkipCComment); } } ^({B}*"*"+)?{B}{0,3}"```"[`]* { - outputArray(yytext,(int)yyleng); - if (g_fenceSize==yyleng) + outputArray(yyscanner,yytext,(int)yyleng); + if (yyextra->fenceSize==yyleng) { BEGIN(SkipCComment); } } "*/"|"/*" { - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } [^*\\@\x06~`\n\/]+ { - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } \n { - g_yyLineNr++; - outputChar('\n'); + yyextra->yyLineNr++; + outputChar(yyscanner,'\n'); } . { - outputChar(*yytext); + outputChar(yyscanner,*yytext); } [^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] { - g_defLitText+=yytext; - g_defText+=escapeAt(yytext); + yyextra->defLitText+=yytext; + yyextra->defText+=escapeAt(yytext); } \\[\r]?\n { - g_defLitText+=yytext; - outputChar('\n'); - g_defText+=" "; - g_yyLineNr++; - g_yyMLines++; + yyextra->defLitText+=yytext; + outputChar(yyscanner,'\n'); + yyextra->defText+=" "; + yyextra->yyLineNr++; + yyextra->yyMLines++; } "*/" { - g_defLitText+=yytext; - g_defText+=yytext; - BEGIN(g_lastCContext); + yyextra->defLitText+=yytext; + yyextra->defText+=yytext; + BEGIN(yyextra->lastCContext); } \n { - g_yyLineNr++; - outputChar('\n'); - g_defLitText+=yytext; - g_defText+=' '; + yyextra->yyLineNr++; + outputChar(yyscanner,'\n'); + yyextra->defLitText+=yytext; + yyextra->defText+=' '; } "*/"{B}*"#" { // see bug 594021 for a usecase for this rule - if (g_lastCContext==SkipCPPBlock) + if (yyextra->lastCContext==SkipCPPBlock) { BEGIN(SkipCommand); } @@ -2797,246 +1444,1632 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) REJECT; } } -"*/" { BEGIN(g_lastCContext); } +"*/" { BEGIN(yyextra->lastCContext); } "//" "/*" [^*\x06\n]+ -\n { g_yyLineNr++; outputChar('\n'); } +\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); } . [^\n\/\\@]+ { - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } \n { unput(*yytext); - BEGIN(g_lastCPPContext); + BEGIN(yyextra->lastCPPContext); } "/*" { - outputChar('/');outputChar('*'); + outputChar(yyscanner,'/');outputChar(yyscanner,'*'); } "//" { - outputChar('/');outputChar('/'); + outputChar(yyscanner,'/');outputChar(yyscanner,'/'); } [^\x06\@\\\n]+ { - outputArray(yytext,(int)yyleng); + outputArray(yyscanner,yytext,(int)yyleng); } . { - outputChar(*yytext); + outputChar(yyscanner,*yytext); } "/*" "//" [^\x06\n]+ . "#" { - g_quoteArg=TRUE; - g_defLitText+=yytext; + yyextra->quoteArg=TRUE; + yyextra->defLitText+=yytext; } {ID} { - g_defLitText+=yytext; - if (g_quoteArg) + yyextra->defLitText+=yytext; + if (yyextra->quoteArg) { - g_defText+="\""; + yyextra->defText+="\""; } - if (g_defArgs>0) + if (yyextra->defArgs>0) { int *n; - if ((n=(*g_argDict)[yytext])) + if ((n=(*yyextra->argDict)[yytext])) { - //if (!g_quoteArg) g_defText+=' '; - g_defText+='@'; + //if (!yyextra->quoteArg) yyextra->defText+=' '; + yyextra->defText+='@'; QCString numStr; numStr.sprintf("%d",*n); - g_defText+=numStr; - //if (!g_quoteArg) g_defText+=' '; + yyextra->defText+=numStr; + //if (!yyextra->quoteArg) yyextra->defText+=' '; } else { - g_defText+=yytext; + yyextra->defText+=yytext; } } else { - g_defText+=yytext; + yyextra->defText+=yytext; } - if (g_quoteArg) + if (yyextra->quoteArg) { - g_defText+="\""; + yyextra->defText+="\""; } - g_quoteArg=FALSE; + yyextra->quoteArg=FALSE; } . { - g_defLitText+=yytext; - g_defText+=yytext; + yyextra->defLitText+=yytext; + yyextra->defText+=yytext; } \\[\r]?\n { - g_defLitText+=yytext; - outputChar('\n'); - g_defText += ' '; - g_yyLineNr++; - g_yyMLines++; + yyextra->defLitText+=yytext; + outputChar(yyscanner,'\n'); + yyextra->defText += ' '; + yyextra->yyLineNr++; + yyextra->yyMLines++; + } +\n { + QCString comment=extractTrailingComment(yyextra->defLitText); + yyextra->defLitText+=yytext; + if (!comment.isEmpty()) + { + outputArray(yyscanner,comment,comment.length()); + yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-comment.length()-1); + } + outputChar(yyscanner,'\n'); + Define *def=0; + //printf("Define name='%s' text='%s' litTexti='%s'\n",yyextra->defName.data(),yyextra->defText.data(),yyextra->defLitText.data()); + if (yyextra->includeStack.isEmpty() || yyextra->curlyCount>0) + { + addDefine(yyscanner); + } + def=yyextra->defineManager.isDefined(yyextra->defName); + if (def==0) // new define + { + //printf("new define '%s'!\n",yyextra->defName.data()); + Define *nd = newDefine(yyscanner); + yyextra->defineManager.addDefine(yyextra->yyFileName,nd); + + // also add it to the local file list if it is a source file + //if (yyextra->isSource && yyextra->includeStack.isEmpty()) + //{ + // yyextra->fileDefineDict->insert(yyextra->defName,nd); + //} + } + else if (def /*&& macroIsAccessible(def)*/) + // name already exists + { + //printf("existing define!\n"); + //printf("define found\n"); + if (def->undef) // undefined name + { + def->undef = FALSE; + def->name = yyextra->defName; + def->definition = yyextra->defText.stripWhiteSpace(); + def->nargs = yyextra->defArgs; + def->fileName = yyextra->yyFileName.copy(); + def->lineNr = yyextra->yyLineNr-yyextra->yyMLines; + def->columnNr = yyextra->yyColNr; + } + else + { + //printf("error: define %s is defined more than once!\n",yyextra->defName.data()); + } + } + delete yyextra->argDict; yyextra->argDict=0; + yyextra->yyLineNr++; + yyextra->yyColNr=1; + yyextra->lastGuardName.resize(0); + BEGIN(Start); + } +{B}* { yyextra->defText += ' '; yyextra->defLitText+=yytext; } +{B}*"##"{B}* { yyextra->defText += "##"; yyextra->defLitText+=yytext; } +"@" { yyextra->defText += "@@"; yyextra->defLitText+=yytext; } +\" { + yyextra->defText += *yytext; + yyextra->defLitText+=yytext; + if (!yyextra->insideComment) + { + BEGIN(SkipDoubleQuote); + } + } +\' { yyextra->defText += *yytext; + yyextra->defLitText+=yytext; + if (!yyextra->insideComment) + { + BEGIN(SkipSingleQuote); + } + } +"//"[/]? { yyextra->defText += yytext; yyextra->defLitText+=yytext; } +"/*" { yyextra->defText += yytext; yyextra->defLitText+=yytext; } +\" { + yyextra->defText += *yytext; yyextra->defLitText+=yytext; + BEGIN(DefineText); + } +\\. { + yyextra->defText += yytext; yyextra->defLitText+=yytext; + } +\' { + yyextra->defText += *yytext; yyextra->defLitText+=yytext; + BEGIN(DefineText); + } +. { yyextra->defText += *yytext; yyextra->defLitText+=yytext; } +. { yyextra->defText += *yytext; yyextra->defLitText+=yytext; } +. { yyextra->defText += *yytext; yyextra->defLitText+=yytext; } +<> { + DBG_CTX((stderr,"End of include file\n")); + //printf("Include stack depth=%d\n",yyextra->includeStack.count()); + if (yyextra->includeStack.isEmpty()) + { + DBG_CTX((stderr,"Terminating scanner!\n")); + yyterminate(); + } + else + { + FileState *fs=yyextra->includeStack.pop(); + //fileDefineCache->merge(yyextra->yyFileName,fs->fileName); + YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER; + yy_switch_to_buffer( fs->bufState, yyscanner ); + yy_delete_buffer( oldBuf, yyscanner ); + yyextra->yyLineNr = fs->lineNr; + //preYYin = fs->oldYYin; + yyextra->inputBuf = fs->oldFileBuf; + yyextra->inputBufPos = fs->oldFileBufPos; + yyextra->curlyCount = fs->curlyCount; + setFileName(yyscanner,fs->fileName); + DBG_CTX((stderr,"######## FileName %s\n",yyextra->yyFileName.data())); + + // Deal with file changes due to + // #include's within { .. } blocks + QCString lineStr(15+yyextra->yyFileName.length()); + lineStr.sprintf("# %d \"%s\" 2",yyextra->yyLineNr,yyextra->yyFileName.data()); + outputArray(yyscanner,lineStr.data(),lineStr.length()); + + delete fs; fs=0; + } + } +<*>"/*"/"*/" | +<*>"/*"[*]? { + if (YY_START==SkipVerbatim || YY_START==SkipCond) + { + REJECT; + } + else + { + outputArray(yyscanner,yytext,(int)yyleng); + yyextra->lastCContext=YY_START; + yyextra->commentCount=1; + if (yyleng==3) yyextra->lastGuardName.resize(0); // reset guard in case the #define is documented! + BEGIN(SkipCComment); + } + } +<*>"//"[/]? { + if (YY_START==SkipVerbatim || YY_START==SkipCond || getLanguageFromFileName(yyextra->yyFileName)==SrcLangExt_Fortran) + { + REJECT; + } + else + { + outputArray(yyscanner,yytext,(int)yyleng); + yyextra->lastCPPContext=YY_START; + if (yyleng==3) yyextra->lastGuardName.resize(0); // reset guard in case the #define is documented! + BEGIN(SkipCPPComment); + } + } +<*>\n { + outputChar(yyscanner,'\n'); + yyextra->yyLineNr++; } -\n { - QCString comment=extractTrailingComment(g_defLitText); - g_defLitText+=yytext; - if (!comment.isEmpty()) - { - outputArray(comment,comment.length()); - g_defLitText=g_defLitText.left(g_defLitText.length()-comment.length()-1); - } - outputChar('\n'); - Define *def=0; - //printf("Define name='%s' text='%s' litTexti='%s'\n",g_defName.data(),g_defText.data(),g_defLitText.data()); - if (g_includeStack.isEmpty() || g_curlyCount>0) - { - addDefine(); - } - def=DefineManager::instance().isDefined(g_defName); - if (def==0) // new define - { - //printf("new define '%s'!\n",g_defName.data()); - Define *nd = newDefine(); - DefineManager::instance().addDefine(g_yyFileName,nd); +<*>. { + yyextra->expectGuard = FALSE; + outputChar(yyscanner,*yytext); + } + +%% + +///////////////////////////////////////////////////////////////////////////////////// + +static int yyread(yyscan_t yyscanner,char *buf,int max_size) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + int bytesInBuf = state->inputBuf->curPos()-state->inputBufPos; + int bytesToCopy = QMIN(max_size,bytesInBuf); + memcpy(buf,state->inputBuf->data()+state->inputBufPos,bytesToCopy); + state->inputBufPos+=bytesToCopy; + return bytesToCopy; +} + +static void setFileName(yyscan_t yyscanner,const char *name) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + bool ambig; + QFileInfo fi(name); + state->yyFileName=fi.absFilePath().utf8(); + state->yyFileDef=findFileDef(Doxygen::inputNameDict,state->yyFileName,ambig); + if (state->yyFileDef==0) // if this is not an input file check if it is an + // include file + { + state->yyFileDef=findFileDef(Doxygen::includeNameDict,state->yyFileName,ambig); + } + //printf("setFileName(%s) state->yyFileName=%s state->yyFileDef=%p\n", + // name,state->yyFileName.data(),state->yyFileDef); + if (state->yyFileDef && state->yyFileDef->isReference()) state->yyFileDef=0; + state->insideCS = getLanguageFromFileName(state->yyFileName)==SrcLangExt_CSharp; + state->isSource = guessSection(state->yyFileName); +} + +static void incrLevel(yyscan_t yyscanner) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + state->level++; + state->levelGuard.resize(state->level); + state->levelGuard[state->level-1]=FALSE; + //printf("%s line %d: incrLevel %d\n",yyextra->yyFileName.data(),yyextra->yyLineNr,yyextra->level); +} + +static void decrLevel(yyscan_t yyscanner) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + //printf("%s line %d: decrLevel %d\n",state->yyFileName.data(),state->yyLineNr,state->level); + if (state->level > 0) + { + state->level--; + state->levelGuard.resize(state->level); + } + else + { + warn(state->yyFileName,state->yyLineNr,"More #endif's than #if's found.\n"); + } +} + +static bool otherCaseDone(yyscan_t yyscanner) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + if (state->level==0) + { + warn(state->yyFileName,state->yyLineNr,"Found an #else without a preceding #if.\n"); + return TRUE; + } + else + { + return state->levelGuard[state->level-1]; + } +} + +static void setCaseDone(yyscan_t yyscanner,bool value) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + state->levelGuard[state->level-1]=value; +} + + +static FileState *checkAndOpenFile(yyscan_t yyscanner,const QCString &fileName,bool &alreadyIncluded) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + alreadyIncluded = FALSE; + FileState *fs = 0; + //printf("checkAndOpenFile(%s)\n",fileName.data()); + QFileInfo fi(fileName); + if (fi.exists() && fi.isFile()) + { + const QStrList &exclPatterns = Config_getList(EXCLUDE_PATTERNS); + if (patternMatch(fi,&exclPatterns)) return 0; + + QCString absName = fi.absFilePath().utf8(); + + // global guard + if (state->curlyCount==0) // not #include inside { ... } + { + if (state->allIncludes.find(absName)!=0) + { + alreadyIncluded = TRUE; + //printf(" already included 1\n"); + return 0; // already done + } + state->allIncludes.insert(absName,(void *)0x8); + } + // check include stack for absName + + QStack tmpStack; + state->includeStack.setAutoDelete(FALSE); + while ((fs=state->includeStack.pop())) + { + if (fs->fileName==absName) alreadyIncluded=TRUE; + tmpStack.push(fs); + } + while ((fs=tmpStack.pop())) + { + state->includeStack.push(fs); + } + state->includeStack.setAutoDelete(TRUE); + + if (alreadyIncluded) + { + //printf(" already included 2\n"); + return 0; + } + //printf("#include %s\n",absName.data()); + + fs = new FileState(fi.size()+4096); + alreadyIncluded = FALSE; + if (!readInputFile(absName,fs->fileBuf)) + { // error + //printf(" error reading\n"); + delete fs; + fs=0; + } + else + { + fs->oldFileBuf = state->inputBuf; + fs->oldFileBufPos = state->inputBufPos; + } + } + return fs; +} + +static FileState *findFile(yyscan_t yyscanner, const char *fileName,bool localInclude,bool &alreadyIncluded) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + //printf("** findFile(%s,%d) state->yyFileName=%s\n",fileName,localInclude,state->yyFileName.data()); + if (portable_isAbsolutePath(fileName)) + { + FileState *fs = checkAndOpenFile(yyscanner,fileName,alreadyIncluded); + if (fs) + { + setFileName(yyscanner,fileName); + state->yyLineNr=1; + return fs; + } + else if (alreadyIncluded) + { + return 0; + } + } + if (localInclude && !state->yyFileName.isEmpty()) + { + QFileInfo fi(state->yyFileName); + if (fi.exists()) + { + QCString absName = QCString(fi.dirPath(TRUE).data())+"/"+fileName; + FileState *fs = checkAndOpenFile(yyscanner,absName,alreadyIncluded); + if (fs) + { + setFileName(yyscanner,absName); + state->yyLineNr=1; + return fs; + } + else if (alreadyIncluded) + { + return 0; + } + } + } + if (state->pathList==0) + { + return 0; + } + char *s=state->pathList->first(); + while (s) + { + QCString absName = (QCString)s+"/"+fileName; + //printf(" Looking for %s in %s\n",fileName,s); + FileState *fs = checkAndOpenFile(yyscanner,absName,alreadyIncluded); + if (fs) + { + setFileName(yyscanner,absName); + state->yyLineNr=1; + //printf(" -> found it\n"); + return fs; + } + else if (alreadyIncluded) + { + return 0; + } + + s=state->pathList->next(); + } + return 0; +} + +static QCString extractTrailingComment(const char *s) +{ + if (s==0) return ""; + int i=strlen(s)-1; + while (i>=0) + { + char c=s[i]; + switch (c) + { + case '/': + { + i--; + if (i>=0 && s[i]=='*') // end of a comment block + { + i--; + while (i>0 && !(s[i-1]=='/' && s[i]=='*')) i--; + if (i==0) + { + i++; + } + // only /*!< or /**< are treated as a comment for the macro name, + // otherwise the comment is treated as part of the macro definition + return ((s[i+1]=='*' || s[i+1]=='!') && s[i+2]=='<') ? &s[i-1] : ""; + } + else + { + return ""; + } + } + break; + // whitespace or line-continuation + case ' ': + case '\t': + case '\r': + case '\n': + case '\\': + break; + default: + return ""; + } + i--; + } + return ""; +} + +static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos); +static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint pos); +static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos,char c); +static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos); + +static QCString stringize(const QCString &s) +{ + QCString result; + uint i=0; + bool inString=FALSE; + bool inChar=FALSE; + char c,pc; + while (i'%s'\n",s.data(),result.data()); + return result; +} + +/*! Execute all ## operators in expr. + * If the macro name before or after the operator contains a no-rescan + * marker (@-) then this is removed (before the concatenated macro name + * may be expanded again. + */ +static void processConcatOperators(QCString &expr) +{ + //printf("processConcatOperators: in='%s'\n",expr.data()); + QRegExp r("[ \\t\\n]*##[ \\t\\n]*"); + int l,n,i=0; + if (expr.isEmpty()) return; + while ((n=r.match(expr,i,&l))!=-1) + { + //printf("Match: '%s'\n",expr.data()+i); + if (n+l+1<(int)expr.length() && expr.at(n+l)=='@' && expr.at(n+l+1)=='-') + { + // remove no-rescan marker after ID + l+=2; + } + //printf("found '%s'\n",expr.mid(n,l).data()); + // remove the ## operator and the surrounding whitespace + expr=expr.left(n)+expr.right(expr.length()-n-l); + int k=n-1; + while (k>=0 && isId(expr.at(k))) k--; + if (k>0 && expr.at(k)=='-' && expr.at(k-1)=='@') + { + // remove no-rescan marker before ID + expr=expr.left(k-1)+expr.right(expr.length()-k-1); + n-=2; + } + i=n; + } + //printf("processConcatOperators: out='%s'\n",expr.data()); +} + +static void returnCharToStream(yyscan_t yyscanner,char c) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + unput(c); +} + +static inline void addTillEndOfString(yyscan_t yyscanner,const QCString &expr,QCString *rest, + uint &pos,char term,QCString &arg) +{ + int cc; + while ((cc=getNextChar(yyscanner,expr,rest,pos))!=EOF && cc!=0) + { + if (cc=='\\') arg+=(char)cc,cc=getNextChar(yyscanner,expr,rest,pos); + else if (cc==term) return; + arg+=(char)cc; + } +} + +/*! replaces the function macro \a def whose argument list starts at + * \a pos in expression \a expr. + * Notice that this routine may scan beyond the \a expr string if needed. + * In that case the characters will be read from the input file. + * The replacement string will be returned in \a result and the + * length of the (unexpanded) argument list is stored in \a len. + */ +static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + //printf("replaceFunctionMacro(expr=%s,rest=%s,pos=%d,def=%s) level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->level); + uint j=pos; + len=0; + result.resize(0); + int cc; + while ((cc=getCurrentChar(yyscanner,expr,rest,j))!=EOF && isspace(cc)) + { + len++; + getNextChar(yyscanner,expr,rest,j); + } + if (cc!='(') + { + unputChar(yyscanner,expr,rest,j,' '); + return FALSE; + } + getNextChar(yyscanner,expr,rest,j); // eat the '(' character + + QDict argTable; // list of arguments + argTable.setAutoDelete(TRUE); + QCString arg; + int argCount=0; + bool done=FALSE; + + // PHASE 1: read the macro arguments + if (def->nargs==0) + { + while ((cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) + { + char c = (char)cc; + if (c==')') break; + } + } + else + { + while (!done && (argCountnargs || def->varArgs) && + ((cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) + ) + { + char c=(char)cc; + if (c=='(') // argument is a function => search for matching ) + { + int level=1; + arg+=c; + //char term='\0'; + while ((cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) + { + char c=(char)cc; + //printf("processing %c: term=%c (%d)\n",c,term,term); + if (c=='\'' || c=='\"') // skip ('s and )'s inside strings + { + arg+=c; + addTillEndOfString(yyscanner,expr,rest,j,c,arg); + } + if (c==')') + { + level--; + arg+=c; + if (level==0) break; + } + else if (c=='(') + { + level++; + arg+=c; + } + else + arg+=c; + } + } + else if (c==')' || c==',') // last or next argument found + { + if (c==',' && argCount==def->nargs-1 && def->varArgs) + { + arg=arg.stripWhiteSpace(); + arg+=','; + } + else + { + QCString argKey; + argKey.sprintf("@%d",argCount++); // key name + arg=arg.stripWhiteSpace(); + // add argument to the lookup table + argTable.insert(argKey, new QCString(arg)); + arg.resize(0); + if (c==')') // end of the argument list + { + done=TRUE; + } + } + } + else if (c=='\"') // append literal strings + { + arg+=c; + bool found=FALSE; + while (!found && (cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) + { + found = cc=='"'; + if (cc=='\\') + { + c=(char)cc; + arg+=c; + if ((cc=getNextChar(yyscanner,expr,rest,j))==EOF || cc==0) break; + } + c=(char)cc; + arg+=c; + } + } + else if (c=='\'') // append literal characters + { + arg+=c; + bool found=FALSE; + while (!found && (cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) + { + found = cc=='\''; + if (cc=='\\') + { + c=(char)cc; + arg+=c; + if ((cc=getNextChar(yyscanner,expr,rest,j))==EOF || cc==0) break; + } + c=(char)cc; + arg+=c; + } + } + else if (c=='/') // possible start of a comment + { + char prevChar = '\0'; + arg+=c; + if ((cc=getCurrentChar(yyscanner,expr,rest,j)) == '*') // we have a comment + { + while ((cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) + { + c=(char)cc; + arg+=c; + if (c == '/' && prevChar == '*') break; // we have an end of comment + prevChar = c; + } + } + } + else // append other characters + { + arg+=c; + } + } + } + + // PHASE 2: apply the macro function + if (argCount==def->nargs || // same number of arguments + (argCount>=def->nargs-1 && def->varArgs)) // variadic macro with at least as many + // params as the non-variadic part (see bug731985) + { + uint k=0; + // substitution of all formal arguments + QCString resExpr; + const QCString d=def->definition.stripWhiteSpace(); + //printf("Macro definition: %s\n",d.data()); + bool inString=FALSE; + while (k copy it (is unescaped later) + { + k+=2; + resExpr+="@@"; // we unescape these later + } + else if (d.at(k+1)=='-') // no-rescan marker + { + k+=2; + resExpr+="@-"; + } + else // argument marker => read the argument number + { + QCString key="@"; + QCString *subst=0; + bool hash=FALSE; + int l=k-1; + // search for ## backward + if (l>=0 && d.at(l)=='"') l--; + while (l>=0 && d.at(l)==' ') l--; + if (l>0 && d.at(l)=='#' && d.at(l-1)=='#') hash=TRUE; + k++; + // scan the number + while (k='0' && d.at(k)<='9') key+=d.at(k++); + if (!hash) + { + // search for ## forward + l=k; + if (l<(int)d.length() && d.at(l)=='"') l++; + while (l<(int)d.length() && d.at(l)==' ') l++; + if (l<(int)d.length()-1 && d.at(l)=='#' && d.at(l+1)=='#') hash=TRUE; + } + //printf("request key %s result %s\n",key.data(),argTable[key]->data()); + if (key.length()>1 && (subst=argTable[key])) + { + QCString substArg=*subst; + //printf("substArg='%s'\n",substArg.data()); + // only if no ## operator is before or after the argument + // marker we do macro expansion. + if (!hash) expandExpression(yyscanner,substArg,0,0); + if (inString) + { + //printf("'%s'=stringize('%s')\n",stringize(*subst).data(),subst->data()); + + // if the marker is inside a string (because a # was put + // before the macro name) we must escape " and \ characters + resExpr+=stringize(substArg); + } + else + { + if (hash && substArg.isEmpty()) + { + resExpr+="@E"; // empty argument will be remove later on + } + else if (state->nospaces) + { + resExpr+=substArg; + } + else + { + resExpr+=" "+substArg+" "; + } + } + } + } + } + else // no marker, just copy + { + if (!inString && d.at(k)=='\"') + { + inString=TRUE; // entering a literal string + } + else if (inString && d.at(k)=='\"' && (d.at(k-1)!='\\' || d.at(k-2)=='\\')) + { + inString=FALSE; // leaving a literal string + } + resExpr+=d.at(k++); + } + } + len=j-pos; + result=resExpr; + //printf("result after substitution '%s' expr='%s'\n", + // result.data(),expr.mid(pos,len).data()); + return TRUE; + } + return FALSE; +} + + +/*! returns the next identifier in string \a expr by starting at position \a p. + * The position of the identifier is returned (or -1 if nothing is found) + * and \a l is its length. Any quoted strings are skipping during the search. + */ +static int getNextId(const QCString &expr,int p,int *l) +{ + int n; + while (p<(int)expr.length()) + { + char c=expr.at(p++); + if (isdigit(c)) // skip number + { + while (p<(int)expr.length() && isId(expr.at(p))) p++; + } + else if (isalpha(c) || c=='_') // read id + { + n=p-1; + while (p<(int)expr.length() && isId(expr.at(p))) p++; + *l=p-n; + return n; + } + else if (c=='"') // skip string + { + char ppc=0,pc=c; + if (p<(int)expr.length()) c=expr.at(p); + while (p<(int)expr.length() && (c!='"' || (pc=='\\' && ppc!='\\'))) + // continue as long as no " is found, but ignoring \", but not \\" + { + ppc=pc; + pc=c; + c=expr.at(p); + p++; + } + if (p<(int)expr.length()) ++p; // skip closing quote + } + else if (c=='/') // skip C Comment + { + //printf("Found C comment at p=%d\n",p); + char pc=c; + if (p<(int)expr.length()) + { + c=expr.at(p); + if (c=='*') // Start of C comment + { + p++; + while (p<(int)expr.length() && !(pc=='*' && c=='/')) + { + pc=c; + c=expr.at(p++); + } + } + } + //printf("Found end of C comment at p=%d\n",p); + } + } + return -1; +} + +/*! performs recursive macro expansion on the string \a expr + * starting at position \a pos. + * May read additional characters from the input while re-scanning! + * If \a expandAll is \c TRUE then all macros in the expression are + * expanded, otherwise only the first is expanded. + */ +static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + //printf("expandExpression(%s,%s)\n",expr.data(),rest ? rest->data() : 0); + QCString macroName; + QCString expMacro; + bool definedTest=FALSE; + int i=pos,l,p,len; + while ((p=getNextId(expr,i,&l))!=-1) // search for an macro name + { + bool replaced=FALSE; + macroName=expr.mid(p,l); + //printf("macroName=%s\n",macroName.data()); + if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker? + { + if (state->expandedDict->find(macroName)==0) // expand macro + { + Define *def=state->defineManager.isDefined(macroName); + if (macroName=="defined") + { + //printf("found defined inside macro definition '%s'\n",expr.right(expr.length()-p).data()); + definedTest=TRUE; + } + else if (definedTest) // macro name was found after defined + { + if (def) expMacro = " 1 "; else expMacro = " 0 "; + replaced=TRUE; + len=l; + definedTest=FALSE; + } + else if (def && def->nargs==-1) // simple macro + { + // substitute the definition of the macro + //printf("macro '%s'->'%s'\n",macroName.data(),def->definition.data()); + if (state->nospaces) + { + expMacro=def->definition.stripWhiteSpace(); + } + else + { + expMacro=" "+def->definition.stripWhiteSpace()+" "; + } + //expMacro=def->definition.stripWhiteSpace(); + replaced=TRUE; + len=l; + //printf("simple macro expansion='%s'->'%s'\n",macroName.data(),expMacro.data()); + } + else if (def && def->nargs>=0) // function macro + { + replaced=replaceFunctionMacro(yyscanner,expr,rest,p+l,len,def,expMacro); + len+=l; + } + + if (replaced) // expand the macro and rescan the expression + { + //printf("replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data()); + QCString resultExpr=expMacro; + QCString restExpr=expr.right(expr.length()-len-p); + processConcatOperators(resultExpr); + if (def && !def->nonRecursive) + { + state->expandedDict->insert(macroName,def); + expandExpression(yyscanner,resultExpr,&restExpr,0); + state->expandedDict->remove(macroName); + } + expr=expr.left(p)+resultExpr+restExpr; + i=p; + //printf("new expression: %s\n",expr.data()); + } + else // move to the next macro name + { + //printf("moving to the next macro old=%d new=%d\n",i,p+l); + i=p+l; + } + } + else // move to the next macro name + { + expr=expr.left(p)+"@-"+expr.right(expr.length()-p); + //printf("macro already expanded, moving to the next macro expr=%s\n",expr.data()); + i=p+l+2; + //i=p+l; + } + } + else // no re-scan marker found, skip the macro name + { + //printf("skipping marked macro\n"); + i=p+l; + } + } +} + +/*! @brief Process string or character literal. + * + * \a inputStr should point to the start of a string or character literal. + * the routine will return a pointer to just after the end of the literal + * the character making up the literal will be added to \a result. + */ +static const char *processUntilMatchingTerminator(const char *inputStr,QCString &result) +{ + if (inputStr==0) return inputStr; + char term = *inputStr; // capture start character of the literal + if (term!='\'' && term!='"') return inputStr; // not a valid literal + char c=term; + // output start character + result+=c; + inputStr++; + while ((c=*inputStr)) // while inside the literal + { + if (c==term) // found end marker of the literal + { + // output end character and stop + result+=c; + inputStr++; + break; + } + else if (c=='\\') // escaped character, process next character + // as well without checking for end marker. + { + result+=c; + inputStr++; + c=*inputStr; + if (c==0) break; // unexpected end of string after escape character + } + result+=c; + inputStr++; + } + return inputStr; +} + +/*! replaces all occurrences of @@@@ in \a s by @@ + * and removes all occurrences of @@E. + * All identifiers found are replaced by 0L + */ +static QCString removeIdsAndMarkers(const char *s) +{ + //printf("removeIdsAndMarkers(%s)\n",s); + const char *p=s; + char c; + bool inNum=FALSE; + QCString result; + if (p) + { + while ((c=*p)) + { + if (c=='@') // replace @@ with @ and remove @E + { + if (*(p+1)=='@') + { + result+=c; + } + else if (*(p+1)=='E') + { + // skip + } + p+=2; + } + else if (isdigit(c)) // number + { + result+=c; + p++; + inNum=TRUE; + } + else if (c=='\'') // quoted character + { + p = processUntilMatchingTerminator(p,result); + } + else if (c=='d' && !inNum) // identifier starting with a 'd' + { + if (qstrncmp(p,"defined ",8)==0 || qstrncmp(p,"defined(",8)==0) + // defined keyword + { + p+=7; // skip defined + } + else + { + result+="0L"; + p++; + while ((c=*p) && isId(c)) p++; + } + } + else if ((isalpha(c) || c=='_') && !inNum) // replace identifier with 0L + { + result+="0L"; + p++; + while ((c=*p) && isId(c)) p++; + while ((c=*p) && isspace((uchar)c)) p++; + if (*p=='(') // undefined function macro + { + p++; + int count=1; + while ((c=*p++)) + { + if (c=='(') count++; + else if (c==')') + { + count--; + if (count==0) break; + } + else if (c=='/') + { + char pc=c; + c=*++p; + if (c=='*') // start of C comment + { + while (*p && !(pc=='*' && c=='/')) // search end of comment + { + pc=c; + c=*++p; + } + p++; + } + } + } + } + } + else if (c=='/') // skip C comments + { + char pc=c; + c=*++p; + if (c=='*') // start of C comment + { + while (*p && !(pc=='*' && c=='/')) // search end of comment + { + pc=c; + c=*++p; + } + p++; + } + else // oops, not comment but division + { + result+=pc; + goto nextChar; + } + } + else + { +nextChar: + result+=c; + char lc=tolower(c); + if (!isId(lc) && lc!='.' /*&& lc!='-' && lc!='+'*/) inNum=FALSE; + p++; + } + } + } + //printf("removeIdsAndMarkers(%s)=%s\n",s,result.data()); + return result; +} + +/*! replaces all occurrences of @@ in \a s by @ + * \par assumption: + * \a s only contains pairs of @@'s + */ +static QCString removeMarkers(const char *s) +{ + const char *p=s; + char c; + QCString result; + if (p) + { + while ((c=*p)) + { + switch(c) + { + case '@': // replace @@ with @ + { + if (*(p+1)=='@') + { + result+=c; + } + p+=2; + } + break; + case '/': // skip C comments + { + result+=c; + char pc=c; + c=*++p; + if (c=='*') // start of C comment + { + while (*p && !(pc=='*' && c=='/')) // search end of comment + { + if (*p=='@' && *(p+1)=='@') + result+=c,p++; + else + result+=c; + pc=c; + c=*++p; + } + if (*p) result+=c,p++; + } + } + break; + case '"': // skip string literals + case '\'': // skip char literals + p = processUntilMatchingTerminator(p,result); + break; + default: + { + result+=c; + p++; + } + break; + } + } + } + //printf("RemoveMarkers(%s)=%s\n",s,result.data()); + return result; +} + +/*! compute the value of the expression in string \a expr. + * If needed the function may read additional characters from the input. + */ + +static bool computeExpression(yyscan_t yyscanner,const QCString &expr) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + QCString e=expr; + expandExpression(yyscanner,e,0,0); + //printf("after expansion '%s'\n",e.data()); + e = removeIdsAndMarkers(e); + if (e.isEmpty()) return FALSE; + //printf("parsing '%s'\n",e.data()); + return parseconstexp(state->yyFileName,state->yyLineNr,e); +} + +/*! expands the macro definition in \a name + * If needed the function may read additional characters from the input + */ + +static QCString expandMacro(yyscan_t yyscanner,const QCString &name) +{ + QCString n=name; + expandExpression(yyscanner,n,0,0); + n=removeMarkers(n); + //printf("expandMacro '%s'->'%s'\n",name.data(),n.data()); + return n; +} + +static Define *newDefine(yyscan_t yyscanner) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + Define *def=new Define; + def->name = state->defName; + def->definition = state->defText.stripWhiteSpace(); + def->nargs = state->defArgs; + def->fileName = state->yyFileName; + def->fileDef = state->yyFileDef; + def->lineNr = state->yyLineNr-state->yyMLines; + def->columnNr = state->yyColNr; + def->varArgs = state->defVarArgs; + //printf("newDefine: %s %s file: %s\n",def->name.data(),def->definition.data(), + // def->fileDef ? def->fileDef->name().data() : def->fileName.data()); + //printf("newDefine: '%s'->'%s'\n",def->name.data(),def->definition.data()); + if (!def->name.isEmpty() && Doxygen::expandAsDefinedDict[def->name]) + { + def->isPredefined=TRUE; + } + return def; +} + +static void addDefine(yyscan_t yyscanner) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + if (state->skip) return; // do not add this define as it is inside a + // conditional section (cond command) that is disabled. + if (!Doxygen::gatherDefines) return; + + //printf("addDefine %s %s\n",state->defName.data(),state->defArgsStr.data()); + //ArgumentList *al = new ArgumentList; + //stringToArgumentList(state->defArgsStr,al); + MemberDef *md=createMemberDef( + state->yyFileName,state->yyLineNr-state->yyMLines,state->yyColNr, + "#define",state->defName,state->defArgsStr,0, + Public,Normal,FALSE,Member,MemberType_Define,ArgumentList(),ArgumentList(),""); + if (!state->defArgsStr.isEmpty()) + { + ArgumentList argList; + //printf("addDefine() state->defName='%s' state->defArgsStr='%s'\n",state->defName.data(),state->defArgsStr.data()); + stringToArgumentList(state->defArgsStr,argList); + md->setArgumentList(argList); + } + //printf("Setting initializer for '%s' to '%s'\n",state->defName.data(),state->defText.data()); + int l=state->defLitText.find('\n'); + if (l>0 && state->defLitText.left(l).stripWhiteSpace()=="\\") + { + // strip first line if it only contains a slash + state->defLitText = state->defLitText.right(state->defLitText.length()-l-1); + } + else if (l>0) + { + // align the items on the first line with the items on the second line + int k=l+1; + const char *p=state->defLitText.data()+k; + char c; + while ((c=*p++) && (c==' ' || c=='\t')) k++; + state->defLitText=state->defLitText.mid(l+1,k-l-1)+state->defLitText.stripWhiteSpace(); + } + md->setInitializer(state->defLitText.stripWhiteSpace()); + + //printf("pre.l: md->setFileDef(%p)\n",state->inputFileDef); + md->setFileDef(state->inputFileDef); + md->setDefinition("#define "+state->defName); + + MemberName *mn=Doxygen::functionNameSDict->find(state->defName); + if (mn==0) + { + mn = new MemberName(state->defName); + Doxygen::functionNameSDict->append(state->defName,mn); + } + mn->append(md); + if (state->yyFileDef) + { + state->yyFileDef->insertMember(md); + } + + //Define *d; + //if ((d=defineDict[state->defName])==0) defineDict.insert(state->defName,newDefine()); +} + +static inline void outputChar(yyscan_t yyscanner,char c) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + if (state->includeStack.isEmpty() || state->curlyCount>0) state->outputBuf->addChar(c); +} + +static inline void outputArray(yyscan_t yyscanner,const char *a,int len) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + if (state->includeStack.isEmpty() || state->curlyCount>0) state->outputBuf->addArray(a,len); +} + +static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + static bool searchIncludes = Config_getBool(SEARCH_INCLUDES); + uint i=0; + + // find the start of the include file name + while (i0 && inc.at(s-1)=='"'; + + // find the end of the include file name + while (is) // valid include file name found + { + // extract include path+name + QCString incFileName=inc.mid(s,i-s).stripWhiteSpace(); + + QCString dosExt = incFileName.right(4); + if (dosExt==".exe" || dosExt==".dll" || dosExt==".tlb") + { + // skip imported binary files (e.g. M$ type libraries) + return; + } + + QCString oldFileName = state->yyFileName; + FileDef *oldFileDef = state->yyFileDef; + int oldLineNr = state->yyLineNr; + //printf("Searching for '%s'\n",incFileName.data()); + + // absIncFileName avoids difficulties for incFileName starting with "../" (bug 641336) + QCString absIncFileName = incFileName; + { + QFileInfo fi(state->yyFileName); + if (fi.exists()) + { + QCString absName = QCString(fi.dirPath(TRUE).data())+"/"+incFileName; + QFileInfo fi2(absName); + if (fi2.exists()) + { + absIncFileName=fi2.absFilePath().utf8(); + } + else if (searchIncludes) // search in INCLUDE_PATH as well + { + QStrList &includePath = Config_getList(INCLUDE_PATH); + char *s=includePath.first(); + while (s) + { + QFileInfo fi(s); + if (fi.exists() && fi.isDir()) + { + QCString absName = QCString(fi.absFilePath().utf8())+"/"+incFileName; + //printf("trying absName=%s\n",absName.data()); + QFileInfo fi2(absName); + if (fi2.exists()) + { + absIncFileName=fi2.absFilePath().utf8(); + break; + } + //printf( "absIncFileName = %s\n", absIncFileName.data() ); + } + s=includePath.next(); + } + } + //printf( "absIncFileName = %s\n", absIncFileName.data() ); + } + } + state->defineManager.addInclude(state->yyFileName,absIncFileName); + state->defineManager.addFileToContext(absIncFileName); - // also add it to the local file list if it is a source file - //if (g_isSource && g_includeStack.isEmpty()) - //{ - // g_fileDefineDict->insert(g_defName,nd); - //} - } - else if (def /*&& macroIsAccessible(def)*/) - // name already exists - { - //printf("existing define!\n"); - //printf("define found\n"); - if (def->undef) // undefined name - { - def->undef = FALSE; - def->name = g_defName; - def->definition = g_defText.stripWhiteSpace(); - def->nargs = g_defArgs; - def->fileName = g_yyFileName.copy(); - def->lineNr = g_yyLineNr-g_yyMLines; - def->columnNr = g_yyColNr; - } - else - { - //printf("error: define %s is defined more than once!\n",g_defName.data()); - } - } - delete g_argDict; g_argDict=0; - g_yyLineNr++; - g_yyColNr=1; - g_lastGuardName.resize(0); - BEGIN(Start); - } -{B}* { g_defText += ' '; g_defLitText+=yytext; } -{B}*"##"{B}* { g_defText += "##"; g_defLitText+=yytext; } -"@" { g_defText += "@@"; g_defLitText+=yytext; } -\" { - g_defText += *yytext; - g_defLitText+=yytext; - if (!g_insideComment) - { - BEGIN(SkipDoubleQuote); - } - } -\' { g_defText += *yytext; - g_defLitText+=yytext; - if (!g_insideComment) - { - BEGIN(SkipSingleQuote); - } - } -"//"[/]? { g_defText += yytext; g_defLitText+=yytext; } -"/*" { g_defText += yytext; g_defLitText+=yytext; } -\" { - g_defText += *yytext; g_defLitText+=yytext; - BEGIN(DefineText); - } -\\. { - g_defText += yytext; g_defLitText+=yytext; - } -\' { - g_defText += *yytext; g_defLitText+=yytext; - BEGIN(DefineText); - } -. { g_defText += *yytext; g_defLitText+=yytext; } -. { g_defText += *yytext; g_defLitText+=yytext; } -. { g_defText += *yytext; g_defLitText+=yytext; } -<> { - DBG_CTX((stderr,"End of include file\n")); - //printf("Include stack depth=%d\n",g_includeStack.count()); - if (g_includeStack.isEmpty()) - { - DBG_CTX((stderr,"Terminating scanner!\n")); - yyterminate(); - } - else - { - FileState *fs=g_includeStack.pop(); - //fileDefineCache->merge(g_yyFileName,fs->fileName); - YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER; - yy_switch_to_buffer( fs->bufState ); - yy_delete_buffer( oldBuf ); - g_yyLineNr = fs->lineNr; - //preYYin = fs->oldYYin; - g_inputBuf = fs->oldFileBuf; - g_inputBufPos = fs->oldFileBufPos; - g_curlyCount = fs->curlyCount; - setFileName(fs->fileName); - DBG_CTX((stderr,"######## FileName %s\n",g_yyFileName.data())); - - // Deal with file changes due to - // #include's within { .. } blocks - QCString lineStr(15+g_yyFileName.length()); - lineStr.sprintf("# %d \"%s\" 2",g_yyLineNr,g_yyFileName.data()); - outputArray(lineStr.data(),lineStr.length()); - - delete fs; fs=0; - } - } -<*>"/*"/"*/" | -<*>"/*"[*]? { - if (YY_START==SkipVerbatim || YY_START==SkipCond) - { - REJECT; - } - else - { - outputArray(yytext,(int)yyleng); - g_lastCContext=YY_START; - g_commentCount=1; - if (yyleng==3) g_lastGuardName.resize(0); // reset guard in case the #define is documented! - BEGIN(SkipCComment); - } - } -<*>"//"[/]? { - if (YY_START==SkipVerbatim || YY_START==SkipCond || getLanguageFromFileName(g_yyFileName)==SrcLangExt_Fortran) - { - REJECT; - } - else - { - outputArray(yytext,(int)yyleng); - g_lastCPPContext=YY_START; - if (yyleng==3) g_lastGuardName.resize(0); // reset guard in case the #define is documented! - BEGIN(SkipCPPComment); - } - } -<*>\n { - outputChar('\n'); - g_yyLineNr++; - } -<*>. { - g_expectGuard = FALSE; - outputChar(*yytext); - } + // findFile will overwrite state->yyFileDef if found + FileState *fs; + bool alreadyIncluded = FALSE; + //printf("calling findFile(%s)\n",incFileName.data()); + if ((fs=findFile(yyscanner,incFileName,localInclude,alreadyIncluded))) // see if the include file can be found + { + //printf("Found include file!\n"); + if (Debug::isFlagSet(Debug::Preprocessor)) + { + for (i=0;iincludeStack.count();i++) + { + Debug::print(Debug::Preprocessor,0," "); + } + //msg("#include %s: parsing...\n",incFileName.data()); + } + if (oldFileDef) + { + // add include dependency to the file in which the #include was found + bool ambig; + // change to absolute name for bug 641336 + FileDef *incFd = findFileDef(Doxygen::inputNameDict,absIncFileName,ambig); + oldFileDef->addIncludeDependency(ambig ? 0 : incFd,incFileName,localInclude,state->isImported,FALSE); + // add included by dependency + if (state->yyFileDef) + { + //printf("Adding include dependency %s->%s\n",oldFileDef->name().data(),incFileName.data()); + state->yyFileDef->addIncludedByDependency(oldFileDef,oldFileDef->docName(),localInclude,state->isImported); + } + } + else if (state->inputFileDef) + { + state->inputFileDef->addIncludeDependency(0,absIncFileName,localInclude,state->isImported,TRUE); + } + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + fs->bufState = YY_CURRENT_BUFFER; + fs->lineNr = oldLineNr; + fs->fileName = oldFileName; + fs->curlyCount = state->curlyCount; + state->curlyCount = 0; + // push the state on the stack + state->includeStack.push(fs); + // set the scanner to the include file -%% + // Deal with file changes due to + // #include's within { .. } blocks + QCString lineStr(state->yyFileName.length()+20); + lineStr.sprintf("# 1 \"%s\" 1\n",state->yyFileName.data()); + outputArray(yyscanner,lineStr.data(),lineStr.length()); + + DBG_CTX((stderr,"Switching to include file %s\n",incFileName.data())); + state->expectGuard=TRUE; + state->inputBuf = &fs->fileBuf; + state->inputBufPos=0; + yy_switch_to_buffer(yy_create_buffer(0, YY_BUF_SIZE, yyscanner),yyscanner); + } + else + { + //printf(" calling findFile(%s) alreadyInc=%d\n",incFileName.data(),alreadyIncluded); + if (oldFileDef) + { + bool ambig; + //QCString absPath = incFileName; + //if (QDir::isRelativePath(incFileName)) + //{ + // absPath = QDir::cleanDirPath(oldFileDef->getPath()+"/"+incFileName); + // //printf("%s + %s -> resolved path %s\n",oldFileDef->getPath().data(),incFileName.data(),absPath.data()); + //} + + // change to absolute name for bug 641336 + FileDef *fd = findFileDef(Doxygen::inputNameDict,absIncFileName,ambig); + //printf("%s::findFileDef(%s)=%p\n",oldFileDef->name().data(),incFileName.data(),fd); + // add include dependency to the file in which the #include was found + oldFileDef->addIncludeDependency(ambig ? 0 : fd,incFileName,localInclude,state->isImported,FALSE); + // add included by dependency + if (fd) + { + //printf("Adding include dependency (2) %s->%s ambig=%d\n",oldFileDef->name().data(),fd->name().data(),ambig); + fd->addIncludedByDependency(oldFileDef,oldFileDef->docName(),localInclude,state->isImported); + } + } + else if (state->inputFileDef) + { + state->inputFileDef->addIncludeDependency(0,absIncFileName,localInclude,state->isImported,TRUE); + } + if (Debug::isFlagSet(Debug::Preprocessor)) + { + if (alreadyIncluded) + { + Debug::print(Debug::Preprocessor,0,"#include %s: already included! skipping...\n",qPrint(incFileName)); + } + else + { + Debug::print(Debug::Preprocessor,0,"#include %s: not found! skipping...\n",qPrint(incFileName)); + } + //printf("error: include file %s not found\n",yytext); + } + if (state->curlyCount>0 && !alreadyIncluded) // failed to find #include inside { ... } + { + warn(state->yyFileName,state->yyLineNr,"include file %s not found, perhaps you forgot to add its directory to INCLUDE_PATH?",incFileName.data()); + } + } + } +} + +/* ----------------------------------------------------------------- */ + +static void startCondSection(yyscan_t yyscanner,const char *sectId) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + //printf("startCondSection: skip=%d stack=%d\n",state->skip,state->condStack.count()); + CondParser prs; + bool expResult = prs.parse(state->yyFileName,state->yyLineNr,sectId); + state->condStack.push(new CondCtx(state->yyLineNr,sectId,state->skip)); + if (!expResult) + { + state->skip=TRUE; + } + //printf(" expResult=%d skip=%d\n",expResult,state->skip); +} + +static void endCondSection(yyscan_t yyscanner) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + if (state->condStack.isEmpty()) + { + state->skip=FALSE; + } + else + { + CondCtx *ctx = state->condStack.pop(); + state->skip=ctx->skip; + delete ctx; + } + //printf("endCondSection: skip=%d stack=%d\n",state->skip,state->condStack.count()); +} + +static void forceEndCondSection(yyscan_t yyscanner) +{ + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); + while (!state->condStack.isEmpty()) + { + delete state->condStack.pop(); + } + state->skip=FALSE; +} + +static QCString escapeAt(const char *text) +{ + QCString result; + if (text) + { + char c; + const char *p=text; + while ((c=*p++)) + { + if (c=='@') result+="@@"; else result+=c; + } + } + return result; +} + +static char resolveTrigraph(char c) +{ + switch (c) + { + case '=': return '#'; + case '/': return '\\'; + case '\'': return '^'; + case '(': return '['; + case ')': return ']'; + case '!': return '|'; + case '<': return '{'; + case '>': return '}'; + case '-': return '~'; + } + return '?'; +} /*@ ---------------------------------------------------------------------------- */ -static int getNextChar(const QCString &expr,QCString *rest,uint &pos) +static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos) { //printf("getNextChar(%s,%s,%d)\n",expr.data(),rest ? rest->data() : 0,pos); if (posdata() : 0,pos); if (posdata() : 0,pos,c); if (posdata() : 0,pos,c); } -void addSearchDir(const char *dir) +/////////////////////////////////////////////////////////////////////////////////////////////// + +struct Preprocessor::Private +{ + yyscan_t yyscanner; + preYY_state state; + bool firstTime = FALSE; +}; + +void Preprocessor::addSearchDir(const char *dir) { + YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner); QFileInfo fi(dir); - if (fi.isDir()) g_pathList->append(fi.absFilePath().utf8()); + if (fi.isDir()) state->pathList->append(fi.absFilePath().utf8()); } -void initPreprocessor() +Preprocessor::Preprocessor() { - g_pathList = new QStrList; + p = new Private; + preYYlex_init_extra(&p->state,&p->yyscanner); + YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner); + state->pathList = new QStrList; addSearchDir("."); - g_expandedDict = new DefineDict(17); + state->expandedDict = new DefineDict(17); } -void cleanUpPreprocessor() +Preprocessor::~Preprocessor() { - delete g_expandedDict; g_expandedDict=0; - delete g_pathList; g_pathList=0; - DefineManager::deleteInstance(); + YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner); + delete state->expandedDict; + state->expandedDict=0; + delete state->pathList; + state->pathList=0; + preYYlex_destroy(p->yyscanner); + delete p; } - -void preprocessFile(const char *fileName,BufStr &input,BufStr &output) +void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output) { + yyscan_t yyscanner = p->yyscanner; + YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner); + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; printlex(yy_flex_debug, TRUE, __FILE__, fileName); uint orgOffset=output.curPos(); //printf("##########################\n%s\n####################\n", // input.data()); - g_macroExpansion = Config_getBool(MACRO_EXPANSION); - g_expandOnlyPredef = Config_getBool(EXPAND_ONLY_PREDEF); - g_skip=FALSE; - g_curlyCount=0; - g_nospaces=FALSE; - g_inputBuf=&input; - g_inputBufPos=0; - g_outputBuf=&output; - g_includeStack.setAutoDelete(TRUE); - g_includeStack.clear(); - g_expandedDict->setAutoDelete(FALSE); - g_expandedDict->clear(); - g_condStack.setAutoDelete(TRUE); - g_condStack.clear(); - //g_fileDefineDict->clear(); - - setFileName(fileName); - g_inputFileDef = g_yyFileDef; - DefineManager::instance().startContext(g_yyFileName); + state->macroExpansion = Config_getBool(MACRO_EXPANSION); + state->expandOnlyPredef = Config_getBool(EXPAND_ONLY_PREDEF); + state->skip=FALSE; + state->curlyCount=0; + state->nospaces=FALSE; + state->inputBuf=&input; + state->inputBufPos=0; + state->outputBuf=&output; + state->includeStack.setAutoDelete(TRUE); + state->includeStack.clear(); + state->expandedDict->setAutoDelete(FALSE); + state->expandedDict->clear(); + state->condStack.setAutoDelete(TRUE); + state->condStack.clear(); + //state->fileDefineDict->clear(); + + setFileName(yyscanner,fileName); + state->inputFileDef = state->yyFileDef; + state->defineManager.startContext(state->yyFileName); - static bool firstTime=TRUE; - if (firstTime) + p->firstTime=TRUE; + if (p->firstTime) { // add predefined macros char *defStr; @@ -3226,9 +3278,9 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) def->nargs = count; def->isPredefined = TRUE; def->nonRecursive = nonRecursive; - def->fileDef = g_yyFileDef; + def->fileDef = state->yyFileDef; def->fileName = fileName; - DefineManager::instance().addDefine(g_yyFileName,def); + state->defineManager.addDefine(state->yyFileName,def); } //printf("#define '%s' '%s' #nargs=%d\n", @@ -3257,9 +3309,9 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) def->nargs = -1; def->isPredefined = TRUE; def->nonRecursive = nonRecursive; - def->fileDef = g_yyFileDef; + def->fileDef = state->yyFileDef; def->fileName = fileName; - DefineManager::instance().addDefine(g_yyFileName,def); + state->defineManager.addDefine(state->yyFileName,def); } else { @@ -3273,24 +3325,23 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) //firstTime=FALSE; } - g_yyLineNr = 1; - g_yyColNr = 1; - g_level = 0; - g_ifcount = 0; + state->yyLineNr = 1; + state->yyColNr = 1; + state->level = 0; + state->ifcount = 0; BEGIN( Start ); - g_expectGuard = guessSection(fileName)==Entry::HEADER_SEC; - g_guardName.resize(0); - g_lastGuardName.resize(0); - g_guardExpr.resize(0); + state->expectGuard = guessSection(fileName)==Entry::HEADER_SEC; + state->guardName.resize(0); + state->lastGuardName.resize(0); + state->guardExpr.resize(0); - preYYlex(); - g_lexInit=TRUE; + preYYlex(yyscanner); - while (!g_condStack.isEmpty()) + while (!state->condStack.isEmpty()) { - CondCtx *ctx = g_condStack.pop(); + CondCtx *ctx = state->condStack.pop(); QCString sectionInfo = " "; if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx->sectionId.stripWhiteSpace().data()); warn(fileName,ctx->lineNr,"Conditional section%sdoes not have " @@ -3298,18 +3349,18 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) delete ctx; } // make sure we don't extend a \cond with missing \endcond over multiple files (see bug 624829) - forceEndCondSection(); + forceEndCondSection(yyscanner); // remove locally defined macros so they can be redefined in another source file - //if (g_fileDefineDict->count()>0) + //if (state->fileDefineDict->count()>0) //{ - // QDictIterator di(*g_fileDefineDict); + // QDictIterator di(*state->fileDefineDict); // Define *d; // for (di.toFirst();(d=di.current());++di) // { - // g_globalDefineDict->remove(di.currentKey()); + // state->globalDefineDict->remove(di.currentKey()); // } - // g_fileDefineDict->clear(); + // state->fileDefineDict->clear(); //} if (Debug::isFlagSet(Debug::Preprocessor)) @@ -3326,11 +3377,11 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) orgPos++; } Debug::print(Debug::Preprocessor,0,"\n---------\n"); - if (DefineManager::instance().defineContext().count()>0) + if (state->defineManager.defineContext().count()>0) { Debug::print(Debug::Preprocessor,0,"Macros accessible in this file:\n"); Debug::print(Debug::Preprocessor,0,"---------\n"); - QDictIterator di(DefineManager::instance().defineContext()); + QDictIterator di(state->defineManager.defineContext()); Define *def; for (di.toFirst();(def=di.current());++di) { @@ -3343,20 +3394,10 @@ void preprocessFile(const char *fileName,BufStr &input,BufStr &output) Debug::print(Debug::Preprocessor,0,"No macros accessible in this file.\n"); } } - DefineManager::instance().endContext(); + state->defineManager.endContext(); printlex(yy_flex_debug, FALSE, __FILE__, fileName); } -void preFreeScanner() -{ -#if defined(YY_FLEX_SUBMINOR_VERSION) - if (g_lexInit) - { - preYYlex_destroy(); - } -#endif -} - #if !defined(YY_FLEX_SUBMINOR_VERSION) extern "C" { // some bogus code to keep the compiler happy // int preYYwrap() { return 1 ; } -- cgit v0.12 From 28c738d0319bf5de25bcf6aed90234419feded07 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 9 Nov 2019 17:29:15 +0100 Subject: Remove global state from constexp lexer --- src/constexp.h | 23 ++++++++--------------- src/constexp.l | 57 ++++++++++++++++++++++++++++++++++---------------------- src/constexp.y | 21 ++++++++------------- src/constexp_p.h | 44 +++++++++++++++++++++++++++++++++++++++++++ src/pre.h | 2 +- src/pre.l | 3 ++- 6 files changed, 98 insertions(+), 52 deletions(-) create mode 100644 src/constexp_p.h diff --git a/src/constexp.h b/src/constexp.h index 8bf582e..0b52e14 100644 --- a/src/constexp.h +++ b/src/constexp.h @@ -19,24 +19,17 @@ #ifndef _CONSTEXP_H #define _CONSTEXP_H -#include "cppvalue.h" #include -#define YYSTYPE CPPValue -typedef void* yyscan_t; -struct constexpYY_state +class ConstExpressionParser { - QCString g_strToken; - CPPValue g_resultValue; - int g_constExpLineNr; - QCString g_constExpFileName; - - const char *g_inputString; - int g_inputPosition; + public: + ConstExpressionParser(); + ~ConstExpressionParser(); + bool parse(const char *fileName,int line,const QCString &expression); + private: + struct Private; + Private *p; }; -extern bool parseconstexp(const char *fileName,int line,const QCString &s); -extern int constexpYYparse(yyscan_t); -extern int constexpYYlex(YYSTYPE *lvalp, yyscan_t); -struct constexpYY_state* constexpYYget_extra (yyscan_t yyscanner ); #endif diff --git a/src/constexp.l b/src/constexp.l index b6b3c5c..eae8a3b 100644 --- a/src/constexp.l +++ b/src/constexp.l @@ -24,6 +24,7 @@ %{ #include "constexp.h" +#include "constexp_p.h" #include "cppvalue.h" #include "ce_parse.hpp" // generated header file #include "message.h" @@ -31,7 +32,6 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 - static const char *stateToString(int state); static int yyread(char *buf,int max_size,yyscan_t yyscanner); @@ -70,23 +70,23 @@ CONSTSUFFIX ([uU][lL]?[lL]?)|([lL][lL]?[uU]?) "(" { return TOK_LPAREN; } ")" { return TOK_RPAREN; } "'"(([^\'\n\r\\]+)|(\\(([ntvbrfa\\?'\"])|([0-9]+)|([xX][0-9a-fA-F]+))))"'" { - yyextra->g_strToken=yytext; + yyextra->strToken=yytext; return TOK_CHARACTER; } -0[0-7]*{CONSTSUFFIX}? { yyextra->g_strToken=yytext; +0[0-7]*{CONSTSUFFIX}? { yyextra->strToken=yytext; return TOK_OCTALINT; } -[1-9][0-9]*{CONSTSUFFIX}? { yyextra->g_strToken=yytext; +[1-9][0-9]*{CONSTSUFFIX}? { yyextra->strToken=yytext; return TOK_DECIMALINT; } -(0x|0X)[0-9a-fA-F]+{CONSTSUFFIX}? { yyextra->g_strToken=yytext+2; +(0x|0X)[0-9a-fA-F]+{CONSTSUFFIX}? { yyextra->strToken=yytext+2; return TOK_HEXADECIMALINT; } (([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+))([eE]([\-\+])?[0-9]+)?([fFlL])? { - yyextra->g_strToken=yytext; return TOK_FLOAT; + yyextra->strToken=yytext; return TOK_FLOAT; } ([0-9]+[eE])([\-\+])?[0-9]+([fFlL])? { - yyextra->g_strToken=yytext; return TOK_FLOAT; + yyextra->strToken=yytext; return TOK_FLOAT; } . \n @@ -97,43 +97,56 @@ static int yyread(char *buf,int max_size,yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; int c=0; - while( c < max_size && yyextra->g_inputString[yyextra->g_inputPosition] ) + while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { - *buf = yyextra->g_inputString[yyextra->g_inputPosition++] ; + *buf = yyextra->inputString[yyextra->inputPosition++] ; c++; buf++; } return c; } +struct ConstExpressionParser::Private +{ + yyscan_t yyscanner; + struct constexpYY_state constexpYY_extra; +}; -static yyscan_t yyscanner; -static struct constexpYY_state constexpYY_extra; -bool parseconstexp(const char *fileName,int lineNr,const QCString &s) +ConstExpressionParser::ConstExpressionParser() { - constexpYYlex_init_extra(&constexpYY_extra, &yyscanner); - struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + p = new Private; + constexpYYlex_init_extra(&p->constexpYY_extra, &p->yyscanner); +} + +ConstExpressionParser::~ConstExpressionParser() +{ + constexpYYlex_destroy(p->yyscanner); + delete p; +} + +bool ConstExpressionParser::parse(const char *fileName,int lineNr,const QCString &s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; #ifdef FLEX_DEBUG yyset_debug(1,yyscanner); #endif - yyextra->g_constExpFileName = fileName; - yyextra->g_constExpLineNr = lineNr; - yyextra->g_inputString = s; - yyextra->g_inputPosition = 0; - constexpYYrestart( yyin, yyscanner ); + yyextra->constExpFileName = fileName; + yyextra->constExpLineNr = lineNr; + yyextra->inputString = s; + yyextra->inputPosition = 0; + constexpYYrestart( yyin, p->yyscanner ); printlex(yy_flex_debug, TRUE, __FILE__, fileName); //printf("Expression: '%s'\n",s.data()); - constexpYYparse(yyscanner); + constexpYYparse(p->yyscanner); //printf("Result: %ld\n",(long)g_resultValue); printlex(yy_flex_debug, FALSE, __FILE__, fileName); - bool result = (long)yyextra->g_resultValue!=0; + bool result = (long)yyextra->resultValue!=0; - constexpYYlex_destroy(yyscanner); return result; } diff --git a/src/constexp.y b/src/constexp.y index 62a51f3..100614a 100644 --- a/src/constexp.y +++ b/src/constexp.y @@ -19,21 +19,16 @@ %{ #include "cppvalue.h" -#include "constexp.h" +#include "constexp_p.h" #include "message.h" -#if defined(_MSC_VER) -#define MSDOS -#endif - - #include #include int constexpYYerror(yyscan_t yyscanner, const char *s) { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); - warn(yyextra->g_constExpFileName, yyextra->g_constExpLineNr, + warn(yyextra->constExpFileName, yyextra->constExpLineNr, "preprocessing issue while doing constant expression evaluation: %s",s); return 0; } @@ -80,7 +75,7 @@ int constexpYYerror(yyscan_t yyscanner, const char *s) start: constant_expression { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); - yyextra->g_resultValue = $1; return 0; + yyextra->resultValue = $1; return 0; } ; @@ -272,27 +267,27 @@ primary_expression: constant constant: TOK_OCTALINT { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); - $$ = parseOctal(yyextra->g_strToken); + $$ = parseOctal(yyextra->strToken); } | TOK_DECIMALINT { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); - $$ = parseDecimal(yyextra->g_strToken); + $$ = parseDecimal(yyextra->strToken); } | TOK_HEXADECIMALINT { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); - $$ = parseHexadecimal(yyextra->g_strToken); + $$ = parseHexadecimal(yyextra->strToken); } | TOK_CHARACTER { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); - $$ = parseCharacter(yyextra->g_strToken); + $$ = parseCharacter(yyextra->strToken); } | TOK_FLOAT { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); - $$ = parseFloat(yyextra->g_strToken); + $$ = parseFloat(yyextra->strToken); } ; diff --git a/src/constexp_p.h b/src/constexp_p.h new file mode 100644 index 0000000..ad09b2d --- /dev/null +++ b/src/constexp_p.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * + * Copyright (C) 1997-2019 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 _CONSTEXP_P_H +#define _CONSTEXP_P_H + +#include + +//! @file +//! @brief Private interface between Parser (constexp.y) and Lexer (constexp.l) + +#include "cppvalue.h" +#define YYSTYPE CPPValue + +typedef void* yyscan_t; +struct constexpYY_state +{ + QCString strToken; + CPPValue resultValue; + int constExpLineNr; + QCString constExpFileName; + + const char *inputString; + int inputPosition; +}; +constexpYY_state* constexpYYget_extra(yyscan_t yyscanner ); + +extern int constexpYYlex(YYSTYPE *lvalp, yyscan_t); +extern int constexpYYparse(yyscan_t); + + +#endif diff --git a/src/pre.h b/src/pre.h index 193ab60..137b397 100644 --- a/src/pre.h +++ b/src/pre.h @@ -28,7 +28,7 @@ class Preprocessor void processFile(const char *fileName,BufStr &input,BufStr &output); void addSearchDir(const char *dir); private: - class Private; + struct Private; Private *p; }; diff --git a/src/pre.l b/src/pre.l index ecf6b57..0ce7eaa 100644 --- a/src/pre.l +++ b/src/pre.l @@ -380,6 +380,7 @@ struct preYY_state QCString delimiter; QDict allIncludes; DefineManager defineManager; + ConstExpressionParser constExpParser; }; // stateless functions @@ -2704,7 +2705,7 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr) e = removeIdsAndMarkers(e); if (e.isEmpty()) return FALSE; //printf("parsing '%s'\n",e.data()); - return parseconstexp(state->yyFileName,state->yyLineNr,e); + return state->constExpParser.parse(state->yyFileName,state->yyLineNr,e); } /*! expands the macro definition in \a name -- cgit v0.12 From bae74a501c520bc180ea329dbe8d91b1ce81d90e Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 9 Nov 2019 19:46:38 +0100 Subject: Fixed use of uninitialized pointer in preprocessor --- src/fileparser.h | 2 +- src/fortranscanner.h | 2 +- src/fortranscanner.l | 2 +- src/markdown.h | 2 +- src/parserintf.h | 2 +- src/pre.l | 10 +++++----- src/pyscanner.h | 2 +- src/pyscanner.l | 2 +- src/scanner.h | 2 +- src/scanner.l | 2 +- src/sqlscanner.h | 2 +- src/tclscanner.h | 2 +- src/tclscanner.l | 2 +- src/vhdljjparser.h | 2 +- src/xmlscanner.h | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/fileparser.h b/src/fileparser.h index 7c3f40c..3132f92 100644 --- a/src/fileparser.h +++ b/src/fileparser.h @@ -26,7 +26,7 @@ class FileParser : public ParserInterface void startTranslationUnit(const char *) {} void finishTranslationUnit() {} void parseInput(const char *, const char *,const std::unique_ptr &, bool, QStrList &) {} - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/fortranscanner.h b/src/fortranscanner.h index 7490cde..6476c98 100644 --- a/src/fortranscanner.h +++ b/src/fortranscanner.h @@ -36,7 +36,7 @@ class FortranLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/fortranscanner.l b/src/fortranscanner.l index a053910..39c45e7 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -2793,7 +2793,7 @@ void FortranLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, showLineNumbers,searchCtx,collectXRefs,m_format); } -bool FortranLanguageScanner::needsPreprocessing(const QCString &extension) +bool FortranLanguageScanner::needsPreprocessing(const QCString &extension) const { return extension!=extension.lower(); // use preprocessor only for upper case extensions } diff --git a/src/markdown.h b/src/markdown.h index f101e5a..2c9a496 100644 --- a/src/markdown.h +++ b/src/markdown.h @@ -36,7 +36,7 @@ class MarkdownFileParser : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/parserintf.h b/src/parserintf.h index a269bfb..c0939c9 100644 --- a/src/parserintf.h +++ b/src/parserintf.h @@ -78,7 +78,7 @@ class ParserInterface * parser. * @see parseInput() */ - virtual bool needsPreprocessing(const QCString &extension) = 0; + virtual bool needsPreprocessing(const QCString &extension) const = 0; /** Parses a source file or fragment with the goal to produce * highlighted and cross-referenced output. diff --git a/src/pre.l b/src/pre.l index 0ce7eaa..0aa54b9 100644 --- a/src/pre.l +++ b/src/pre.l @@ -334,9 +334,9 @@ struct preYY_state FileDef *yyFileDef; FileDef *inputFileDef; int ifcount = 0; - QStrList *pathList = 0; + QStrList *pathList = 0; QStack includeStack; - QDict *argDict; + QDict *argDict = 0; int defArgs = -1; QCString defName; QCString defText; @@ -348,12 +348,12 @@ struct preYY_state int lastCContext; int lastCPPContext; QArray levelGuard; - BufStr *inputBuf; + BufStr *inputBuf = 0; int inputBufPos; - BufStr *outputBuf; + BufStr *outputBuf = 0; int roundCount; bool quoteArg; - DefineDict *expandedDict; + DefineDict *expandedDict = 0; int findDefArgContext; bool expectGuard; QCString guardName; diff --git a/src/pyscanner.h b/src/pyscanner.h index 13b10b9..2faffdc 100644 --- a/src/pyscanner.h +++ b/src/pyscanner.h @@ -42,7 +42,7 @@ class PythonLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/pyscanner.l b/src/pyscanner.l index 829980c..63f11e3 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -1901,7 +1901,7 @@ void PythonLanguageScanner::parseInput(const char *fileName, // printAST(global_root); } -bool PythonLanguageScanner::needsPreprocessing(const QCString &) +bool PythonLanguageScanner::needsPreprocessing(const QCString &) const { return FALSE; } diff --git a/src/scanner.h b/src/scanner.h index 7103cb0..65206be 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -37,7 +37,7 @@ class CLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/scanner.l b/src/scanner.l index 8710ca2..33ea4d4 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -7364,7 +7364,7 @@ void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, showLineNumbers,searchCtx,collectXRefs); } -bool CLanguageScanner::needsPreprocessing(const QCString &extension) +bool CLanguageScanner::needsPreprocessing(const QCString &extension) const { QCString fe=extension.lower(); SrcLangExt lang = getLanguageFromFileName(extension); diff --git a/src/sqlscanner.h b/src/sqlscanner.h index b981b5b..694bf80 100644 --- a/src/sqlscanner.h +++ b/src/sqlscanner.h @@ -29,7 +29,7 @@ public: void startTranslationUnit(const char *) {} void finishTranslationUnit() {} void parseInput(const char *, const char *, const std::unique_ptr &, bool , QStrList &) {} - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, diff --git a/src/tclscanner.h b/src/tclscanner.h index 482fb1f..94da68b 100644 --- a/src/tclscanner.h +++ b/src/tclscanner.h @@ -36,7 +36,7 @@ class TclLanguageScanner : public ParserInterface const std::unique_ptr &root, bool sameTranslationUnit, QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension); + bool needsPreprocessing(const QCString &extension) const; void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, const QCString &input, diff --git a/src/tclscanner.l b/src/tclscanner.l index 45ad9c0..4f2d837 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -3081,7 +3081,7 @@ tcl_inf("%s (%d,%d) %d %d\n",myStr.data(),startLine,endLine,isExampleBlock,inlin printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); } -bool TclLanguageScanner::needsPreprocessing(const QCString &extension) +bool TclLanguageScanner::needsPreprocessing(const QCString &extension) const { (void)extension; return FALSE; diff --git a/src/vhdljjparser.h b/src/vhdljjparser.h index d38a731..f2bf60d 100644 --- a/src/vhdljjparser.h +++ b/src/vhdljjparser.h @@ -66,7 +66,7 @@ class VHDLLanguageScanner : public ParserInterface const Definition *searchCtx=0, bool collectXRefs=TRUE ); - bool needsPreprocessing(const QCString &) { return TRUE; } + bool needsPreprocessing(const QCString &) const { return TRUE; } void resetCodeParserState(){}; void parsePrototype(const char *text); }; diff --git a/src/xmlscanner.h b/src/xmlscanner.h index b54d416..0fe01a7 100644 --- a/src/xmlscanner.h +++ b/src/xmlscanner.h @@ -29,7 +29,7 @@ public: void startTranslationUnit(const char *) {} void finishTranslationUnit() {} void parseInput(const char *, const char *, const std::unique_ptr &, bool , QStrList &) {} - bool needsPreprocessing(const QCString &) { return FALSE; } + bool needsPreprocessing(const QCString &) const { return FALSE; } void parseCode(CodeOutputInterface &codeOutIntf, const char *scopeName, -- cgit v0.12 From 4884295c6a3bc9af6e01c1688a3173ac6c3bc315 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 10 Nov 2019 11:16:40 +0100 Subject: Simplied the logic for moving documentation to the most nested Entry --- src/scanner.l | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/scanner.l b/src/scanner.l index e9ca1c7..abc0c3b 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -3910,17 +3910,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (current->section == Entry::NAMESPACE_SEC && current->type == "namespace") { int split_point; - Entry *first_current = current; + // save documentation values + QCString doc = current->doc; + int docLine = current->docLine; + QCString docFile = current->docFile; + QCString brief = current->brief; + int briefLine = current->briefLine; + QCString briefFile = current->briefFile; + // reset documentation values + current->doc = ""; + current->docLine = 0; + current->docFile = ""; + current->brief = ""; + current->briefLine = 0; + current->briefFile = ""; while ((split_point = current->name.find("::")) != -1) { std::unique_ptr new_current = std::make_unique(*current); current->program = ""; - new_current->doc = ""; - new_current->docLine = 0; - new_current->docFile = ""; - new_current->brief = ""; - new_current->briefLine = 0; - new_current->briefFile = ""; new_current->name = current->name.mid(split_point + 2); current->name = current->name.left(split_point); if (!current_root->name.isEmpty()) current->name.prepend(current_root->name+"::"); @@ -3930,22 +3937,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current_root = tmp; current.swap(new_current); } - // put documentation in the right entity - if (first_current!=current) - { - current->doc = first_current->doc; - current->docLine = first_current->docLine; - current->docFile = first_current->docFile; - current->brief = first_current->brief; - current->briefLine = first_current->briefLine; - current->briefFile = first_current->briefFile; - first_current->doc = ""; - first_current->docLine = 0; - first_current->docFile = ""; - first_current->brief = ""; - first_current->briefLine = 0; - first_current->briefFile = ""; - } + // restore documentation values + current->doc = doc; + current->docLine = docLine; + current->docFile = docFile; + current->brief = brief; + current->briefLine = briefLine; + current->briefFile = briefFile; } QCString &cn = current->name; QCString rn = current_root->name.copy(); -- cgit v0.12 From f08e87623368134c6541af12995b811ef9aff069 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 12 Nov 2019 11:42:22 +0100 Subject: issue #7290 error: Problem running ghostscript gs -q -g562x56 -r384x384x -sDEVICE=ppmraw -sOutputFile=_form0.pnm -dNOPAUSE -dBATCH -- _form0.ps. Check your installation! @maehr had a talk with Robin Watts and Ken Sharp at IRC and there seem to be basically 3 different problems: * `-r%dx%d` (the dimension for `r` shouldn't be `-r384x384x`, but `-r384x384`), * misuse / unnecessary use of `--` and * since 9.50 the command needs more control access (that might be worked around by either whitelisting the file via `--permit-file-read=_form0.eps` (only works from 9.50 and upwards) or generally accepting any file with `-dNOSAFER` (works since quite some time). The second option is considered to be unsafe if we would process any file, but in this case we process self produced / controlled files. I don't know if doxygen has any threat model that it assumes. ). > Ken Sharp: Yeah the %dx is wrong, as Robin says its sheer luck that works the -- isn't needed and is what's causing the first problem and file control is the new bugbear The suggestions have been implemented and test / docs works now with old and new version. --- src/formula.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/formula.cpp b/src/formula.cpp index 534f56a..3d8e6ce 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -193,8 +193,8 @@ void FormulaList::generateBitmaps(const char *path) // used. char gsArgs[4096]; - sprintf(gsArgs,"-q -g%dx%d -r%dx%dx -sDEVICE=ppmraw " - "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -- %s.ps", + sprintf(gsArgs,"-q -g%dx%d -r%dx%d -sDEVICE=ppmraw " + "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -dNOSAFER %s.ps", gx,gy,(int)(scaleFactor*72),(int)(scaleFactor*72), formBase.data(),formBase.data() ); -- cgit v0.12 From 0809acf9d38525578080e50a4b23b61127706ebe Mon Sep 17 00:00:00 2001 From: Roel Standaert Date: Tue, 12 Nov 2019 14:23:57 +0100 Subject: Fix line count after multiline close group Fix for issue #7393 When closing a group on multiple lines, like: /*! @} */ The line count of subsequent lines is wrong (it's one line less than it should be). --- src/scanner.l | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scanner.l b/src/scanner.l index abc0c3b..393d6d4 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2852,6 +2852,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) "//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" { bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && lastInitializerContext==FindFields); // see bug746226 Doxygen::docGroup.close(current.get(),yyFileName,yyLineNr,insideEnum); + lineCount(); } "=" { // in PHP code this could also be due to "bodyLine = yyLineNr; -- cgit v0.12 From 6b821a1da54e558947b631a7d2b836c8aa6935e7 Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 12 Nov 2019 18:08:22 +0100 Subject: Problem with horizontal ruler directly after fenced code section When having a fenced code block directly followed by a horizontal ruler like: ``` ~~~ B ~~~ --- ``` we get the warning: ``` bb.md:5: warning: unexpected command endcode ``` due to the fact that the markdown parser replaces the `~~~` by a `@code` / `endcode` block and then handles the horizontal ruler `---` but this is seen as a level 2 header on the previous part resulting in the markdown code: ``` @page md_bb bb @subsection autotoc_md0 @code B @endcode ``` The problem also occurs when a fenced code block is created with back tics. By adding a `\n` this problem is fixed. --- src/markdown.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index f6720ea..e054941 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -2176,7 +2176,7 @@ static void writeFencedCodeBlock(GrowBuf &out,const char *data,const char *lng, } out.addStr(data+blockStart,blockEnd-blockStart); out.addStr("\n"); - out.addStr("@endcode"); + out.addStr("@endcode\n"); } static QCString processQuotations(const QCString &s,int refIndent) -- cgit v0.12 From 82e952f272b285b641a1980143826bf8816c70c1 Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 13 Nov 2019 11:50:45 +0100 Subject: Illegal Character in XML output The usage of, the unusual, `&` in a filename caused troubles as the filenames in the file strings in the location element were not translated to XML. --- src/xmlgen.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 9e76d6f..83e97b2 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -980,7 +980,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (md->getDefLine()!=-1) { t << " getDefFileName()) << "\" line=\"" + << convertToXML(stripFromPath(md->getDefFileName())) << "\" line=\"" << md->getDefLine() << "\" column=\"" << md->getDefColumn() << "\"" ; if (md->getStartBodyLine()!=-1) @@ -988,14 +988,14 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream FileDef *bodyDef = md->getBodyDef(); if (bodyDef) { - t << " bodyfile=\"" << stripFromPath(bodyDef->absFilePath()) << "\""; + t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\"" << md->getEndBodyLine() << "\""; } if (md->getDeclLine()!=-1) { - t << " declfile=\"" << stripFromPath(md->getDeclFileName()) << "\" declline=\"" + t << " declfile=\"" << convertToXML(stripFromPath(md->getDeclFileName())) << "\" declline=\"" << md->getDeclLine() << "\" declcolumn=\"" << md->getDeclColumn() << "\""; } @@ -1418,7 +1418,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) t << " " << endl; } t << " getDefFileName()) << "\" line=\"" + << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\"" << cd->getDefLine() << "\"" << " column=\"" << cd->getDefColumn() << "\"" ; if (cd->getStartBodyLine()!=-1) @@ -1426,7 +1426,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) FileDef *bodyDef = cd->getBodyDef(); if (bodyDef) { - t << " bodyfile=\"" << stripFromPath(bodyDef->absFilePath()) << "\""; + t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" << cd->getEndBodyLine() << "\""; @@ -1506,7 +1506,7 @@ static void generateXMLForNamespace(const NamespaceDef *nd,FTextStream &ti) writeXMLDocBlock(t,nd->docFile(),nd->docLine(),nd,0,nd->documentation()); t << " " << endl; t << " getDefFileName()) << "\" line=\"" + << convertToXML(stripFromPath(nd->getDefFileName())) << "\" line=\"" << nd->getDefLine() << "\"" << " column=\"" << nd->getDefColumn() << "\"/>" << endl ; t << " " << endl; @@ -1648,7 +1648,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti) writeXMLCodeBlock(t,fd); t << " " << endl; } - t << " getDefFileName()) << "\"/>" << endl; + t << " getDefFileName())) << "\"/>" << endl; t << " " << endl; t << "" << endl; @@ -1762,7 +1762,7 @@ static void generateXMLForDir(DirDef *dd,FTextStream &ti) t << " " << endl; writeXMLDocBlock(t,dd->docFile(),dd->docLine(),dd,0,dd->documentation()); t << " " << endl; - t << " name()) << "\"/>" << endl; + t << " name())) << "\"/>" << endl; t << " " << endl; t << "" << endl; -- cgit v0.12 From d4a0825b1d00ead2ce441c3407d1983f80401353 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Thu, 14 Nov 2019 22:27:39 +0100 Subject: issue #7325: Endless loop in preprocessor due to #define A() --- src/pre.l | 63 +++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/pre.l b/src/pre.l index 0aa54b9..1ee57a9 100644 --- a/src/pre.l +++ b/src/pre.l @@ -379,6 +379,7 @@ struct preYY_state bool ccomment; QCString delimiter; QDict allIncludes; + QDict expansionDict; DefineManager defineManager; ConstExpressionParser constExpParser; }; @@ -1933,7 +1934,7 @@ static QCString extractTrailingComment(const char *s) static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos); static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint pos); static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos,char c); -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos); +static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level); static QCString stringize(const QCString &s) { @@ -2068,10 +2069,10 @@ static inline void addTillEndOfString(yyscan_t yyscanner,const QCString &expr,QC * The replacement string will be returned in \a result and the * length of the (unexpanded) argument list is stored in \a len. */ -static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result) +static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCString *rest,int pos,int &len,const Define *def,QCString &result,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf("replaceFunctionMacro(expr=%s,rest=%s,pos=%d,def=%s) level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->level); + //printf(">replaceFunctionMacro(expr='%s',rest='%s',pos=%d,def='%s') level=%d\n",expr.data(),rest ? rest->data() : 0,pos,def->name.data(),state->level); uint j=pos; len=0; result.resize(0); @@ -2225,7 +2226,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin // substitution of all formal arguments QCString resExpr; const QCString d=def->definition.stripWhiteSpace(); - //printf("Macro definition: %s\n",d.data()); + //printf("Macro definition: '%s'\n",d.data()); bool inString=FALSE; while (kdata()); @@ -2311,10 +2315,10 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } len=j-pos; result=resExpr; - //printf("result after substitution '%s' expr='%s'\n", - // result.data(),expr.mid(pos,len).data()); + //printf("data() : 0,pos,def->name.data(),result.data(),state->level); return TRUE; } + //printf("data() : 0,pos,def->name.data(),result.data(),state->level); return FALSE; } @@ -2380,13 +2384,19 @@ static int getNextId(const QCString &expr,int p,int *l) /*! performs recursive macro expansion on the string \a expr * starting at position \a pos. * May read additional characters from the input while re-scanning! - * If \a expandAll is \c TRUE then all macros in the expression are - * expanded, otherwise only the first is expanded. */ -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos) +static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf("expandExpression(%s,%s)\n",expr.data(),rest ? rest->data() : 0); + printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + if (state->expansionDict.find(expr)!=0) // check for recursive expansions + { + return; + } + else + { + state->expansionDict.insert(expr,(void*)0x8); + } QCString macroName; QCString expMacro; bool definedTest=FALSE; @@ -2395,7 +2405,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in { bool replaced=FALSE; macroName=expr.mid(p,l); - //printf("macroName=%s\n",macroName.data()); + //printf(" p=%d macroName=%s\n",p,macroName.data()); if (p<2 || !(expr.at(p-2)=='@' && expr.at(p-1)=='-')) // no-rescan marker? { if (state->expandedDict->find(macroName)==0) // expand macro @@ -2432,29 +2442,33 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in } else if (def && def->nargs>=0) // function macro { - replaced=replaceFunctionMacro(yyscanner,expr,rest,p+l,len,def,expMacro); + //printf(" >>>> call replaceFunctionMacro\n"); + replaced=replaceFunctionMacro(yyscanner,expr,rest,p+l,len,def,expMacro,level); + //printf(" <<<< call replaceFunctionMacro: replaced=%d\n",replaced); len+=l; } + //printf(" macroName='%s' expMacro='%s' replaced=%d\n",macroName.data(),expMacro.data(),replaced); if (replaced) // expand the macro and rescan the expression { - //printf("replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data()); + //printf(" replacing '%s'->'%s'\n",expr.mid(p,len).data(),expMacro.data()); QCString resultExpr=expMacro; QCString restExpr=expr.right(expr.length()-len-p); processConcatOperators(resultExpr); + //printf(" macroName=%s def->nonRecursive=%d\n",macroName.data(),def->nonRecursive); if (def && !def->nonRecursive) { state->expandedDict->insert(macroName,def); - expandExpression(yyscanner,resultExpr,&restExpr,0); + expandExpression(yyscanner,resultExpr,&restExpr,0,level+1); state->expandedDict->remove(macroName); } expr=expr.left(p)+resultExpr+restExpr; + //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p); i=p; - //printf("new expression: %s\n",expr.data()); } else // move to the next macro name { - //printf("moving to the next macro old=%d new=%d\n",i,p+l); + //printf(" moving to the next macro old i=%d new i=%d\n",i,p+l); i=p+l; } } @@ -2472,6 +2486,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in i=p+l; } } + printf("data() : 0, pos,level); } /*! @brief Process string or character literal. @@ -2700,7 +2715,8 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); QCString e=expr; - expandExpression(yyscanner,e,0,0); + state->expansionDict.clear(); + expandExpression(yyscanner,e,0,0,0); //printf("after expansion '%s'\n",e.data()); e = removeIdsAndMarkers(e); if (e.isEmpty()) return FALSE; @@ -2714,8 +2730,10 @@ static bool computeExpression(yyscan_t yyscanner,const QCString &expr) static QCString expandMacro(yyscan_t yyscanner,const QCString &name) { + YY_EXTRA_TYPE state = preYYget_extra(yyscanner); QCString n=name; - expandExpression(yyscanner,n,0,0); + state->expansionDict.clear(); + expandExpression(yyscanner,n,0,0,0); n=removeMarkers(n); //printf("expandMacro '%s'->'%s'\n",name.data(),n.data()); return n; @@ -2750,7 +2768,7 @@ static void addDefine(yyscan_t yyscanner) // conditional section (cond command) that is disabled. if (!Doxygen::gatherDefines) return; - //printf("addDefine %s %s\n",state->defName.data(),state->defArgsStr.data()); + //printf("addDefine '%s' '%s'\n",state->defName.data(),state->defArgsStr.data()); //ArgumentList *al = new ArgumentList; //stringToArgumentList(state->defArgsStr,al); MemberDef *md=createMemberDef( @@ -3180,6 +3198,11 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output yyscan_t yyscanner = p->yyscanner; YY_EXTRA_TYPE state = preYYget_extra(p->yyscanner); struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + +#ifdef FLEX_DEBUG + preYYset_debug(1,yyscanner); +#endif + printlex(yy_flex_debug, TRUE, __FILE__, fileName); uint orgOffset=output.curPos(); //printf("##########################\n%s\n####################\n", -- cgit v0.12 From 4d173a0b2e13b2cd26c996894480afc65d50cd87 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 15 Nov 2019 15:39:42 +0100 Subject: HHC and directory elements starting with "." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on the question 'Doxygen failed to run html help compiler, hhc.exe error HHC5010 when running from folder that has a parent folder that starts with “.”/ (https://stackoverflow.com/questions/58861908/doxygen-failed-to-run-html-help-compiler-hhc-exe-error-hhc5010-when-running-fro). In we https://social.msdn.microsoft.com/Forums/en-US/0681145c-223b-498c-b7bf-be83209cbf4e/issue-with-html-workshop-in-a-windows-container?forum=visualstudiogeneral see: HTML Help 1.x command line compiler hhc.exe cannot compile CHM file to folder whose full path contains folder name starting with dot. If you have that problem, you probably specified output path with folder starting with dot, e.g. "d:\My files.NET\documentation". You can use dots in folder names but not at the beginning. We first convert the current path to a short name path and set this as current directory, this is only done on Windows other systems are not touched. --- src/doxygen.cpp | 1 + src/portable.cpp | 17 +++++++++++++++++ src/portable.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index c622f78..b4a4deb 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11862,6 +11862,7 @@ void generateOutput() g_s.begin("Running html help compiler...\n"); QString oldDir = QDir::currentDirPath(); QDir::setCurrent(Config_getString(HTML_OUTPUT)); + portable_setShortDir(); portable_sysTimerStart(); if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1) { diff --git a/src/portable.cpp b/src/portable.cpp index c6e829d..b447adc 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -478,3 +478,20 @@ void portable_unlink(const char *fileName) #endif } +void portable_setShortDir(void) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + long length = 0; + TCHAR* buffer = NULL; + // First obtain the size needed by passing NULL and 0. + length = GetShortPathName(QDir::currentDirPath().data(), NULL, 0); + // Dynamically allocate the correct size + // (terminating null char was included in length) + buffer = new TCHAR[length]; + // Now simply call again using same (long) path. + length = GetShortPathName(QDir::currentDirPath().data(), buffer, length); + // Set the correct directory (short name) + QDir::setCurrent(buffer); + delete [] buffer; +#endif +} diff --git a/src/portable.h b/src/portable.h index 83f90ef..c1b8c29 100644 --- a/src/portable.h +++ b/src/portable.h @@ -4,6 +4,7 @@ #include #include #include +#include #if defined(_WIN32) typedef __int64 portable_off_t; @@ -37,6 +38,7 @@ double portable_getSysElapsedTime(); void portable_sleep(int ms); bool portable_isAbsolutePath(const char *fileName); void portable_correct_path(void); +void portable_setShortDir(void); extern "C" { void * portable_iconv_open(const char* tocode, const char* fromcode); -- cgit v0.12 From caea19d73d20faadddeab5ea23199fb3d6e306de Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 12:46:40 +0100 Subject: remove debug prints --- src/pre.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pre.l b/src/pre.l index 1ee57a9..0652dbb 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2388,7 +2388,7 @@ static int getNextId(const QCString &expr,int p,int *l) static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); if (state->expansionDict.find(expr)!=0) // check for recursive expansions { return; @@ -2486,7 +2486,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in i=p+l; } } - printf("data() : 0, pos,level); + //printf("data() : 0, pos,level); } /*! @brief Process string or character literal. -- cgit v0.12 From 15a47ccc703c44d1355146a2744f1ccc38ee136f Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 12:54:42 +0100 Subject: Fixed issue with "QGDict::hashAsciiKey: Invalid null key" in pre.l --- src/pre.l | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pre.l b/src/pre.l index 0652dbb..8bde725 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2389,6 +2389,10 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + if (expr.isEmpty()) + { + return; + } if (state->expansionDict.find(expr)!=0) // check for recursive expansions { return; -- cgit v0.12 From bc17f30dd77812177ec872f79e53d0556871d343 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 13:45:21 +0100 Subject: issue #7403: xref versus namespace in multiple file --- src/definition.cpp | 2 +- src/membergroup.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/definition.cpp b/src/definition.cpp index f2b9018..80060ba 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1606,7 +1606,7 @@ void DefinitionImpl::makePartOfGroup(GroupDef *gd) void DefinitionImpl::setRefItems(const std::vector &sli) { - m_impl->xrefListItems = sli; + m_impl->xrefListItems.insert(m_impl->xrefListItems.end(), sli.cbegin(), sli.cend()); } void DefinitionImpl::mergeRefItems(Definition *d) diff --git a/src/membergroup.cpp b/src/membergroup.cpp index da52d64..05c38c3 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -358,7 +358,7 @@ void MemberGroup::findSectionsInDocumentation(const Definition *d) void MemberGroup::setRefItems(const std::vector &sli) { - m_xrefListItems = sli; + m_xrefListItems.insert(m_xrefListItems.end(), sli.cbegin(), sli.cend()); } void MemberGroup::writeTagFile(FTextStream &tagFile) @@ -370,5 +370,5 @@ void MemberGroup::writeTagFile(FTextStream &tagFile) void MemberGroupInfo::setRefItems(const std::vector &sli) { - m_sli = sli; + m_sli.insert(m_sli.end(), sli.cbegin(), sli.cend()); } -- cgit v0.12 From 7acba2f316a6e8f02364d76ab96b7ff9e739aec1 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 16 Nov 2019 15:49:20 +0100 Subject: issue #7348 Better warning in case a graph would have been to large --- src/classdef.cpp | 3 ++- src/dotcallgraph.cpp | 9 +++++++-- src/dotcallgraph.h | 1 + src/dotclassgraph.cpp | 7 ++++++- src/dotclassgraph.h | 1 + src/dotincldepgraph.cpp | 8 ++++++-- src/dotincldepgraph.h | 1 + src/filedef.cpp | 6 ++++-- src/memberdef.cpp | 6 ++++-- 9 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/classdef.cpp b/src/classdef.cpp index cee8be9..fd24f0b 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -1706,7 +1706,8 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const DotClassGraph inheritanceGraph(this,Inheritance); if (inheritanceGraph.isTooBig()) { - warn_uncond("Inheritance graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Inheritance graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), inheritanceGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!inheritanceGraph.isTrivial()) { diff --git a/src/dotcallgraph.cpp b/src/dotcallgraph.cpp index 15d408a..b024f09 100644 --- a/src/dotcallgraph.cpp +++ b/src/dotcallgraph.cpp @@ -212,6 +212,11 @@ bool DotCallGraph::isTrivial() const bool DotCallGraph::isTooBig() const { - int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0; - return numNodes>=DOT_GRAPH_MAX_NODES; + return numNodes()>=DOT_GRAPH_MAX_NODES; } + +int DotCallGraph::numNodes() const +{ + return m_startNode->children() ? m_startNode->children()->count() : 0; +} + diff --git a/src/dotcallgraph.h b/src/dotcallgraph.h index c96b9cf..bba976c 100644 --- a/src/dotcallgraph.h +++ b/src/dotcallgraph.h @@ -28,6 +28,7 @@ class DotCallGraph : public DotGraph ~DotCallGraph(); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; QCString writeGraph(FTextStream &t, GraphOutputFormat gf, EmbeddedOutputFormat ef, const char *path,const char *fileName, const char *relPath,bool writeImageMap=TRUE, diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index 3f5d228..da272b4 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -420,13 +420,18 @@ bool DotClassGraph::isTrivial() const bool DotClassGraph::isTooBig() const { + return numNodes()>=DOT_GRAPH_MAX_NODES; +} + +int DotClassGraph::numNodes() const +{ int numNodes = 0; numNodes+= m_startNode->children() ? m_startNode->children()->count() : 0; if (m_graphType==Inheritance) { numNodes+= m_startNode->parents() ? m_startNode->parents()->count() : 0; } - return numNodes>=DOT_GRAPH_MAX_NODES; + return numNodes; } DotClassGraph::~DotClassGraph() diff --git a/src/dotclassgraph.h b/src/dotclassgraph.h index b3b9291..1874f54 100644 --- a/src/dotclassgraph.h +++ b/src/dotclassgraph.h @@ -28,6 +28,7 @@ public: ~DotClassGraph(); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; QCString writeGraph(FTextStream &t,GraphOutputFormat gf,EmbeddedOutputFormat ef, const char *path, const char *fileName, const char *relPath, bool TBRank=TRUE,bool imageMap=TRUE,int graphId=-1); diff --git a/src/dotincldepgraph.cpp b/src/dotincldepgraph.cpp index 23588db..05a96d9 100644 --- a/src/dotincldepgraph.cpp +++ b/src/dotincldepgraph.cpp @@ -213,8 +213,12 @@ bool DotInclDepGraph::isTrivial() const bool DotInclDepGraph::isTooBig() const { - int numNodes = m_startNode->children() ? m_startNode->children()->count() : 0; - return numNodes>=Config_getInt(DOT_GRAPH_MAX_NODES); + return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES); +} + +int DotInclDepGraph::numNodes() const +{ + return m_startNode->children() ? m_startNode->children()->count() : 0; } void DotInclDepGraph::writeXML(FTextStream &t) diff --git a/src/dotincldepgraph.h b/src/dotincldepgraph.h index b664ccb..5807ce8 100644 --- a/src/dotincldepgraph.h +++ b/src/dotincldepgraph.h @@ -32,6 +32,7 @@ class DotInclDepGraph : public DotGraph bool writeImageMap=TRUE,int graphId=-1); bool isTrivial() const; bool isTooBig() const; + int numNodes() const; void writeXML(FTextStream &t); void writeDocbook(FTextStream &t); diff --git a/src/filedef.cpp b/src/filedef.cpp index f00c82b..346fb62 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -664,7 +664,8 @@ void FileDefImpl::writeIncludeGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,FALSE); if (incDepGraph.isTooBig()) { - warn_uncond("Include graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Include graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { @@ -688,7 +689,8 @@ void FileDefImpl::writeIncludedByGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,TRUE); if (incDepGraph.isTooBig()) { - warn_uncond("Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Included by graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + name().data(), incDepGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!incDepGraph.isTrivial()) { diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 9b6967b..840dd78 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -2877,7 +2877,8 @@ void MemberDefImpl::_writeCallGraph(OutputList &ol) const DotCallGraph callGraph(this,FALSE); if (callGraph.isTooBig()) { - warn_uncond("Call graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Call graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callGraph.isTrivial()) { @@ -2900,7 +2901,8 @@ void MemberDefImpl::_writeCallerGraph(OutputList &ol) const DotCallGraph callerGraph(this, TRUE); if (callerGraph.isTooBig()) { - warn_uncond("Caller graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Caller graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callerGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callerGraph.isTrivial()) { -- cgit v0.12 From 2972f6ddc491f615f814b1277ec715b6f707c419 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 17 Nov 2019 13:15:09 +0100 Subject: Made commentcnv.l reentrant --- src/commentcnv.l | 959 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 493 insertions(+), 466 deletions(-) diff --git a/src/commentcnv.l b/src/commentcnv.l index 3e5faba..14abb8f 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -16,6 +16,8 @@ */ %option never-interactive %option prefix="commentcnvYY" +%option reentrant +%option extra-type="struct commentcnvYY_state *" %{ @@ -41,8 +43,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 -#define ADDCHAR(c) g_outBuf->addChar(c) -#define ADDARRAY(a,s) g_outBuf->addArray(a,s) +#define ADDCHAR(c) yyextra->outBuf->addChar(c) +#define ADDARRAY(a,s) yyextra->outBuf->addArray(a,s) struct CondCtx { @@ -60,182 +62,60 @@ struct CommentCtx int lineNr; }; -static BufStr * g_inBuf; -static BufStr * g_outBuf; -static int g_inBufPos; -static int g_col; -static int g_blockHeadCol; -static bool g_mlBrief; -static int g_readLineCtx; -static bool g_skip; -static QCString g_fileName; -static int g_lineNr; -static int g_condCtx; -static QStack g_condStack; -static QStack g_commentStack; -static QCString g_blockName; -static int g_lastCommentContext; -static bool g_inSpecialComment; -static bool g_inRoseComment; -static int g_stringContext; -static int g_charContext; -static int g_javaBlock; -static bool g_specialComment; +struct commentcnvYY_state +{ + BufStr * inBuf = 0; + BufStr * outBuf = 0; + int inBufPos = 0; + int col = 0; + int blockHeadCol = 0; + bool mlBrief = FALSE; + int readLineCtx = 0; + bool skip = FALSE; + QCString fileName; + int lineNr = 0; + int condCtx = 0; + QStack condStack; + QStack commentStack; + QCString blockName; + int lastCommentContext = 0; + bool inSpecialComment = FALSE; + bool inRoseComment= FALSE; + int stringContext = 0; + int charContext = 0; + int javaBlock = 0; + bool specialComment = FALSE; -static QCString g_aliasString; -static int g_blockCount; -static bool g_lastEscaped; -static int g_lastBlockContext; -static bool g_pythonDocString; -static int g_nestingCount; + QCString aliasString; + int blockCount = 0; + bool lastEscaped = FALSE; + int lastBlockContext= 0; + bool pythonDocString = FALSE; + int nestingCount= 0; -static bool g_vhdl; // for VHDL old style --! comment + bool vhdl = FALSE; // for VHDL old style --! comment -static SrcLangExt g_lang; -static bool isFixedForm; // For Fortran + SrcLangExt lang = SrcLangExt_Unknown; + bool isFixedForm = FALSE; // For Fortran +}; static const char *stateToString(int state); +static inline int computeIndent(const char *s); -static void replaceCommentMarker(const char *s,int len) -{ - const char *p=s; - char c; - // copy leading blanks - while ((c=*p) && (c==' ' || c=='\t' || c=='\n')) - { - ADDCHAR(c); - g_lineNr += c=='\n'; - p++; - } - // replace start of comment marker by blanks and the last character by a * - int blanks=0; - while ((c=*p) && (c=='/' || c=='!' || c=='#')) - { - blanks++; - p++; - if (*p=='<') // comment-after-item marker - { - blanks++; - p++; - } - if (c=='!') // end after first ! - { - break; - } - } - if (blanks>0) - { - while (blanks>2) - { - ADDCHAR(' '); - blanks--; - } - if (blanks>1) ADDCHAR('*'); - ADDCHAR(' '); - } - // copy comment line to output - ADDARRAY(p,len-(int)(p-s)); -} +static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len); +static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len); +static void startCondSection(yyscan_t yyscanner,const char *sectId); +static void endCondSection(yyscan_t yyscanner); +static void replaceAliases(yyscan_t yyscanner,const char *s); +static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static void replaceComment(yyscan_t yyscanner,int offset); -static inline int computeIndent(const char *s) -{ - int col=0; - static int tabSize=Config_getInt(TAB_SIZE); - const char *p=s; - char c; - while ((c=*p++)) - { - if (c==' ') col++; - else if (c=='\t') col+=tabSize-(col%tabSize); - else break; - } - return col; -} -static inline void copyToOutput(const char *s,int len) -{ - int i; - if (g_skip) // only add newlines. - { - for (i=0;i skip %d\n",g_lineNr); - g_lineNr++; - } - } - } - else if (len>0) - { - ADDARRAY(s,len); - static int tabSize=Config_getInt(TAB_SIZE); - for (i=0;i copy %d\n",g_lineNr); - g_lineNr++; break; - case '\t': g_col+=tabSize-(g_col%tabSize); break; - default: g_col++; break; - } - } - } -} - -static void startCondSection(const char *sectId) -{ - //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); - CondParser prs; - bool expResult = prs.parse(g_fileName,g_lineNr,sectId); - g_condStack.push(new CondCtx(g_lineNr,sectId,g_skip)); - if (!expResult) // not enabled - { - g_skip=TRUE; - } -} - -static void endCondSection() -{ - if (g_condStack.isEmpty()) - { - warn(g_fileName,g_lineNr,"Found \\endcond command without matching \\cond"); - g_skip=FALSE; - } - else - { - CondCtx *ctx = g_condStack.pop(); - g_skip=ctx->skip; - } - //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); -} - -/** copies string \a s with length \a len to the output, while - * replacing any alias commands found in the string. - */ -static void replaceAliases(const char *s) -{ - QCString result = resolveAliasCmd(s); - //printf("replaceAliases(%s)->'%s'\n",s,result.data()); - copyToOutput(result,result.length()); -} #undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); +#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); -static int yyread(char *buf,int max_size) -{ - int bytesInBuf = g_inBuf->curPos()-g_inBufPos; - int bytesToCopy = QMIN(max_size,bytesInBuf); - memcpy(buf,g_inBuf->data()+g_inBufPos,bytesToCopy); - g_inBufPos+=bytesToCopy; - return bytesToCopy; -} - -void replaceComment(int offset); %} @@ -255,55 +135,55 @@ void replaceComment(int offset); %% [^"'!\/\n\\#,\-]* { /* eat anything that is not " / , or \n */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [,] { /* eat , so we have a nice separator in long initialization lines */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "\"\"\""! { /* start of python long comment */ - if (g_lang!=SrcLangExt_Python) + if (yyextra->lang!=SrcLangExt_Python) { REJECT; } else { - g_pythonDocString = TRUE; - g_nestingCount=1; - g_commentStack.clear(); /* to be on the save side */ - copyToOutput(yytext,(int)yyleng); + yyextra->pythonDocString = TRUE; + yyextra->nestingCount=1; + yyextra->commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } ![>lang!=SrcLangExt_Fortran) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Fortran doesn't have an end comment - g_commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Fortran doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } [Cc\*][>lang!=SrcLangExt_Fortran) { REJECT; } else { /* check for fixed format; we might have some conditional as part of multiline if like C<5 .and. & */ - if (isFixedForm && (g_col == 0)) + if (yyextra->isFixedForm && (yyextra->col == 0)) { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Fortran doesn't have an end comment - g_commentStack.clear(); /* to be on the safe side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Fortran doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the safe side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } else { @@ -312,25 +192,25 @@ void replaceComment(int offset); } } !.*\n { - if (g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Fortran) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } [Cc\*].*\n { - if (g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Fortran) { REJECT; } else { - if (g_col == 0) + if (yyextra->col == 0) { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } else { @@ -339,24 +219,24 @@ void replaceComment(int offset); } } "\"" { /* start of a string */ - copyToOutput(yytext,(int)yyleng); - g_stringContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->stringContext = YY_START; BEGIN(SkipString); } ' { - copyToOutput(yytext,(int)yyleng); - g_charContext = YY_START; - if (g_lang!=SrcLangExt_VHDL) + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->charContext = YY_START; + if (yyextra->lang!=SrcLangExt_VHDL) { BEGIN(SkipChar); } } \n { /* new line */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "//!"/.*\n[ \t]*"//"[\/!][^\/] | /* start C++ style special comment block */ ("///"[/]*)/[^/].*\n[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */ - if (g_mlBrief) + if (yyextra->mlBrief) { REJECT; // bail out if we do not need to convert } @@ -367,190 +247,190 @@ void replaceComment(int offset); { while (i<(int)yyleng && yytext[i]=='/') i++; } - g_blockHeadCol=g_col; - copyToOutput("/**",3); - replaceAliases(yytext+i); - g_inSpecialComment=TRUE; + yyextra->blockHeadCol=yyextra->col; + copyToOutput(yyscanner,"/**",3); + replaceAliases(yyscanner,yytext+i); + yyextra->inSpecialComment=TRUE; //BEGIN(SComment); - g_readLineCtx=SComment; + yyextra->readLineCtx=SComment; BEGIN(ReadLine); } } "//##Documentation".*/\n { /* Start of Rational Rose ANSI C++ comment block */ - if (g_mlBrief) REJECT; + if (yyextra->mlBrief) REJECT; int i=17; //=strlen("//##Documentation"); - g_blockHeadCol=g_col; - copyToOutput("/**",3); - replaceAliases(yytext+i); - g_inRoseComment=TRUE; + yyextra->blockHeadCol=yyextra->col; + copyToOutput(yyscanner,"/**",3); + replaceAliases(yyscanner,yytext+i); + yyextra->inRoseComment=TRUE; BEGIN(SComment); } "//"[!\/]/.*\n[ \t]*"//"[|\/][ \t]*[@\\]"}" { // next line contains an end marker, see bug 752712 - g_inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; - copyToOutput(yytext,(int)yyleng); - g_readLineCtx=YY_START; + yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } "//"/.*\n { /* one line C++ comment */ - g_inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; - copyToOutput(yytext,(int)yyleng); - g_readLineCtx=YY_START; + yyextra->inSpecialComment=yytext[2]=='/' || yytext[2]=='!'; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } "/**/" { /* avoid matching next rule for empty C comment, see bug 711723 */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "/*"[*!]? { /* start of a C comment */ - if ((g_lang==SrcLangExt_Python) || (g_lang==SrcLangExt_Tcl)) + if ((yyextra->lang==SrcLangExt_Python) || (yyextra->lang==SrcLangExt_Tcl)) { REJECT; } - g_specialComment=(int)yyleng==3; - g_nestingCount=1; - g_commentStack.clear(); /* to be on the save side */ - copyToOutput(yytext,(int)yyleng); + yyextra->specialComment=(int)yyleng==3; + yyextra->nestingCount=1; + yyextra->commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } "#"("#")? { - if (g_lang!=SrcLangExt_Python) + if (yyextra->lang!=SrcLangExt_Python) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Python doesn't have an end comment for # - g_commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Python doesn't have an end comment for # + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } "--!" { - if (g_lang!=SrcLangExt_VHDL) + if (yyextra->lang!=SrcLangExt_VHDL) { REJECT; } else { - g_vhdl = TRUE; - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // VHDL doesn't have an end comment - g_commentStack.clear(); /* to be on the save side */ + yyextra->vhdl = TRUE; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // VHDL doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } ![>lang!=SrcLangExt_Fortran) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount=0; // Fortran doesn't have an end comment - g_commentStack.clear(); /* to be on the save side */ + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount=0; // Fortran doesn't have an end comment + yyextra->commentStack.clear(); /* to be on the save side */ BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } } "{@code"/[ \t\n] { - copyToOutput("@code",5); - g_lastCommentContext = YY_START; - g_javaBlock=1; - g_blockName=&yytext[1]; + copyToOutput(yyscanner,"@code",5); + yyextra->lastCommentContext = YY_START; + yyextra->javaBlock=1; + yyextra->blockName=&yytext[1]; BEGIN(VerbatimCode); } [\\@]("dot"|"code"|"msc"|"startuml")/[^a-z_A-Z0-9] { /* start of a verbatim block */ - copyToOutput(yytext,(int)yyleng); - g_lastCommentContext = YY_START; - g_javaBlock=0; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->lastCommentContext = YY_START; + yyextra->javaBlock=0; if (qstrcmp(&yytext[1],"startuml")==0) { - g_blockName="uml"; + yyextra->blockName="uml"; } else { - g_blockName=&yytext[1]; + yyextra->blockName=&yytext[1]; } BEGIN(VerbatimCode); } [\\@]("f$"|"f["|"f{") { - copyToOutput(yytext,(int)yyleng); - g_blockName=&yytext[1]; - if (g_blockName.at(1)=='[') + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->blockName=&yytext[1]; + if (yyextra->blockName.at(1)=='[') { - g_blockName.at(1)=']'; + yyextra->blockName.at(1)=']'; } - else if (g_blockName.at(1)=='{') + else if (yyextra->blockName.at(1)=='{') { - g_blockName.at(1)='}'; + yyextra->blockName.at(1)='}'; } - g_lastCommentContext = YY_START; + yyextra->lastCommentContext = YY_START; BEGIN(Verbatim); } [\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly")/[^a-z_A-Z0-9] { /* start of a verbatim block */ - copyToOutput(yytext,(int)yyleng); - g_blockName=&yytext[1]; - g_lastCommentContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->blockName=&yytext[1]; + yyextra->lastCommentContext = YY_START; BEGIN(Verbatim); } . { /* any other character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"f$"|"f]"|"f}") { /* end of verbatim block */ - copyToOutput(yytext,(int)yyleng); - if (&yytext[1]==g_blockName) // end of formula + copyToOutput(yyscanner,yytext,(int)yyleng); + if (&yytext[1]==yyextra->blockName) // end of formula { - BEGIN(g_lastCommentContext); + BEGIN(yyextra->lastCommentContext); } - else if (&yytext[4]==g_blockName) + else if (&yytext[4]==yyextra->blockName) { - BEGIN(g_lastCommentContext); + BEGIN(yyextra->lastCommentContext); } } "{" { - if (g_javaBlock==0) + if (yyextra->javaBlock==0) { REJECT; } else { - g_javaBlock++; - copyToOutput(yytext,(int)yyleng); + yyextra->javaBlock++; + copyToOutput(yyscanner,yytext,(int)yyleng); } } "}" { - if (g_javaBlock==0) + if (yyextra->javaBlock==0) { REJECT; } else { - g_javaBlock--; - if (g_javaBlock==0) + yyextra->javaBlock--; + if (yyextra->javaBlock==0) { - copyToOutput(" @endcode ",10); - BEGIN(g_lastCommentContext); + copyToOutput(yyscanner," @endcode ",10); + BEGIN(yyextra->lastCommentContext); } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } } [\\@]("enddot"|"endcode"|"endmsc"|"enduml") { /* end of verbatim block */ - copyToOutput(yytext,(int)yyleng); - if (&yytext[4]==g_blockName) + copyToOutput(yyscanner,yytext,(int)yyleng); + if (&yytext[4]==yyextra->blockName) { - BEGIN(g_lastCommentContext); + BEGIN(yyextra->lastCommentContext); } } ^[ \t]*"//"[\!\/]? { /* skip leading comments */ - if (!g_inSpecialComment) + if (!yyextra->inSpecialComment) { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } else { @@ -559,25 +439,25 @@ void replaceComment(int offset); { l++; } - copyToOutput(yytext,l); + copyToOutput(yyscanner,yytext,l); if (yyleng-l==3) // ends with //! or /// { - copyToOutput(" * ",3); + copyToOutput(yyscanner," * ",3); } else // ends with // { - copyToOutput("//",2); + copyToOutput(yyscanner,"//",2); } } } [^@\/\\\n{}]* { /* any character not a backslash or new line or } */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \n { /* new line in verbatim block */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } ^[ \t]*"///" { - if (g_blockName=="dot" || g_blockName=="msc" || g_blockName=="uml" || g_blockName.at(0)=='f') + if (yyextra->blockName=="dot" || yyextra->blockName=="msc" || yyextra->blockName=="uml" || yyextra->blockName.at(0)=='f') { // see bug 487871, strip /// from dot images and formulas. int l=0; @@ -585,8 +465,8 @@ void replaceComment(int offset); { l++; } - copyToOutput(yytext,l); - copyToOutput(" ",3); + copyToOutput(yyscanner,yytext,l); + copyToOutput(yyscanner," ",3); } else // even slashes are verbatim (e.g. \verbatim, \code) { @@ -594,119 +474,119 @@ void replaceComment(int offset); } } . { /* any other character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \\. { /* escaped character in string */ - if (g_lang==SrcLangExt_Fortran) + if (yyextra->lang==SrcLangExt_Fortran) { unput(yytext[1]); - copyToOutput(yytext,1); + copyToOutput(yyscanner,yytext,1); } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } "\"" { /* end of string */ - copyToOutput(yytext,(int)yyleng); - BEGIN(g_stringContext); + copyToOutput(yyscanner,yytext,(int)yyleng); + BEGIN(yyextra->stringContext); } . { /* any other string character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \n { /* new line inside string (illegal for some compilers) */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \\. { /* escaped character */ - if (g_lang==SrcLangExt_Fortran) + if (yyextra->lang==SrcLangExt_Fortran) { unput(yytext[1]); - copyToOutput(yytext,1); + copyToOutput(yyscanner,yytext,1); } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } } ' { /* end of character literal */ - copyToOutput(yytext,(int)yyleng); - BEGIN(g_charContext); + copyToOutput(yyscanner,yytext,(int)yyleng); + BEGIN(yyextra->charContext); } . { /* any other string character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } \n { /* new line character */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [^\\!@*\n{\"\/]* { /* anything that is not a '*' or command */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "*"+[^*/\\@\n{\"]* { /* stars without slashes */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } "\"\"\"" { /* end of Python docstring */ - if (g_lang!=SrcLangExt_Python) + if (yyextra->lang!=SrcLangExt_Python) { REJECT; } else { - g_nestingCount--; - g_pythonDocString = FALSE; - copyToOutput(yytext,(int)yyleng); + yyextra->nestingCount--; + yyextra->pythonDocString = FALSE; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } \n { /* new line in comment */ - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); /* in case of Fortran always end of comment */ - if (g_lang==SrcLangExt_Fortran) + if (yyextra->lang==SrcLangExt_Fortran) { BEGIN(Scan); } } "/"+"*" { /* nested C comment */ - if ((g_lang==SrcLangExt_Python) || (g_lang==SrcLangExt_Tcl)) + if ((yyextra->lang==SrcLangExt_Python) || (yyextra->lang==SrcLangExt_Tcl)) { REJECT; } - g_nestingCount++; - g_commentStack.push(new CommentCtx(g_lineNr)); - copyToOutput(yytext,(int)yyleng); + yyextra->nestingCount++; + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); + copyToOutput(yyscanner,yytext,(int)yyleng); } "*"+"/" { /* end of C comment */ - if ((g_lang==SrcLangExt_Python) || (g_lang==SrcLangExt_Tcl)) + if ((yyextra->lang==SrcLangExt_Python) || (yyextra->lang==SrcLangExt_Tcl)) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); - g_nestingCount--; - if (g_nestingCount<=0) + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->nestingCount--; + if (yyextra->nestingCount<=0) { BEGIN(Scan); } else { - //g_nestingCount--; - delete g_commentStack.pop(); + //yyextra->nestingCount--; + delete yyextra->commentStack.pop(); } } } /* Python an VHDL share CComment, so special attention for ending comments is required */ "\n"/[ \t]*"#" { - if (g_lang!=SrcLangExt_VHDL) + if (yyextra->lang!=SrcLangExt_VHDL) { REJECT; } else { - if (g_vhdl) // inside --! comment + if (yyextra->vhdl) // inside --! comment { - g_vhdl = FALSE; - copyToOutput(yytext,(int)yyleng); + yyextra->vhdl = FALSE; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } else // C-type comment @@ -716,35 +596,35 @@ void replaceComment(int offset); } } "\n"/[ \t]*"-" { - if (g_lang!=SrcLangExt_Python || g_pythonDocString) + if (yyextra->lang!=SrcLangExt_Python || yyextra->pythonDocString) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } "\n"/[ \t]*[^ \t#\-] { - if (g_lang==SrcLangExt_Python) + if (yyextra->lang==SrcLangExt_Python) { - if (g_pythonDocString) + if (yyextra->pythonDocString) { REJECT; } else { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } - else if (g_lang==SrcLangExt_VHDL) + else if (yyextra->lang==SrcLangExt_VHDL) { - if (g_vhdl) // inside --! comment + if (yyextra->vhdl) // inside --! comment { - g_vhdl = FALSE; - copyToOutput(yytext,(int)yyleng); + yyextra->vhdl = FALSE; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } else // C-type comment @@ -759,122 +639,122 @@ void replaceComment(int offset); } /* removed for bug 674842 (bug was introduced in rev 768) "'" { - g_charContext = YY_START; - copyToOutput(yytext,(int)yyleng); + yyextra->charContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipChar); } "\"" { - g_stringContext = YY_START; - copyToOutput(yytext,(int)yyleng); + yyextra->stringContext = YY_START; + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(SkipString); } */ . { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } ^[ \t]*"///"[\/]*/\n { - replaceComment(0); + replaceComment(yyscanner,0); } \n[ \t]*"///"[\/]*/\n { - replaceComment(1); + replaceComment(yyscanner,1); } ^[ \t]*"///"[^\/\n]/.*\n { - replaceComment(0); - g_readLineCtx=YY_START; + replaceComment(yyscanner,0); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } \n[ \t]*"//"[\/!]("<")?[ \t]*[\\@]"}".*\n { /* See Bug 752712: end the multiline comment when finding a @} or \} command */ - copyToOutput(" */",3); - copyToOutput(yytext,(int)yyleng); - g_inSpecialComment=FALSE; - g_inRoseComment=FALSE; + copyToOutput(yyscanner," */",3); + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->inSpecialComment=FALSE; + yyextra->inRoseComment=FALSE; BEGIN(Scan); } \n[ \t]*"///"[^\/\n]/.*\n { - replaceComment(1); - g_readLineCtx=YY_START; + replaceComment(yyscanner,1); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } ^[ \t]*"//!" | // just //! ^[ \t]*"//!<"/.*\n | // or //!< something ^[ \t]*"//!"[^<]/.*\n { // or //!something - replaceComment(0); - g_readLineCtx=YY_START; + replaceComment(yyscanner,0); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } \n[ \t]*"//!" | \n[ \t]*"//!<"/.*\n | \n[ \t]*"//!"[^<\n]/.*\n { - replaceComment(1); - g_readLineCtx=YY_START; + replaceComment(yyscanner,1); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } ^[ \t]*"//##"/.*\n { - if (!g_inRoseComment) + if (!yyextra->inRoseComment) { REJECT; } else { - replaceComment(0); - g_readLineCtx=YY_START; + replaceComment(yyscanner,0); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } } \n[ \t]*"//##"/.*\n { - if (!g_inRoseComment) + if (!yyextra->inRoseComment) { REJECT; } else { - replaceComment(1); - g_readLineCtx=YY_START; + replaceComment(yyscanner,1); + yyextra->readLineCtx=YY_START; BEGIN(ReadLine); } } \n { /* end of special comment */ - copyToOutput(" */",3); - copyToOutput(yytext,(int)yyleng); - g_inSpecialComment=FALSE; - g_inRoseComment=FALSE; + copyToOutput(yyscanner," */",3); + copyToOutput(yyscanner,yytext,(int)yyleng); + yyextra->inSpecialComment=FALSE; + yyextra->inRoseComment=FALSE; BEGIN(Scan); } "*/" { - copyToOutput("*‍/",7); + copyToOutput(yyscanner,"*‍/",7); } "*" { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [^\\@\n\*]* { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [^\\@\n\*]*/\n { - copyToOutput(yytext,(int)yyleng); - BEGIN(g_readLineCtx); + copyToOutput(yyscanner,yytext,(int)yyleng); + BEGIN(yyextra->readLineCtx); } [\\@][\\@][~a-z_A-Z][a-z_A-Z0-9]*[ \t]* { // escaped command - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } [\\@]"cond"/[^a-z_A-Z0-9] { // conditional section - g_condCtx = YY_START; + yyextra->condCtx = YY_START; BEGIN(CondLine); } [\\@]"endcond"/[^a-z_A-Z0-9] { // end of conditional section - bool oldSkip=g_skip; - endCondSection(); - if (YY_START==CComment && oldSkip && !g_skip) + bool oldSkip=yyextra->skip; + endCondSection(yyscanner); + if (YY_START==CComment && oldSkip && !yyextra->skip) { //printf("** Adding start of comment!\n"); - if (g_lang!=SrcLangExt_Python && - g_lang!=SrcLangExt_VHDL && - g_lang!=SrcLangExt_Markdown && - g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Python && + yyextra->lang!=SrcLangExt_VHDL && + yyextra->lang!=SrcLangExt_Markdown && + yyextra->lang!=SrcLangExt_Fortran) { ADDCHAR('/'); ADDCHAR('*'); - if (g_specialComment) + if (yyextra->specialComment) { ADDCHAR('*'); } @@ -882,142 +762,284 @@ void replaceComment(int offset); } } [!()&| \ta-z_A-Z0-9.\-]+ { - bool oldSkip=g_skip; - startCondSection(yytext); - if ((g_condCtx==CComment || g_readLineCtx==SComment) && - !oldSkip && g_skip) + bool oldSkip=yyextra->skip; + startCondSection(yyscanner,yytext); + if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) && + !oldSkip && yyextra->skip) { - if (g_lang!=SrcLangExt_Python && - g_lang!=SrcLangExt_VHDL && - g_lang!=SrcLangExt_Markdown && - g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Python && + yyextra->lang!=SrcLangExt_VHDL && + yyextra->lang!=SrcLangExt_Markdown && + yyextra->lang!=SrcLangExt_Fortran) { ADDCHAR('*'); ADDCHAR('/'); } } - if (g_readLineCtx==SComment) + if (yyextra->readLineCtx==SComment) { BEGIN(SComment); } else { - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } [ \t]* [\\@]"cond"[ \t\r]*/\n | . { // forgot section id? - if (YY_START!=CondLine) g_condCtx=YY_START; - bool oldSkip=g_skip; - startCondSection(" "); // fake section id causing the section to be hidden unconditionally - if ((g_condCtx==CComment || g_readLineCtx==SComment) && - !oldSkip && g_skip) + if (YY_START!=CondLine) yyextra->condCtx=YY_START; + bool oldSkip=yyextra->skip; + startCondSection(yyscanner," "); // fake section id causing the section to be hidden unconditionally + if ((yyextra->condCtx==CComment || yyextra->readLineCtx==SComment) && + !oldSkip && yyextra->skip) { //printf("** Adding terminator for comment!\n"); - if (g_lang!=SrcLangExt_Python && - g_lang!=SrcLangExt_VHDL && - g_lang!=SrcLangExt_Markdown && - g_lang!=SrcLangExt_Fortran) + if (yyextra->lang!=SrcLangExt_Python && + yyextra->lang!=SrcLangExt_VHDL && + yyextra->lang!=SrcLangExt_Markdown && + yyextra->lang!=SrcLangExt_Fortran) { ADDCHAR('*'); ADDCHAR('/'); } } - if (*yytext=='\n') g_lineNr++; - if (g_readLineCtx==SComment) + if (*yytext=='\n') yyextra->lineNr++; + if (yyextra->readLineCtx==SComment) { BEGIN(SComment); } else { - BEGIN(g_condCtx); + BEGIN(yyextra->condCtx); } } [\\@][a-z_A-Z][a-z_A-Z0-9]* { // expand alias without arguments - replaceAliases(yytext); + replaceAliases(yyscanner,yytext); } [\\@][a-z_A-Z][a-z_A-Z0-9]*"{" { // expand alias with arguments - g_lastBlockContext=YY_START; - g_blockCount=1; - g_aliasString=yytext; - g_lastEscaped=0; + yyextra->lastBlockContext=YY_START; + yyextra->blockCount=1; + yyextra->aliasString=yytext; + yyextra->lastEscaped=0; BEGIN( ReadAliasArgs ); } ^[ \t]*"//"[/!]/[^\n]+ { // skip leading special comments (see bug 618079) } "*/" { // oops, end of comment in the middle of an alias? - if (g_lang==SrcLangExt_Python) + if (yyextra->lang==SrcLangExt_Python) { REJECT; } else // abort the alias, restart scanning { - copyToOutput(g_aliasString,g_aliasString.length()); - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yyextra->aliasString,yyextra->aliasString.length()); + copyToOutput(yyscanner,yytext,(int)yyleng); BEGIN(Scan); } } [^{}\n\\\*]+ { - g_aliasString+=yytext; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + yyextra->lastEscaped=FALSE; } "\\" { - if (g_lastEscaped) g_lastEscaped=FALSE; - else g_lastEscaped=TRUE; - g_aliasString+=yytext; + if (yyextra->lastEscaped) yyextra->lastEscaped=FALSE; + else yyextra->lastEscaped=TRUE; + yyextra->aliasString+=yytext; } \n { - g_aliasString+=yytext; - g_lineNr++; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + yyextra->lineNr++; + yyextra->lastEscaped=FALSE; } "{" { - g_aliasString+=yytext; - if (!g_lastEscaped) g_blockCount++; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + if (!yyextra->lastEscaped) yyextra->blockCount++; + yyextra->lastEscaped=FALSE; } "}" { - g_aliasString+=yytext; - if (!g_lastEscaped) g_blockCount--; - if (g_blockCount==0) + yyextra->aliasString+=yytext; + if (!yyextra->lastEscaped) yyextra->blockCount--; + if (yyextra->blockCount==0) { - replaceAliases(g_aliasString); - BEGIN( g_lastBlockContext ); + replaceAliases(yyscanner,yyextra->aliasString); + BEGIN( yyextra->lastBlockContext ); } - g_lastEscaped=FALSE; + yyextra->lastEscaped=FALSE; } . { - g_aliasString+=yytext; - g_lastEscaped=FALSE; + yyextra->aliasString+=yytext; + yyextra->lastEscaped=FALSE; } . { - copyToOutput(yytext,(int)yyleng); + copyToOutput(yyscanner,yytext,(int)yyleng); } %% -void replaceComment(int offset) +static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len) { - if (g_mlBrief || g_skip) + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const char *p=s; + char c; + // copy leading blanks + while ((c=*p) && (c==' ' || c=='\t' || c=='\n')) + { + ADDCHAR(c); + yyextra->lineNr += c=='\n'; + p++; + } + // replace start of comment marker by blanks and the last character by a * + int blanks=0; + while ((c=*p) && (c=='/' || c=='!' || c=='#')) + { + blanks++; + p++; + if (*p=='<') // comment-after-item marker + { + blanks++; + p++; + } + if (c=='!') // end after first ! + { + break; + } + } + if (blanks>0) + { + while (blanks>2) + { + ADDCHAR(' '); + blanks--; + } + if (blanks>1) ADDCHAR('*'); + ADDCHAR(' '); + } + // copy comment line to output + ADDARRAY(p,len-(int)(p-s)); +} + +static inline int computeIndent(const char *s) +{ + int col=0; + static int tabSize=Config_getInt(TAB_SIZE); + const char *p=s; + char c; + while ((c=*p++)) + { + if (c==' ') col++; + else if (c=='\t') col+=tabSize-(col%tabSize); + else break; + } + return col; +} + +static inline void copyToOutput(yyscan_t yyscanner,const char *s,int len) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int i; + if (yyextra->skip) // only add newlines. + { + for (i=0;i skip %d\n",g_lineNr); + yyextra->lineNr++; + } + } + } + else if (len>0) + { + ADDARRAY(s,len); + static int tabSize=Config_getInt(TAB_SIZE); + for (i=0;icol=0; + //fprintf(stderr,"---> copy %d\n",g_lineNr); + yyextra->lineNr++; break; + case '\t': yyextra->col+=tabSize-(yyextra->col%tabSize); break; + default: yyextra->col++; break; + } + } + } +} + +static void startCondSection(yyscan_t yyscanner,const char *sectId) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("startCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); + CondParser prs; + bool expResult = prs.parse(yyextra->fileName,yyextra->lineNr,sectId); + yyextra->condStack.push(new CondCtx(yyextra->lineNr,sectId,yyextra->skip)); + if (!expResult) // not enabled { - copyToOutput(yytext,(int)yyleng); + yyextra->skip=TRUE; + } +} + +static void endCondSection(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->condStack.isEmpty()) + { + warn(yyextra->fileName,yyextra->lineNr,"Found \\endcond command without matching \\cond"); + yyextra->skip=FALSE; + } + else + { + CondCtx *ctx = yyextra->condStack.pop(); + yyextra->skip=ctx->skip; + } + //printf("endCondSection: skip=%d stack=%d\n",g_skip,g_condStack.count()); +} + +/** copies string \a s with length \a len to the output, while + * replacing any alias commands found in the string. + */ +static void replaceAliases(yyscan_t yyscanner,const char *s) +{ + QCString result = resolveAliasCmd(s); + //printf("replaceAliases(%s)->'%s'\n",s,result.data()); + copyToOutput(yyscanner,result,result.length()); +} + + +static int yyread(yyscan_t yyscanner,char *buf,int max_size) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos; + int bytesToCopy = QMIN(max_size,bytesInBuf); + memcpy(buf,yyextra->inBuf->data()+yyextra->inBufPos,bytesToCopy); + yyextra->inBufPos+=bytesToCopy; + return bytesToCopy; +} + +static void replaceComment(yyscan_t yyscanner,int offset) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->mlBrief || yyextra->skip) + { + copyToOutput(yyscanner,yytext,(int)yyleng); } else { //printf("replaceComment(%s)\n",yytext); int i=computeIndent(&yytext[offset]); - if (i==g_blockHeadCol) + if (i==yyextra->blockHeadCol) { - replaceCommentMarker(yytext,(int)yyleng); + replaceCommentMarker(yyscanner,yytext,(int)yyleng); } else { - copyToOutput(" */",3); + copyToOutput(yyscanner," */",3); int i;for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); - g_inSpecialComment=FALSE; - BEGIN(Scan); - } + yyextra->inSpecialComment=FALSE; + BEGIN(Scan); + } } } @@ -1068,75 +1090,80 @@ static bool recognizeFixedForm(const char* contents) */ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) { + yyscan_t yyscanner; + commentcnvYY_state extra; + commentcnvYYlex_init_extra(&extra,&yyscanner); + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("convertCppComments(%s)\n",fileName); - g_inBuf = inBuf; - g_outBuf = outBuf; - g_inBufPos = 0; - g_col = 0; - g_mlBrief = Config_getBool(MULTILINE_CPP_IS_BRIEF); - g_skip = FALSE; - g_fileName = fileName; - g_lang = getLanguageFromFileName(fileName); - g_pythonDocString = FALSE; - g_lineNr = 1; - g_condStack.clear(); - g_condStack.setAutoDelete(TRUE); - g_commentStack.clear(); - g_commentStack.setAutoDelete(TRUE); - g_vhdl = FALSE; + yyextra->inBuf = inBuf; + yyextra->outBuf = outBuf; + yyextra->inBufPos = 0; + yyextra->col = 0; + yyextra->mlBrief = Config_getBool(MULTILINE_CPP_IS_BRIEF); + yyextra->skip = FALSE; + yyextra->fileName = fileName; + yyextra->lang = getLanguageFromFileName(fileName); + yyextra->pythonDocString = FALSE; + yyextra->lineNr = 1; + yyextra->condStack.clear(); + yyextra->condStack.setAutoDelete(TRUE); + yyextra->commentStack.clear(); + yyextra->commentStack.setAutoDelete(TRUE); + yyextra->vhdl = FALSE; printlex(yy_flex_debug, TRUE, __FILE__, fileName); - isFixedForm = FALSE; - if (g_lang==SrcLangExt_Fortran) + yyextra->isFixedForm = FALSE; + if (yyextra->lang==SrcLangExt_Fortran) { - isFixedForm = recognizeFixedForm(inBuf->data()); + yyextra->isFixedForm = recognizeFixedForm(inBuf->data()); } - if (g_lang==SrcLangExt_Markdown) + if (yyextra->lang==SrcLangExt_Markdown) { - g_nestingCount=0; + yyextra->nestingCount=0; BEGIN(CComment); - g_commentStack.push(new CommentCtx(g_lineNr)); + yyextra->commentStack.push(new CommentCtx(yyextra->lineNr)); } else { BEGIN(Scan); } - yylex(); - while (!g_condStack.isEmpty()) + yylex(yyscanner); + while (!yyextra->condStack.isEmpty()) { - CondCtx *ctx = g_condStack.pop(); + CondCtx *ctx = yyextra->condStack.pop(); QCString sectionInfo = " "; if (ctx->sectionId!=" ") sectionInfo.sprintf(" with label '%s' ",ctx->sectionId.stripWhiteSpace().data()); - warn(g_fileName,ctx->lineNr,"Conditional section%sdoes not have " + warn(yyextra->fileName,ctx->lineNr,"Conditional section%sdoes not have " "a corresponding \\endcond command within this file.",sectionInfo.data()); } - if (g_nestingCount>0 && g_lang!=SrcLangExt_Markdown) + if (yyextra->nestingCount>0 && yyextra->lang!=SrcLangExt_Markdown) { QCString tmp= "(probable line reference: "; bool first = TRUE; - while (!g_commentStack.isEmpty()) + while (!yyextra->commentStack.isEmpty()) { - CommentCtx *ctx = g_commentStack.pop(); + CommentCtx *ctx = yyextra->commentStack.pop(); if (!first) tmp += ", "; tmp += QCString().setNum(ctx->lineNr); first = FALSE; delete ctx; } tmp += ")"; - warn(g_fileName,g_lineNr,"Reached end of file while still inside a (nested) comment. " - "Nesting level %d %s",g_nestingCount,tmp.data()); + warn(yyextra->fileName,yyextra->lineNr,"Reached end of file while still inside a (nested) comment. " + "Nesting level %d %s",yyextra->nestingCount,tmp.data()); } - g_commentStack.clear(); - g_nestingCount = 0; + yyextra->commentStack.clear(); + yyextra->nestingCount = 0; if (Debug::isFlagSet(Debug::CommentCnv)) { - g_outBuf->at(g_outBuf->curPos())='\0'; + yyextra->outBuf->at(yyextra->outBuf->curPos())='\0'; Debug::print(Debug::CommentCnv,0,"-----------\nCommentCnv: %s\n" - "output=[\n%s]\n-----------\n",fileName,g_outBuf->data() + "output=[\n%s]\n-----------\n",fileName,yyextra->outBuf->data() ); } printlex(yy_flex_debug, FALSE, __FILE__, fileName); + commentcnvYYlex_destroy(yyscanner); } -- cgit v0.12 From c5854f5a8e819de82b73d14bbbd8583a36842fd5 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 18 Nov 2019 20:26:29 +0100 Subject: Replace set of g_inside* booleans with a single g_lang variable --- src/code.l | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/code.l b/src/code.l index c73911a..7c159ec 100644 --- a/src/code.l +++ b/src/code.l @@ -116,13 +116,9 @@ static int g_memCallContext; static int g_lastCContext; static int g_skipInlineInitContext; -static bool g_insideCpp; +static SrcLangExt g_lang; static bool g_insideObjC; -static bool g_insideJava; -static bool g_insideCS; -static bool g_insidePHP; static bool g_insideProtocolList; -static bool g_insideSlice; static bool g_lexInit = FALSE; @@ -951,11 +947,11 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName { className+="-p"; } - if (g_insidePHP) + if (g_lang==SrcLangExt_PHP) { className = substitute(className,"\\","::"); // for PHP namespaces } - else if (g_insideCS || g_insideJava) + else if (g_lang==SrcLangExt_CSharp || g_lang==SrcLangExt_Java) { className = substitute(className,".","::"); // for PHP namespaces } @@ -1324,7 +1320,7 @@ static void generateFunctionLink(CodeOutputInterface &ol,const char *funcName) ClassDef *ccd=0; QCString locScope=g_classScope; QCString locFunc=removeRedundantWhiteSpace(funcName); - if (g_insidePHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); + if (g_lang==SrcLangExt_PHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); QCString funcScope; QCString funcWithScope=locFunc; QCString funcWithFullScope=locFunc; @@ -1799,7 +1795,7 @@ static QCString escapeComment(const char *s) static bool skipLanguageSpecificKeyword(const QCString &kw) { - return g_insideCpp && (kw == "remove" || kw == "set" || kw == "get"); + return g_lang==SrcLangExt_Cpp && (kw == "remove" || kw == "set" || kw == "get"); } static bool isCastKeyword(const QCString &s) @@ -2181,7 +2177,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } {ID}("."{ID})* | {ID}("::"{ID})* { - if(g_insideCS) + if (g_lang==SrcLangExt_CSharp) g_curClassName=substitute(yytext,".","::"); else g_curClassName=yytext; @@ -2443,7 +2439,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_prefixed_with_this_keyword = TRUE; } {KEYWORD}/([^a-z_A-Z0-9]) { - if (g_insideJava && qstrcmp("internal",yytext) ==0) REJECT; + if (g_lang==SrcLangExt_Java && qstrcmp("internal",yytext) ==0) REJECT; if (skipLanguageSpecificKeyword(yytext)) REJECT; startFontClass("keyword"); codifyLines(yytext); @@ -2559,7 +2555,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" g_name+=yytext; } {TYPEKWSL}/{B}* { - if (!g_insideSlice) + if (g_lang!=SrcLangExt_Slice) { REJECT; } @@ -3045,7 +3041,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" endFontClass(); } {TYPEKWSL}/([^a-z_A-Z0-9]) { - if (!g_insideSlice) + if (g_lang!=SrcLangExt_Slice) { REJECT; } @@ -3825,12 +3821,8 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, g_sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } + g_lang = lang; g_insideObjC = lang==SrcLangExt_ObjC; - g_insideJava = lang==SrcLangExt_Java; - g_insideCS = lang==SrcLangExt_CSharp; - g_insidePHP = lang==SrcLangExt_PHP; - g_insideCpp = lang==SrcLangExt_Cpp; - g_insideSlice = lang==SrcLangExt_Slice; if (g_sourceFileDef) { setCurrentDoc("l00001"); -- cgit v0.12 From 26f6f1aec1be0361eac7c6ebc4de93904bf42a98 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 18 Nov 2019 20:37:37 +0100 Subject: Remove bogus flex code --- src/code.l | 10 ---------- src/commentcnv.l | 5 ----- src/commentscan.l | 9 --------- src/declinfo.l | 11 ----------- src/defargs.l | 6 ------ src/doctokenizer.l | 5 ----- src/fortrancode.l | 12 ------------ src/fortranscanner.l | 7 ------- src/pre.l | 6 ------ src/pycode.l | 9 --------- src/pyscanner.l | 7 ------- src/scanner.l | 7 ------- src/sqlcode.l | 8 -------- src/tclscanner.l | 7 ------- src/vhdlcode.l | 8 -------- src/xmlcode.l | 8 -------- 16 files changed, 125 deletions(-) diff --git a/src/code.l b/src/code.l index 7c159ec..4998421 100644 --- a/src/code.l +++ b/src/code.l @@ -3877,14 +3877,4 @@ void codeFreeScanner() #endif } - - -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void codeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "code.l.h" diff --git a/src/commentcnv.l b/src/commentcnv.l index 14abb8f..940f1a5 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -1168,10 +1168,5 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void commentcnvYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "commentcnv.l.h" diff --git a/src/commentscan.l b/src/commentscan.l index a1ce096..2b10f87 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -3281,13 +3281,4 @@ static void handleGuard(const QCString &expr) } } - - -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void commentscanYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "commentscan.l.h" diff --git a/src/declinfo.l b/src/declinfo.l index c27af39..37d0449 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -347,11 +347,6 @@ void parseFuncDecl(const QCString &decl,const SrcLangExt lang,QCString &cl,QCStr return; } -//extern "C" { // some bogus code to keep the compiler happy -// int declinfoYYwrap() { return 1 ; } -// void declinfoYYdummy() { yy_flex_realloc(0,0); } -//} - #if 0 void dumpDecl(const char *s) { @@ -385,11 +380,5 @@ int main() } #endif -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void declinfoYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "declinfo.l.h" diff --git a/src/defargs.l b/src/defargs.l index a213688..eb454ce 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -635,10 +635,4 @@ void stringToArgumentList(const char *argsString,ArgumentList& al,QCString *extr printlex(yy_flex_debug, FALSE, __FILE__, NULL); } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void defargsYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "defargs.l.h" diff --git a/src/doctokenizer.l b/src/doctokenizer.l index f0a6a83..c079c04 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -1611,10 +1611,5 @@ void doctokenizerYYendAutoList() // printlex(yy_flex_debug, FALSE, __FILE__, g_fileName); // return retval; //} -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void doctokenizerYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "doctokenizer.l.h" diff --git a/src/fortrancode.l b/src/fortrancode.l index 72feb3d..3bbecd8 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -1395,16 +1395,4 @@ void parseFortranCode(CodeOutputInterface &od,const char *,const QCString &s, return; } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void fortrancodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" -#else -extern "C" { // some bogus code to keep the compiler happy - void fortrancodeYYdummy() { yy_top_state(); } -} -#endif - #include "fortrancode.l.h" diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 39c45e7..e0d6d63 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -2836,11 +2836,4 @@ static void scanner_abort() //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void fortranscannernerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "fortranscanner.l.h" diff --git a/src/pre.l b/src/pre.l index 8bde725..cf13764 100644 --- a/src/pre.l +++ b/src/pre.l @@ -3426,11 +3426,5 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output printlex(yy_flex_debug, FALSE, __FILE__, fileName); } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy -// int preYYwrap() { return 1 ; } - void preYYdummy() { yy_flex_realloc(0,0); } -} -#endif #include "pre.l.h" diff --git a/src/pycode.l b/src/pycode.l index 4ff4fc1..4e53a27 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -1638,13 +1638,4 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/, return; } - -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void pycodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "pycode.l.h" diff --git a/src/pyscanner.l b/src/pyscanner.l index 63f11e3..5d6b303 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -1940,11 +1940,4 @@ void PythonLanguageScanner::resetCodeParserState() //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void pyscannerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "pyscanner.l.h" diff --git a/src/scanner.l b/src/scanner.l index 393d6d4..37fcb1c 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -7402,11 +7402,4 @@ void CLanguageScanner::parsePrototype(const char *text) //---------------------------------------------------------------------------- -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void scannerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "scanner.l.h" diff --git a/src/sqlcode.l b/src/sqlcode.l index 2685c46..a9e88a7 100644 --- a/src/sqlcode.l +++ b/src/sqlcode.l @@ -454,12 +454,4 @@ void resetSqlCodeParserState() yyextra->currentMemberDef = 0; } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void sqlcodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "sqlcode.l.h" diff --git a/src/tclscanner.l b/src/tclscanner.l index 37eef0d..d22c5d6 100644 --- a/src/tclscanner.l +++ b/src/tclscanner.l @@ -3138,11 +3138,4 @@ void tclDummy() yy_top_state(); } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -//---------------------------------------------------------------------------- -extern "C" { // some bogus code to keep the compiler happy - void tclscannerYYdummy() { yy_flex_realloc(0,0); } -} -#endif - #include "tclscanner.l.h" diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 9f128ea..53e1ed8 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -1634,13 +1634,5 @@ void codeFreeVhdlScanner() #endif } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void vhdlcodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4 but older than 2.5.33. These versions do NOT work with doxygen! Please use version <=2.5.4 or >=2.5.33 or expect things to be parsed wrongly!" -#endif - #include "vhdlcode.l.h" diff --git a/src/xmlcode.l b/src/xmlcode.l index bd6e8a8..2fedf2d 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -407,12 +407,4 @@ void resetXmlCodeParserState() g_currentMemberDef = 0; } -#if !defined(YY_FLEX_SUBMINOR_VERSION) -extern "C" { // some bogus code to keep the compiler happy - void xmlcodeYYdummy() { yy_flex_realloc(0,0); } -} -#elif YY_FLEX_MAJOR_VERSION<=2 && YY_FLEX_MINOR_VERSION<=5 && YY_FLEX_SUBMINOR_VERSION<33 -#error "You seem to be using a version of flex newer than 2.5.4. These are currently incompatible with 2.5.4, and do NOT work with doxygen! Please use version 2.5.4 or expect things to be parsed wrongly! A bug report has been submitted (#732132)." -#endif - #include "xmlcode.l.h" -- cgit v0.12 From 844159503ac32293f1a11761687843b1ecf5fb3e Mon Sep 17 00:00:00 2001 From: albert-github Date: Thu, 21 Nov 2019 13:50:03 +0100 Subject: Correct style in table header in case of paragraph is used In case a paragraph is used in a table header (quite unusual but can happen with 2 lines and an empty line in between), a `

          ` tag is added and therewith the layout is incorrect. This problem was detected based on #7409 This has been corrected (and tested with some available browsers FF, IE, Chrome, Opera). --- templates/html/doxygen.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/html/doxygen.css b/templates/html/doxygen.css index ffba793..2c9dfd5 100644 --- a/templates/html/doxygen.css +++ b/templates/html/doxygen.css @@ -66,6 +66,11 @@ p.startli, p.startdd { margin-top: 2px; } +th p.starttd, p.intertd, p.endtd { + font-size: 100%; + font-weight: 700; +} + p.starttd { margin-top: 0px; } -- cgit v0.12 From e7d47ec23ba1b109754d6e47b1eb4d341efc3b36 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Thu, 21 Nov 2019 20:55:57 +0100 Subject: Made code.l scanner reentrant --- src/code.h | 14 +- src/code.l | 5860 ++++++++++++++++++++++++++++--------------------------- src/doxygen.cpp | 4 +- src/scanner.l | 7 +- 4 files changed, 3009 insertions(+), 2876 deletions(-) diff --git a/src/code.h b/src/code.h index da6b80e..a86ecc0 100644 --- a/src/code.h +++ b/src/code.h @@ -26,12 +26,20 @@ class MemberDef; class QCString; class Definition; -void parseCCode(CodeOutputInterface &,const char *,const QCString &, +class CodeScanner +{ + public: + CodeScanner(); + virtual ~CodeScanner(); + void parseCCode(CodeOutputInterface &,const char *,const QCString &, SrcLangExt lang, bool isExample, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, const MemberDef *memberDef,bool showLineNumbers,const Definition *searchCtx, bool collectXRefs); -void resetCCodeParserState(); -void codeFreeScanner(); + void reset(); + private: + struct Private; + Private *p; +}; #endif diff --git a/src/code.l b/src/code.l index 4998421..32a0f7e 100644 --- a/src/code.l +++ b/src/code.l @@ -16,6 +16,8 @@ */ %option never-interactive %option prefix="codeYY" +%option reentrant +%option extra-type="struct codeYY_state *" %{ @@ -28,6 +30,7 @@ #include #include +#include "code.h" #include "entry.h" #include "doxygen.h" #include "message.h" @@ -58,76 +61,6 @@ * statics */ -static CodeOutputInterface * g_code; - -static ClassSDict *g_codeClassSDict = 0; -static QCString g_curClassName; -static QStrList g_curClassBases; - -static QCString g_parmType; -static QCString g_parmName; - -static const char * g_inputString; //!< the code fragment as text -static int g_inputPosition; //!< read offset during parsing -static int g_inputLines; //!< number of line in the code fragment -static int g_yyLineNr; //!< current line number -static int g_yyColNr; //!< current column number -static bool g_needsTermination; - -static bool g_exampleBlock; -static QCString g_exampleName; -static QCString g_exampleFile; - -static bool g_insideTemplate = FALSE; -static QCString g_type; -static QCString g_name; -static QCString g_args; -static QCString g_classScope; -static QCString g_realScope; -static QStack g_scopeStack; //!< 1 if bracket starts a scope, - // 2 for internal blocks -static int g_anchorCount; -static FileDef * g_sourceFileDef; -static bool g_lineNumbers; -static Definition * g_currentDefinition; -static MemberDef * g_currentMemberDef; -static bool g_includeCodeFragment; -static const char * g_currentFontClass; -static bool g_searchingForBody; -static bool g_insideBody; -static int g_bodyCurlyCount; -static QCString g_saveName; -static QCString g_saveType; -static QCString g_delimiter; - -static int g_bracketCount = 0; -static int g_curlyCount = 0; -static int g_sharpCount = 0; -static bool g_inFunctionTryBlock = FALSE; -static bool g_inForEachExpression = FALSE; - -static int g_lastTemplCastContext; -static int g_lastSpecialCContext; -static int g_lastStringContext; -static int g_lastSkipCppContext; -static int g_lastVerbStringContext; -static int g_lastObjCCallContext; -static int g_memCallContext; -static int g_lastCContext; -static int g_skipInlineInitContext; - -static SrcLangExt g_lang; -static bool g_insideObjC; -static bool g_insideProtocolList; - -static bool g_lexInit = FALSE; - -static QStack g_classScopeLengthStack; - -static int g_prefixed_with_this_keyword = FALSE; -static const Definition *g_searchCtx; -static bool g_collectXRefs; - // context for an Objective-C method call struct ObjCCallCtx { @@ -143,31 +76,6 @@ struct ObjCCallCtx int braceCount; }; -// globals for objective-C method calls -static ObjCCallCtx *g_currentCtx=0; -static int g_currentCtxId=0; -static int g_currentNameId=0; -static int g_currentObjId=0; -static int g_currentWordId=0; -static int g_currentCommentId=0; -static QStack g_contextStack; -static QIntDict g_contextDict; -static QIntDict g_nameDict; -static QIntDict g_objectDict; -static QIntDict g_wordDict; -static QIntDict g_commentDict; -static int g_braceCount=0; - -static void saveObjCContext(); -static void restoreObjCContext(); - -static const char *stateToString(int state); - -static QCString g_forceTagReference; - - -//------------------------------------------------------------------- - /*! Represents a stack of variable to class mappings as found in the * code. Each scope is enclosed in pushScope() and popScope() calls. * Variables are added by calling addVariables() and one can search @@ -223,7 +131,7 @@ class VariableContext m_scopes.clear(); } - void addVariable(const QCString &type,const QCString &name); + void addVariable(yyscan_t yyscanner,const QCString &type,const QCString &name); ClassDef *findVariable(const QCString &name); int count() const { return m_scopes.count(); } @@ -233,102 +141,6 @@ class VariableContext QList m_scopes; }; -void VariableContext::addVariable(const QCString &type,const QCString &name) -{ - //printf("VariableContext::addVariable(%s,%s)\n",type.data(),name.data()); - QCString ltype = type.simplifyWhiteSpace(); - QCString lname = name.simplifyWhiteSpace(); - if (ltype.left(7)=="struct ") - { - ltype = ltype.right(ltype.length()-7); - } - else if (ltype.left(6)=="union ") - { - ltype = ltype.right(ltype.length()-6); - } - if (ltype.isEmpty() || lname.isEmpty()) return; - DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' g_currentDefinition=%s\n", - ltype.data(),lname.data(),g_currentDefinition?g_currentDefinition->name().data():"")); - Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast(); - const ClassDef *varType; - int i=0; - if ( - (varType=g_codeClassSDict->find(ltype)) || // look for class definitions inside the code block - (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,ltype)) // look for global class definitions - ) - { - DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",ltype.data(),lname.data())); - scope->append(lname,varType); // add it to a list - } - else if ((i=ltype.find('<'))!=-1) - { - // probably a template class - QCString typeName(ltype.left(i)); - ClassDef* newDef = 0; - QCString templateArgs(ltype.right(ltype.length() - i)); - if ( !typeName.isEmpty() && - ( // look for class definitions inside the code block - (varType=g_codeClassSDict->find(typeName)) || - // otherwise look for global class definitions - (varType=getResolvedClass(g_currentDefinition,g_sourceFileDef,typeName,0,0,TRUE,TRUE)) - ) && // and it must be a template - !varType->templateArguments().empty()) - { - newDef = varType->getVariableInstance( templateArgs ); - } - if (newDef) - { - DBG_CTX((stderr,"** addVariable type='%s' templ='%s' name='%s'\n",typeName.data(),templateArgs.data(),lname.data())); - scope->append(lname, newDef); - } - else - { - // Doesn't seem to be a template. Try just the base name. - addVariable(typeName,name); - } - } - else - { - if (m_scopes.count()>0) // for local variables add a dummy entry so the name - // is hidden to avoid false links to global variables with the same name - // TODO: make this work for namespaces as well! - { - DBG_CTX((stderr,"** addVariable: dummy context for '%s'\n",lname.data())); - scope->append(lname,dummyContext); - } - else - { - DBG_CTX((stderr,"** addVariable: not adding variable!\n")); - } - } -} - -ClassDef *VariableContext::findVariable(const QCString &name) -{ - if (name.isEmpty()) return 0; - ClassDef *result = 0; - QListIterator sli(m_scopes); - Scope *scope; - QCString key = name; - // search from inner to outer scope - for (sli.toLast();(scope=sli.current());--sli) - { - result = scope->find(key); - if (result) - { - DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); - return result; - } - } - // nothing found -> also try the global scope - result=m_globalScope.find(name); - DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); - return result; -} - -static VariableContext g_theVarContext; -const ClassDef *VariableContext::dummyContext = (ClassDef*)0x8; - //------------------------------------------------------------------- class CallContext @@ -396,2266 +208,997 @@ class CallContext QList m_defList; }; -static CallContext g_theCallContext; - -//------------------------------------------------------------------- -/*! add class/namespace name s to the scope */ -static void pushScope(const char *s) +struct codeYY_state { - g_classScopeLengthStack.push(new int(g_classScope.length())); - if (g_classScope.isEmpty() || leftScopeMatch(s,g_classScope)) - { - g_classScope = s; - } - else - { - g_classScope += "::"; - g_classScope += s; - } - //printf("pushScope(%s) result: '%s'\n",s,g_classScope.data()); -} + CodeOutputInterface * code = 0; + + ClassSDict *codeClassSDict = 0; + QCString curClassName; + QStrList curClassBases; + + QCString parmType; + QCString parmName; + + const char * inputString = 0; //!< the code fragment as text + int 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 + bool needsTermination = FALSE; + + bool exampleBlock = FALSE; + QCString exampleName; + QCString exampleFile; + + bool insideTemplate = FALSE; + QCString type; + QCString name; + QCString args; + QCString classScope; + QCString realScope; + QStack scopeStack; //!< 1 if bracket starts a scope, + // 2 for internal blocks + int anchorCount = 0; + FileDef * sourceFileDef = 0; + bool lineNumbers = FALSE; + Definition * currentDefinition = 0; + MemberDef * currentMemberDef = 0; + bool includeCodeFragment = FALSE; + const char * currentFontClass = 0; + bool searchingForBody = FALSE; + bool insideBody = FALSE; + int bodyCurlyCount = 0; + QCString saveName; + QCString saveType; + QCString delimiter; + + int bracketCount = 0; + int curlyCount = 0; + int sharpCount = 0; + bool inFunctionTryBlock = FALSE; + bool inForEachExpression = FALSE; + + int lastTemplCastContext = 0; + int lastSpecialCContext = 0; + int lastStringContext = 0; + int lastSkipCppContext = 0; + int lastVerbStringContext = 0; + int lastObjCCallContext = 0; + int memCallContext = 0; + int lastCContext = 0; + int skipInlineInitContext = 0; + + SrcLangExt lang = SrcLangExt_Unknown; + bool insideObjC = FALSE; + bool insideProtocolList = FALSE; + + bool lexInit = FALSE; + + QStack classScopeLengthStack; + + int prefixed_with_this_keyword = FALSE; + const Definition *searchCtx = 0; + bool collectXRefs = FALSE; + + ObjCCallCtx * currentCtx=0; + int currentCtxId=0; + int currentNameId=0; + int currentObjId=0; + int currentWordId=0; + int currentCommentId=0; + QStack contextStack; + QIntDict contextDict; + QIntDict nameDict; + QIntDict objectDict; + QIntDict wordDict; + QIntDict commentDict; + int braceCount=0; + + QCString forceTagReference; + VariableContext theVarContext; + CallContext theCallContext; +}; -/*! remove the top class/namespace name from the scope */ -static void popScope() -{ - if (!g_classScopeLengthStack.isEmpty()) - { - int *pLength = g_classScopeLengthStack.pop(); - g_classScope.truncate(*pLength); - delete pLength; - } - else - { - //err("Too many end of scopes found!\n"); - } - //printf("popScope() result: '%s'\n",g_classScope.data()); -} +static bool isCastKeyword(const QCString &s); -static void setCurrentDoc(const QCString &anchor) -{ - if (Doxygen::searchIndex) - { - if (g_searchCtx) - { - g_code->setCurrentDoc(g_searchCtx,g_searchCtx->anchor(),FALSE); - } - else - { - g_code->setCurrentDoc(g_sourceFileDef,anchor,TRUE); - } - } -} +//------------------------------------------------------------------- -static void addToSearchIndex(const char *text) -{ - if (Doxygen::searchIndex) - { - g_code->addWord(text,FALSE); - } -} +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); +static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor); +static void addToSearchIndex(yyscan_t yyscanner,const char *text); +static void setClassScope(yyscan_t yyscanner,const QCString &name); +static void startCodeLine(yyscan_t yyscanner); +static void endCodeLine(yyscan_t yyscanner); +static void nextCodeLine(yyscan_t yyscanner); +static void startFontClass(yyscan_t yyscanner,const char *s); +static void endFontClass(yyscan_t yyscanner); +static void codifyLines(yyscan_t yyscanner,const char *text); +static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, + const Definition *d, + const char *text); +static void addType(yyscan_t yyscanner); +static void addParmType(yyscan_t yyscanner); +static void addUsingDirective(yyscan_t yyscanner,const char *name); +static void setParameterList(yyscan_t yyscanner,const MemberDef *md); +static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d); +static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name); +static void updateCallContextForSmartPointer(yyscan_t yyscanner); +static bool getLinkInScope(yyscan_t yyscanner,const QCString &c, // scope + const QCString &m, // member + const char *memberText, // exact text + CodeOutputInterface &ol, + const char *text, + bool varOnly=FALSE + ); +static bool getLink(yyscan_t yyscanner,const char *className, + const char *memberName, + CodeOutputInterface &ol, + const char *text=0, + bool varOnly=FALSE); +static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *clName, + bool typeOnly=FALSE,bool varOnly=FALSE); +static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,MemberDef *xmd,const char *memName); +static bool generateClassMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const Definition *def,const char *memName); +static void generateMemberLink(yyscan_t yyscanner,CodeOutputInterface &ol,const QCString &varName, + const char *memName); +static void generatePHPVariableLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *varName); +static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *funcName); +static int countLines(yyscan_t yyscanner); +static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx); +static QCString escapeName(yyscan_t yyscanner,const char *s); +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 void setClassScope(const QCString &name) -{ - //printf("setClassScope(%s)\n",name.data()); - QCString n=name; - n=n.simplifyWhiteSpace(); - int ts=n.find('<'); // start of template - int te=n.findRev('>'); // end of template - //printf("ts=%d te=%d\n",ts,te); - if (ts!=-1 && te!=-1 && te>ts) - { - // remove template from scope - n=n.left(ts)+n.right(n.length()-te-1); - } - while (!g_classScopeLengthStack.isEmpty()) - { - popScope(); - } - g_classScope.resize(0); - int i; - while ((i=n.find("::"))!=-1) - { - pushScope(n.left(i)); - n = n.mid(i+2); - } - pushScope(n); - //printf("--->New class scope '%s'\n",g_classScope.data()); -} -/*! start a new line of code, inserting a line number if g_sourceFileDef - * is TRUE. If a definition starts at the current line, then the line - * number is linked to the documentation of that definition. +/* ----------------------------------------------------------------- */ -static void startCodeLine() -{ - //if (g_currentFontClass) { g_code->endFontClass(); } - if (g_sourceFileDef && g_lineNumbers) - { - //QCString lineNumber,lineAnchor; - //lineNumber.sprintf("%05d",g_yyLineNr); - //lineAnchor.sprintf("l%05d",g_yyLineNr); - - Definition *d = g_sourceFileDef->getSourceDefinition(g_yyLineNr); - //printf("%s:startCodeLine(%d)=%p\n",g_sourceFileDef->name().data(),g_yyLineNr,d); - if (!g_includeCodeFragment && d) - { - g_currentDefinition = d; - g_currentMemberDef = g_sourceFileDef->getSourceMember(g_yyLineNr); - g_insideBody = FALSE; - g_searchingForBody = TRUE; - g_realScope = d->name(); - //g_classScope = ""; - g_type.resize(0); - g_name.resize(0); - g_args.resize(0); - g_parmType.resize(0); - g_parmName.resize(0); - //printf("Real scope: '%s'\n",g_realScope.data()); - g_bodyCurlyCount = 0; - QCString lineAnchor; - lineAnchor.sprintf("l%05d",g_yyLineNr); - if (g_currentMemberDef) - { - g_code->writeLineNumber(g_currentMemberDef->getReference(), - g_currentMemberDef->getOutputFileBase(), - g_currentMemberDef->anchor(),g_yyLineNr); - setCurrentDoc(lineAnchor); - } - else if (d->isLinkableInProject()) - { - g_code->writeLineNumber(d->getReference(), - d->getOutputFileBase(), - 0,g_yyLineNr); - setCurrentDoc(lineAnchor); - } - } - else - { - g_code->writeLineNumber(0,0,0,g_yyLineNr); - } - } - DBG_CTX((stderr,"startCodeLine(%d)\n",g_yyLineNr)); - g_code->startCodeLine(g_sourceFileDef && g_lineNumbers); - if (g_currentFontClass) - { - g_code->startFontClass(g_currentFontClass); - } -} - +#undef YY_INPUT +#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size); -static void endFontClass(); -static void startFontClass(const char *s); -static void endCodeLine() -{ - DBG_CTX((stderr,"endCodeLine(%d)\n",g_yyLineNr)); - endFontClass(); - g_code->endCodeLine(); -} +%} -static void nextCodeLine() -{ - const char * fc = g_currentFontClass; - endCodeLine(); - if (g_yyLineNr]*">" +SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) +SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ +KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property") +KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) +FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally") +FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try") +TYPEKW ("bool"|"byte"|"char"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr") +TYPEKWSL ("LocalObject"|"Object"|"Value") +CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast") +CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) +ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++" +ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|=" +LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!" +BITOP "&"|"|"|"^"|"<<"|">>"|"~" +OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} +RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" +RAWEND ")"[^ \t\(\)\\]{0,16}\" -/*! write a code fragment 'text' that may span multiple lines, inserting - * line numbers for each line. - */ -static void codifyLines(const char *text) -{ - //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text); - const char *p=text,*sp=p; - char c; - bool done=FALSE; - while (!done) - { - sp=p; - while ((c=*p++) && c!='\n') { g_yyColNr++; } - if (c=='\n') - { - g_yyLineNr++; - g_yyColNr=1; - //*(p-1)='\0'; - int l = (int)(p-sp-1); - char *tmp = (char*)malloc(l+1); - memcpy(tmp,sp,l); - tmp[l]='\0'; - g_code->codify(tmp); - free(tmp); - nextCodeLine(); - } - else - { - g_code->codify(sp); - done=TRUE; - } - } -} +%option noyywrap -/*! writes a link to a fragment \a text that may span multiple lines, inserting - * line numbers for each line. If \a text contains newlines, the link will be - * split into multiple links with the same destination, one for each line. - */ -static void writeMultiLineCodeLink(CodeOutputInterface &ol, - const Definition *d, - const char *text) -{ - static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); - TooltipManager::instance()->addTooltip(d); - QCString ref = d->getReference(); - QCString file = d->getOutputFileBase(); - QCString anchor = d->anchor(); - QCString tooltip; - if (!sourceTooltips) // fall back to simple "title" tooltips - { - tooltip = d->briefDescriptionAsTooltip(); - } - bool done=FALSE; - char *p=(char *)text; - while (!done) - { - char *sp=p; - char c; - while ((c=*p++) && c!='\n') { } - if (c=='\n') - { - g_yyLineNr++; - *(p-1)='\0'; - //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); - nextCodeLine(); - } - else - { - //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); - ol.writeCodeLink(ref,file,anchor,sp,tooltip); - done=TRUE; - } - } -} +%x SkipString +%x SkipStringS +%x SkipVerbString +%x SkipCPP +%x SkipComment +%x SkipCxxComment +%x RemoveSpecialCComment +%x StripSpecialCComment +%x Body +%x FuncCall +%x MemberCall +%x MemberCall2 +%x SkipInits +%x ClassName +%x AlignAs +%x AlignAsEnd +%x PackageName +%x ClassVar +%x CppCliTypeModifierFollowup +%x Bases +%x SkipSharp +%x ReadInclude +%x TemplDecl +%x TemplCast +%x CallEnd +%x ObjCMethod +%x ObjCParams +%x ObjCParamType +%x ObjCCall +%x ObjCMName +%x ObjCSkipStr +%x ObjCCallComment +%x OldStyleArgs +%x UsingName +%x RawString +%x InlineInit -static void addType() -{ - if (g_name=="const") { g_name.resize(0); return; } - if (!g_type.isEmpty()) g_type += ' ' ; - g_type += g_name ; - g_name.resize(0) ; - if (!g_type.isEmpty()) g_type += ' ' ; - g_type += g_args ; - g_args.resize(0) ; -} +%% -static void addParmType() -{ - if (g_parmName=="const") { g_parmName.resize(0); return; } - if (!g_parmType.isEmpty()) g_parmType += ' ' ; - g_parmType += g_parmName ; - g_parmName.resize(0) ; -} +<*>\x0d +^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") { + startFontClass(yyscanner,"preprocessor"); + yyextra->code->codify(yytext); + BEGIN( ReadInclude ); + } +("@interface"|"@implementation"|"@protocol")[ \t\n]+ { + yyextra->insideObjC=TRUE; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (!yyextra->insideTemplate) + BEGIN( ClassName ); + } +(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") { + if (yyextra->insideTemplate) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( ClassName ); + } +"property"|"event"/{BN}* { + if (yyextra->insideTemplate) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + } +(KEYWORD_CPPCLI_DATATYPE|("partial"{B}+)?"class"|"struct"|"union"|"namespace"|"interface"){B}+ { + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (!yyextra->insideTemplate) + BEGIN( ClassName ); + } +("package")[ \t\n]+ { + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( PackageName ); + } +\n { + if (!yyextra->insideObjC) REJECT; + codifyLines(yyscanner,yytext); + BEGIN(Body); + } +"-"|"+" { + if (!yyextra->insideObjC || yyextra->insideBody) + { + yyextra->code->codify(yytext); + } + else // Start of Objective-C method + { + //printf("Method!\n"); + yyextra->code->codify(yytext); + BEGIN(ObjCMethod); + } + } +":" { + yyextra->code->codify(yytext); + BEGIN(ObjCParams); + } +"(" { + yyextra->code->codify(yytext); + BEGIN(ObjCParamType); + } +";"|"{" { + yyextra->code->codify(yytext); + if (*yytext=='{') + { + if (yyextra->searchingForBody) + { + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; + } + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + if (!yyextra->curClassName.isEmpty()) // valid class name + { + pushScope(yyscanner,yyextra->curClassName); + DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); + yyextra->scopeStack.push(SCOPEBLOCK); + } + } + yyextra->type.resize(0); + yyextra->name.resize(0); + BEGIN(Body); + } +{ID}{B}*":" { + yyextra->code->codify(yytext); + } +{TYPEKW} { + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->parmType=yytext; + } +{ID} { + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->parmType=yytext; + } +")" { + yyextra->code->codify(yytext); + BEGIN(ObjCParams); + } +{ID} { + yyextra->code->codify(yytext); + yyextra->parmName=yytext; + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + } +{ID} { + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + } +. { + yyextra->code->codify(yytext); + } +\n { + codifyLines(yyscanner,yytext); + } +[^\n\"\>]+/(">"|"\"") { + //FileInfo *f; + bool ambig; + bool found=FALSE; + //QCString absPath = yytext; + //if (yyextra->sourceFileDef && QDir::isRelativePath(absPath)) + //{ + // absPath = QDir::cleanDirPath(yyextra->sourceFileDef->getPath()+"/"+absPath); + //} -static void addUsingDirective(const char *name) -{ - if (g_sourceFileDef && name) - { - NamespaceDef *nd = Doxygen::namespaceSDict->find(name); - if (nd) - { - g_sourceFileDef->addUsingDirective(nd); - } - } -} + FileDef *fd=findFileDef(Doxygen::inputNameDict,yytext,ambig); + //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd); + if (fd && fd->isLinkable()) + { + if (ambig) // multiple input files match the name + { + //printf("===== yes %s is ambiguous\n",yytext); + QCString name = QDir::cleanDirPath(yytext).utf8(); + if (!name.isEmpty() && yyextra->sourceFileDef) + { + FileName *fn = Doxygen::inputNameDict->find(name); + if (fn) + { + FileNameIterator fni(*fn); + // for each include name + for (fni.toFirst();!found && (fd=fni.current());++fni) + { + // see if this source file actually includes the file + found = yyextra->sourceFileDef->isIncluded(fd->absFilePath()); + //printf(" include file %s found=%d\n",fd->absFilePath().data(),found); + } + } + } + } + else // not ambiguous + { + found = TRUE; + } + } + //printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "",found); + if (found) + { + writeMultiLineCodeLink(yyscanner,*yyextra->code,fd,yytext); + } + else + { + yyextra->code->codify(yytext); + } + char c=yyinput(yyscanner); + QCString text; + text+=c; + yyextra->code->codify(text); + endFontClass(yyscanner); + BEGIN( Body ); + } +^[ \t]*"#" { + startFontClass(yyscanner,"preprocessor"); + yyextra->lastSkipCppContext = YY_START; + yyextra->code->codify(yytext); + BEGIN( SkipCPP ) ; + } +. { + yyextra->code->codify(yytext); + } +[^\n\/\\]+ { + yyextra->code->codify(yytext); + } +\\[\r]?\n { + codifyLines(yyscanner,yytext); + } +"//" { + yyextra->code->codify(yytext); + } +"{" { + yyextra->theVarContext.pushScope(); -static void setParameterList(const MemberDef *md) -{ - g_classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; - for (const Argument &a : md->argumentList()) - { - g_parmName = a.name; - g_parmType = a.type; - int i = g_parmType.find('*'); - if (i!=-1) g_parmType = g_parmType.left(i); - i = g_parmType.find('&'); - if (i!=-1) g_parmType = g_parmType.left(i); - g_parmType.stripPrefix("const "); - g_parmType=g_parmType.stripWhiteSpace(); - g_theVarContext.addVariable(g_parmType,g_parmName); - } -} + DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); + yyextra->scopeStack.push(INNERBLOCK); -static const ClassDef *stripClassName(const char *s,Definition *d=g_currentDefinition) -{ - int pos=0; - QCString type = s; - QCString className; - QCString templSpec; - while (extractClassNameFromType(type,pos,className,templSpec)!=-1) - { - QCString clName=className+templSpec; - const ClassDef *cd=0; - if (!g_classScope.isEmpty()) - { - cd=getResolvedClass(d,g_sourceFileDef,g_classScope+"::"+clName); - } - if (cd==0) - { - cd=getResolvedClass(d,g_sourceFileDef,clName); - } - //printf("stripClass trying '%s' = %p\n",clName.data(),cd); - if (cd) - { - return cd; - } - } + if (yyextra->searchingForBody) + { + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; + } + yyextra->code->codify(yytext); + if (yyextra->insideBody) + { + yyextra->bodyCurlyCount++; + } + yyextra->type.resize(0); + yyextra->name.resize(0); + BEGIN( Body ); + } +"}" { + yyextra->theVarContext.popScope(); + yyextra->type.resize(0); + yyextra->name.resize(0); - return 0; -} + int *scope = yyextra->scopeStack.pop(); + DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); + if (scope==SCOPEBLOCK || scope==CLASSBLOCK) + { + popScope(yyscanner); + } -static MemberDef *setCallContextForVar(const QCString &name) -{ - if (name.isEmpty()) return 0; - DBG_CTX((stderr,"setCallContextForVar(%s) g_classScope=%s\n",name.data(),g_classScope.data())); + yyextra->code->codify(yytext); - int scopeEnd = name.findRev("::"); - if (scopeEnd!=-1) // name with explicit scope - { - QCString scope = name.left(scopeEnd); - QCString locName = name.right(name.length()-scopeEnd-2); - //printf("explicit scope: name=%s scope=%s\n",locName.data(),scope.data()); - ClassDef *mcd = getClass(scope); - if (mcd && !locName.isEmpty()) - { - MemberDef *md=mcd->getMemberByName(locName); - if (md) - { - //printf("name=%s scope=%s\n",locName.data(),scope.data()); - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - return md; - } - } - else // check namespace as well - { - const NamespaceDef *mnd = getResolvedNamespace(scope); - if (mnd && !locName.isEmpty()) - { - MemberDef *md=mnd->getMemberByName(locName); - if (md) - { - //printf("name=%s scope=%s\n",locName.data(),scope.data()); - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - return md; - } - } - } - } - - MemberName *mn; - ClassDef *mcd = g_theVarContext.findVariable(name); - if (mcd) // local variable - { - DBG_CTX((stderr,"local variable?\n")); - if (mcd!=VariableContext::dummyContext) - { - DBG_CTX((stderr,"local var '%s' mcd=%s\n",name.data(),mcd->name().data())); - g_theCallContext.setScope(mcd); - } - } - else - { - DBG_CTX((stderr,"class member? scope=%s\n",g_classScope.data())); - // look for a class member - mcd = getClass(g_classScope); - if (mcd) - { - DBG_CTX((stderr,"Inside class %s\n",mcd->name().data())); - MemberDef *md=mcd->getMemberByName(name); - if (md) - { - DBG_CTX((stderr,"Found member %s\n",md->name().data())); - if (g_scopeStack.top()!=CLASSBLOCK) - { - DBG_CTX((stderr,"class member '%s' mcd=%s\n",name.data(),mcd->name().data())); - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - } - return md; - } - } - } - - // look for a global member - if ((mn=Doxygen::functionNameSDict->find(name))) - { - //printf("global var '%s'\n",name.data()); - if (mn->count()==1) // global defined only once - { - MemberDef *md=mn->getFirst(); - if (!md->isStatic() || md->getBodyDef()==g_sourceFileDef) - { - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - return md; - } - return 0; - } - else if (mn->count()>1) // global defined more than once - { - MemberNameIterator it(*mn); - MemberDef *md; - for (;(md=it.current());++it) - { - //printf("mn=%p md=%p md->getBodyDef()=%p g_sourceFileDef=%p\n", - // mn,md, - // md->getBodyDef(),g_sourceFileDef); - - // in case there are multiple members we could link to, we - // only link to members if defined in the same file or - // defined as external. - if ((!md->isStatic() || md->getBodyDef()==g_sourceFileDef) && - (g_forceTagReference.isEmpty() || g_forceTagReference==md->getReference()) - ) - { - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - //printf("returning member %s in source file %s\n",md->name().data(),g_sourceFileDef->name().data()); - return md; - } - } - return 0; - } - } - return 0; -} - -static void updateCallContextForSmartPointer() -{ - const Definition *d = g_theCallContext.getScope(); - //printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : ""); - MemberDef *md; - if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast(d))->isSmartPointer())) - { - const ClassDef *ncd = stripClassName(md->typeString(),md->getOuterScope()); - if (ncd) - { - g_theCallContext.setScope(ncd); - //printf("Found smart pointer call %s->%s!\n",cd->name().data(),ncd->name().data()); - } - } -} + DBG_CTX((stderr,"yyextra->bodyCurlyCount=%d\n",yyextra->bodyCurlyCount)); + if (--yyextra->bodyCurlyCount<=0) + { + yyextra->insideBody=FALSE; + yyextra->currentMemberDef=0; + if (yyextra->currentDefinition) + yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope(); + } + BEGIN(Body); + } +"@end" { + //printf("End of objc scope fd=%s\n",yyextra->sourceFileDef->name().data()); + if (yyextra->sourceFileDef) + { + FileDef *fd=yyextra->sourceFileDef; + yyextra->insideObjC = fd->name().lower().right(2)==".m" || + fd->name().lower().right(3)==".mm"; + //printf("insideObjC=%d\n",yyextra->insideObjC); + } + else + { + yyextra->insideObjC = FALSE; + } + if (yyextra->insideBody) + { + yyextra->theVarContext.popScope(); -static bool getLinkInScope(const QCString &c, // scope - const QCString &m, // member - const char *memberText, // exact text - CodeOutputInterface &ol, - const char *text, - bool varOnly=FALSE - ) -{ - const MemberDef *md = 0; - const ClassDef *cd = 0; - const FileDef *fd = 0; - const NamespaceDef *nd = 0; - const GroupDef *gd = 0; - DBG_CTX((stderr,"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",c.data(),m.data(),varOnly)); - if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,g_sourceFileDef,FALSE,g_forceTagReference) && - (!varOnly || md->isVariable())) - { - if (md->isLinkable()) - { - //printf("found it %s!\n",md->qualifiedName().data()); - if (g_exampleBlock) - { - QCString anchor; - anchor.sprintf("a%d",g_anchorCount); - //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), - // g_exampleFile.data()); - if (const_cast(md)->addExample(anchor,g_exampleName,g_exampleFile)) - { - ol.writeCodeAnchor(anchor); - g_anchorCount++; - } - } + int *scope = yyextra->scopeStack.pop(); + DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); + if (scope==SCOPEBLOCK || scope==CLASSBLOCK) + { + popScope(yyscanner); + } + yyextra->insideBody=FALSE; + } - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->resolveAlias()->getFileDef() : md->getOuterScope(); - if (md->resolveAlias()->getGroupDef()) d = md->resolveAlias()->getGroupDef(); - if (d && d->isLinkable()) - { - g_theCallContext.setScope(stripClassName(md->typeString(),md->getOuterScope())); - //printf("g_currentDefinition=%p g_currentMemberDef=%p g_insideBody=%d\n", - // g_currentDefinition,g_currentMemberDef,g_insideBody); + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); - if (g_currentDefinition && g_currentMemberDef && - md!=g_currentMemberDef && g_insideBody && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(md)); - } - //printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); - - writeMultiLineCodeLink(ol,md, text ? text : memberText); - addToSearchIndex(text ? text : memberText); - return TRUE; - } - } - else // found member, but it is not linkable, so make sure content inside is not assigned - // to the previous member, see bug762760 - { - DBG_CTX((stderr,"unlinkable member %s\n",md->name().data())); - g_currentMemberDef = 0; - } - } - return FALSE; -} - -static bool getLink(const char *className, - const char *memberName, - CodeOutputInterface &ol, - const char *text=0, - bool varOnly=FALSE) -{ - //printf("getLink(%s,%s) g_curClassName=%s\n",className,memberName,g_curClassName.data()); - QCString m=removeRedundantWhiteSpace(memberName); - QCString c=className; - if (!getLinkInScope(c,m,memberName,ol,text,varOnly)) - { - if (!g_curClassName.isEmpty()) - { - if (!c.isEmpty()) c.prepend("::"); - c.prepend(g_curClassName); - return getLinkInScope(c,m,memberName,ol,text,varOnly); - } - return FALSE; - } - return TRUE; -} - -static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName, - bool typeOnly=FALSE,bool varOnly=FALSE) -{ - int i=0; - if (*clName=='~') // correct for matching negated values i.s.o. destructors. - { - g_code->codify("~"); - clName++; - } - QCString className=clName; - if (className.isEmpty()) return; - if (g_insideProtocolList) // for Obj-C - { - className+="-p"; - } - if (g_lang==SrcLangExt_PHP) - { - className = substitute(className,"\\","::"); // for PHP namespaces - } - else if (g_lang==SrcLangExt_CSharp || g_lang==SrcLangExt_Java) - { - className = substitute(className,".","::"); // for PHP namespaces - } - const ClassDef *cd=0,*lcd=0; - const MemberDef *md=0; - bool isLocal=FALSE; - - //printf("generateClassOrGlobalLink(className=%s)\n",className.data()); - if (!g_prefixed_with_this_keyword || (lcd=g_theVarContext.findVariable(className))==0) // not a local variable - { - Definition *d = g_currentDefinition; - //printf("d=%s g_sourceFileDef=%s\n",d?d->name().data():"",g_sourceFileDef?g_sourceFileDef->name().data():""); - cd = getResolvedClass(d,g_sourceFileDef,className,&md); - DBG_CTX((stderr,"non-local variable name=%s context=%d cd=%s md=%s!\n", - className.data(),g_theVarContext.count(),cd?cd->name().data():"", - md?md->name().data():"")); - if (cd==0 && md==0 && (i=className.find('<'))!=-1) - { - QCString bareName = className.left(i); //stripTemplateSpecifiersFromScope(className); - DBG_CTX((stderr,"bareName=%s\n",bareName.data())); - if (bareName!=className) - { - cd=getResolvedClass(d,g_sourceFileDef,bareName,&md); // try unspecialized version - } - } - const NamespaceDef *nd = getResolvedNamespace(className); - if (nd && nd->isLinkable()) - { - g_theCallContext.setScope(nd); - addToSearchIndex(className); - writeMultiLineCodeLink(*g_code,nd,clName); - return; - } - //printf("md=%s\n",md?md->name().data():""); - DBG_CTX((stderr,"is found as a type cd=%s nd=%s\n", - cd?cd->name().data():"", - nd?nd->name().data():"")); - if (cd==0 && md==0) // also see if it is variable or enum or enum value - { - if (getLink(g_classScope,clName,ol,clName,varOnly)) - { - return; - } - } - } - else - { - //printf("local variable!\n"); - if (lcd!=VariableContext::dummyContext) - { - //printf("non-dummy context lcd=%s!\n",lcd->name().data()); - g_theCallContext.setScope(lcd); - - // to following is needed for links to a global variable, but is - // no good for a link to a local variable that is also a global symbol. - - //if (getLink(g_classScope,clName,ol,clName)) - //{ - //return; - //} - } - isLocal=TRUE; - DBG_CTX((stderr,"is a local variable cd=%p!\n",cd)); - } - g_prefixed_with_this_keyword = FALSE; // discard the "this" prefix for the next calls - - if (cd && cd->isLinkable()) // is it a linkable class - { - DBG_CTX((stderr,"is linkable class %s\n",clName)); - if (g_exampleBlock) - { - QCString anchor; - anchor.sprintf("_a%d",g_anchorCount); - //printf("addExampleClass(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), - // g_exampleFile.data()); - if (const_cast(cd)->addExample(anchor,g_exampleName,g_exampleFile)) - { - ol.writeCodeAnchor(anchor); - g_anchorCount++; - } - } - writeMultiLineCodeLink(ol,cd,clName); - addToSearchIndex(className); - g_theCallContext.setScope(cd); - if (md) - { - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->getFileDef() : md->getOuterScope(); - if (md->getGroupDef()) d = md->getGroupDef(); - if (d && d->isLinkable() && md->isLinkable() && - g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(md)); - } - } - } - else // not a class, maybe a global member - { - DBG_CTX((stderr,"class %s not linkable! cd=%p md=%p typeOnly=%d\n",clName,cd,md,typeOnly)); - if (!isLocal && (md!=0 || (cd==0 && !typeOnly))) // not a class, see if it is a global enum/variable/typedef. - { - if (md==0) // not found as a typedef - { - md = setCallContextForVar(clName); - //printf("setCallContextForVar(%s) md=%p g_currentDefinition=%p\n",clName,md,g_currentDefinition); - if (md && g_currentDefinition) - { - DBG_CTX((stderr,"%s accessible from %s? %d md->getOuterScope=%s\n", - md->name().data(),g_currentDefinition->name().data(), - isAccessibleFrom(g_currentDefinition,g_sourceFileDef,md), - md->getOuterScope()->name().data())); - } - - if (md && g_currentDefinition && - isAccessibleFrom(g_currentDefinition,g_sourceFileDef,md)==-1) - { - md=0; // variable not accessible - } - } - if (md && (!varOnly || md->isVariable())) - { - DBG_CTX((stderr,"is a global md=%p g_currentDefinition=%s linkable=%d\n",md,g_currentDefinition?g_currentDefinition->name().data():"",md->isLinkable())); - if (md->isLinkable()) - { - QCString text; - if (!g_forceTagReference.isEmpty()) // explicit reference to symbol in tag file - { - text=g_forceTagReference; - if (text.right(4)==".tag") // strip .tag if present - { - text=text.left(text.length()-4); - } - text+=getLanguageSpecificSeparator(md->getLanguage()); - text+=clName; - const_cast(md)->setName(text); - const_cast(md)->setLocalName(text); - } - else // normal reference - { - text=clName; - } - writeMultiLineCodeLink(ol,md,text); - addToSearchIndex(clName); - if (g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(md)); - } - return; - } - } - } - - // nothing found, just write out the word - DBG_CTX((stderr,"not found!\n")); - codifyLines(clName); - addToSearchIndex(clName); - } -} - -static bool generateClassMemberLink(CodeOutputInterface &ol,MemberDef *xmd,const char *memName) -{ - // extract class definition of the return type in order to resolve - // a->b()->c() like call chains - - //printf("type='%s' args='%s' class=%s\n", - // xmd->typeString(),xmd->argsString(), - // xmd->getClassDef()->name().data()); - - if (g_exampleBlock) - { - QCString anchor; - anchor.sprintf("a%d",g_anchorCount); - //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),g_exampleName.data(), - // g_exampleFile.data()); - if (xmd->addExample(anchor,g_exampleName,g_exampleFile)) - { - ol.writeCodeAnchor(anchor); - g_anchorCount++; - } - } - - const ClassDef *typeClass = stripClassName(removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope()); - DBG_CTX((stderr,"%s -> typeName=%p\n",xmd->typeString(),typeClass)); - g_theCallContext.setScope(typeClass); - - const Definition *xd = xmd->getOuterScope()==Doxygen::globalScope ? - xmd->getFileDef() : xmd->getOuterScope(); - if (xmd->getGroupDef()) xd = xmd->getGroupDef(); - if (xd && xd->isLinkable()) - { - - //printf("g_currentDefinition=%p g_currentMemberDef=%p xmd=%p g_insideBody=%d\n",g_currentDefinition,g_currentMemberDef,xmd,g_insideBody); - - if (xmd->templateMaster()) xmd = xmd->templateMaster(); - - if (xmd->isLinkable()) - { - // add usage reference - if (g_currentDefinition && g_currentMemberDef && - /*xmd!=g_currentMemberDef &&*/ g_insideBody && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,xmd); - } - - // write the actual link - writeMultiLineCodeLink(ol,xmd,memName); - addToSearchIndex(memName); - return TRUE; - } - } - - return FALSE; -} - -static bool generateClassMemberLink(CodeOutputInterface &ol,const Definition *def,const char *memName) -{ - if (def && def->definitionType()==Definition::TypeClass) - { - const ClassDef *cd = dynamic_cast(def); - MemberDef *xmd = cd->getMemberByName(memName); - //printf("generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd); - if (xmd) - { - return generateClassMemberLink(ol,xmd,memName); - } - else - { - Definition *innerDef = cd->findInnerCompound(memName); - if (innerDef) - { - g_theCallContext.setScope(innerDef); - addToSearchIndex(memName); - writeMultiLineCodeLink(*g_code,innerDef,memName); - return TRUE; - } - } - } - else if (def && def->definitionType()==Definition::TypeNamespace) - { - const NamespaceDef *nd = dynamic_cast(def); - //printf("Looking for %s inside namespace %s\n",memName,nd->name().data()); - Definition *innerDef = nd->findInnerCompound(memName); - if (innerDef) - { - g_theCallContext.setScope(innerDef); - addToSearchIndex(memName); - writeMultiLineCodeLink(*g_code,innerDef,memName); - return TRUE; - } - } - return FALSE; -} - -static void generateMemberLink(CodeOutputInterface &ol,const QCString &varName, - char *memName) -{ - //printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n", - // varName.data(),memName,g_classScope.data()); - - if (varName.isEmpty()) return; - - // look for the variable in the current context - const ClassDef *vcd = g_theVarContext.findVariable(varName); - if (vcd) - { - if (vcd!=VariableContext::dummyContext) - { - //printf("Class found!\n"); - if (getLink(vcd->name(),memName,ol)) - { - //printf("Found result!\n"); - return; - } - if (vcd->baseClasses()) - { - BaseClassListIterator bcli(*vcd->baseClasses()); - for ( ; bcli.current() ; ++bcli) - { - if (getLink(bcli.current()->classDef->name(),memName,ol)) - { - //printf("Found result!\n"); - return; - } - } - } - } - } - else // variable not in current context, maybe it is in a parent context - { - vcd = getResolvedClass(g_currentDefinition,g_sourceFileDef,g_classScope); - if (vcd && vcd->isLinkable()) - { - //printf("Found class %s for variable '%s'\n",g_classScope.data(),varName.data()); - MemberName *vmn=Doxygen::memberNameSDict->find(varName); - if (vmn==0) - { - int vi; - QCString vn=varName; - if ((vi=vn.findRev("::"))!=-1 || (vi=vn.findRev('.'))!=-1) // explicit scope A::b(), probably static member - { - ClassDef *jcd = getClass(vn.left(vi)); - vn=vn.right(vn.length()-vi-2); - vmn=Doxygen::memberNameSDict->find(vn); - //printf("Trying name '%s' scope=%s\n",vn.data(),scope.data()); - if (vmn) - { - MemberNameIterator vmni(*vmn); - const MemberDef *vmd; - for (;(vmd=vmni.current());++vmni) - { - if (/*(vmd->isVariable() || vmd->isFunction()) && */ - vmd->getClassDef()==jcd) - { - //printf("Found variable type=%s\n",vmd->typeString()); - const ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); - if (mcd && mcd->isLinkable()) - { - if (generateClassMemberLink(ol,mcd,memName)) return; - } - } - } - } - } - } - if (vmn) - { - //printf("There is a variable with name '%s'\n",varName); - MemberNameIterator vmni(*vmn); - const MemberDef *vmd; - for (;(vmd=vmni.current());++vmni) - { - if (/*(vmd->isVariable() || vmd->isFunction()) && */ - vmd->getClassDef()==vcd) - { - //printf("Found variable type=%s\n",vmd->typeString()); - const ClassDef *mcd=stripClassName(vmd->typeString(),vmd->getOuterScope()); - if (mcd && mcd->isLinkable()) - { - if (generateClassMemberLink(ol,mcd,memName)) return; - } - } - } - } - } - } - // nothing found -> write result as is - codifyLines(memName); - addToSearchIndex(memName); - return; -} - -static void generatePHPVariableLink(CodeOutputInterface &ol,const char *varName) -{ - QCString name = varName+7; // strip $this-> - name.prepend("$"); - //printf("generatePHPVariableLink(%s) name=%s scope=%s\n",varName,name.data(),g_classScope.data()); - if (!getLink(g_classScope,name,ol,varName)) - { - codifyLines(varName); - } -} - -static void generateFunctionLink(CodeOutputInterface &ol,const char *funcName) -{ - //CodeClassDef *ccd=0; - ClassDef *ccd=0; - QCString locScope=g_classScope; - QCString locFunc=removeRedundantWhiteSpace(funcName); - if (g_lang==SrcLangExt_PHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); - QCString funcScope; - QCString funcWithScope=locFunc; - QCString funcWithFullScope=locFunc; - QCString fullScope=locScope; - DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",locScope.data(),locFunc.data())); - int len=2; - int i=locFunc.findRev("::"); - if (g_currentMemberDef && g_currentMemberDef->resolveAlias()->getClassDef() && - funcName==g_currentMemberDef->localName() && - g_currentMemberDef->getDefLine()==g_yyLineNr && - generateClassMemberLink(ol,g_currentMemberDef,funcName) - ) - { - // special case where funcName is the name of a method that is also - // defined on this line. In this case we can directly link to - // g_currentMemberDef, which is not only faster, but - // in case of overloaded methods, this will make sure that we link to - // the correct method, and thereby get the correct reimplemented relations. - // See also bug 549022. - goto exit; - } - if (i==-1) i=locFunc.findRev("."),len=1; - if (i==-1) i=locFunc.findRev("\\"),len=1; // for PHP - if (i>0) - { - funcScope=locFunc.left(i); - locFunc=locFunc.right(locFunc.length()-i-len).stripWhiteSpace(); - int ts=locScope.find('<'); // start of template - int te=locScope.findRev('>'); // end of template - //printf("ts=%d te=%d\n",ts,te); - if (ts!=-1 && te!=-1 && te>ts) - { - // remove template from scope - locScope=locScope.left(ts)+locScope.right(locScope.length()-te-1); - } - ts=funcScope.find('<'); // start of template - te=funcScope.findRev('>'); // end of template - //printf("ts=%d te=%d\n",ts,te); - if (ts!=-1 && te!=-1 && te>ts) - { - // remove template from scope - funcScope=funcScope.left(ts)+funcScope.right(funcScope.length()-te-1); - } - if (!funcScope.isEmpty()) - { - funcWithScope = funcScope+"::"+locFunc; - if (!locScope.isEmpty()) - { - fullScope=locScope+"::"+funcScope; - } - } - if (!locScope.isEmpty()) - { - funcWithFullScope = locScope+"::"+funcWithScope; - } - } - if (!fullScope.isEmpty() && (ccd=g_codeClassSDict->find(fullScope))) - { - //printf("using classScope %s\n",g_classScope.data()); - if (ccd->baseClasses()) - { - BaseClassListIterator bcli(*ccd->baseClasses()); - for ( ; bcli.current() ; ++bcli) - { - if (getLink(bcli.current()->classDef->name(),locFunc,ol,funcName)) - { - goto exit; - } - } - } - } - if (!locScope.isEmpty() && fullScope!=locScope && (ccd=g_codeClassSDict->find(locScope))) - { - //printf("using classScope %s\n",g_classScope.data()); - if (ccd->baseClasses()) - { - BaseClassListIterator bcli(*ccd->baseClasses()); - for ( ; bcli.current() ; ++bcli) - { - if (getLink(bcli.current()->classDef->name(),funcWithScope,ol,funcName)) - { - goto exit; - } - } - } - } - if (!getLink(locScope,funcWithScope,ol,funcName)) - { - generateClassOrGlobalLink(ol,funcName); - } -exit: - g_forceTagReference.resize(0); - return; -} - -/*! counts the number of lines in the input */ -static int countLines() -{ - const char *p=g_inputString; - char c; - int count=1; - while ((c=*p)) - { - p++ ; - if (c=='\n') count++; - } - if (p>g_inputString && *(p-1)!='\n') - { // last line does not end with a \n, so we add an extra - // line and explicitly terminate the line after parsing. - count++, - g_needsTermination=TRUE; - } - return count; -} - -static void endFontClass() -{ - if (g_currentFontClass) - { - g_code->endFontClass(); - g_currentFontClass=0; - } -} - -static void startFontClass(const char *s) -{ - endFontClass(); - g_code->startFontClass(s); - g_currentFontClass=s; -} - -//---------------------------------------------------------------------------- - -// recursively writes a linkified Objective-C method call -static void writeObjCMethodCall(ObjCCallCtx *ctx) -{ - if (ctx==0) return; - char c; - const char *p = ctx->format.data(); - if (!ctx->methodName.isEmpty()) - { - //printf("writeObjCMethodCall(%s) obj=%s method=%s\n", - // ctx->format.data(),ctx->objectTypeOrName.data(),ctx->methodName.data()); - if (!ctx->objectTypeOrName.isEmpty() && ctx->objectTypeOrName.at(0)!='$') - { - //printf("Looking for object=%s method=%s\n",ctx->objectTypeOrName.data(), - // ctx->methodName.data()); - ClassDef *cd = g_theVarContext.findVariable(ctx->objectTypeOrName); - if (cd==0) // not a local variable - { - if (ctx->objectTypeOrName=="self") - { - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ctx->objectType = dynamic_cast(g_currentDefinition); - } - } - else - { - ctx->objectType = getResolvedClass( - g_currentDefinition, - g_sourceFileDef, - ctx->objectTypeOrName, - &ctx->method); - } - //printf(" object is class? %p\n",ctx->objectType); - if (ctx->objectType) // found class - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - //printf(" yes->method=%s\n",ctx->method?ctx->method->name().data():""); - } - else if (ctx->method==0) // search for class variable with the same name - { - //printf(" no\n"); - //printf("g_currentDefinition=%p\n",g_currentDefinition); - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ctx->objectVar = (dynamic_cast(g_currentDefinition))->getMemberByName(ctx->objectTypeOrName); - //printf(" ctx->objectVar=%p\n",ctx->objectVar); - if (ctx->objectVar) - { - ctx->objectType = stripClassName(ctx->objectVar->typeString()); - //printf(" ctx->objectType=%p\n",ctx->objectType); - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - //printf(" ctx->method=%p\n",ctx->method); - } - } - } - } - } - else // local variable - { - //printf(" object is local variable\n"); - if (cd!=VariableContext::dummyContext && !ctx->methodName.isEmpty()) - { - ctx->method = cd->getMemberByName(ctx->methodName); - //printf(" class=%p method=%p\n",cd,ctx->method); - } - } - } - } - - //printf("["); - while ((c=*p++)) // for each character in ctx->format - { - if (c=='$') - { - char nc=*p++; - if (nc=='$') // escaped $ - { - g_code->codify("$"); - } - else // name fragment or reference to a nested call - { - if (nc=='n') // name fragment - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pName = g_nameDict.find(refId); - if (pName) - { - if (ctx->method && ctx->method->isLinkable()) - { - writeMultiLineCodeLink(*g_code,ctx->method,pName->data()); - if (g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(ctx->method)); - } - } - else - { - codifyLines(pName->data()); - } - } - else - { - //printf("Invalid name: id=%d\n",refId); - } - } - else if (nc=='o') // reference to potential object name - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pObject = g_objectDict.find(refId); - if (pObject) - { - if (*pObject=="self") - { - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ctx->objectType = dynamic_cast(g_currentDefinition); - if (ctx->objectType->categoryOf()) - { - ctx->objectType = ctx->objectType->categoryOf(); - } - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - } - } - startFontClass("keyword"); - codifyLines(pObject->data()); - endFontClass(); - } - else if (*pObject=="super") - { - if (g_currentDefinition && - g_currentDefinition->definitionType()==Definition::TypeClass) - { - ClassDef *cd = dynamic_cast(g_currentDefinition); - if (cd->categoryOf()) - { - cd = cd->categoryOf(); - } - BaseClassList *bcd = cd->baseClasses(); - if (bcd) // get direct base class (there should be only one) - { - BaseClassListIterator bli(*bcd); - BaseClassDef *bclass; - for (bli.toFirst();(bclass=bli.current());++bli) - { - if (bclass->classDef->compoundType()!=ClassDef::Protocol) - { - ctx->objectType = bclass->classDef; - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - } - } - } - } - } - startFontClass("keyword"); - codifyLines(pObject->data()); - endFontClass(); - } - else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable - { - writeMultiLineCodeLink(*g_code,ctx->objectVar,pObject->data()); - if (g_currentMemberDef && g_collectXRefs) - { - addDocCrossReference(g_currentMemberDef,const_cast(ctx->objectVar)); - } - } - else if (ctx->objectType && - ctx->objectType!=VariableContext::dummyContext && - ctx->objectType->isLinkable() - ) // object is class name - { - const ClassDef *cd = ctx->objectType; - writeMultiLineCodeLink(*g_code,cd,pObject->data()); - } - else // object still needs to be resolved - { - const ClassDef *cd = getResolvedClass(g_currentDefinition, - g_sourceFileDef, *pObject); - if (cd && cd->isLinkable()) - { - if (ctx->objectType==0) ctx->objectType=cd; - writeMultiLineCodeLink(*g_code,cd,pObject->data()); - } - else - { - codifyLines(pObject->data()); - } - } - } - else - { - //printf("Invalid object: id=%d\n",refId); - } - } - else if (nc=='c') // reference to nested call - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - ObjCCallCtx *ictx = g_contextDict.find(refId); - if (ictx) // recurse into nested call - { - writeObjCMethodCall(ictx); - if (ictx->method) // link to nested call successfully - { - // get the ClassDef representing the method's return type - if (QCString(ictx->method->typeString())=="id") - { - // see if the method name is unique, if so we link to it - MemberName *mn=Doxygen::memberNameSDict->find(ctx->methodName); - //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n", - // mn==0?-1:(int)mn->count(), - // ictx->method->name().data(), - // ctx->methodName.data()); - if (mn && mn->count()==1) // member name unique - { - ctx->method = mn->getFirst(); - } - } - else - { - ctx->objectType = stripClassName(ictx->method->typeString()); - if (ctx->objectType && !ctx->methodName.isEmpty()) - { - ctx->method = ctx->objectType->getMemberByName(ctx->methodName); - } - } - //printf(" ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType); - } - } - else - { - //printf("Invalid context: id=%d\n",refId); - } - } - else if (nc=='w') // some word - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pWord = g_wordDict.find(refId); - if (pWord) - { - codifyLines(pWord->data()); - } - } - else if (nc=='d') // comment block - { - nc=*p++; - QCString refIdStr; - while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } - p--; - int refId=refIdStr.toInt(); - QCString *pComment = g_commentDict.find(refId); - if (pComment) - { - startFontClass("comment"); - codifyLines(pComment->data()); - endFontClass(); - } - } - else // illegal marker - { - ASSERT(!"invalid escape sequence"); - } - } - } - else // normal non-marker character - { - char s[2]; - s[0]=c;s[1]=0; - codifyLines(s); - } - } - //printf("%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data()); - //printf("}=(type='%s',name='%s')", - // ctx->objectTypeOrName.data(), - // ctx->methodName.data()); -} - -// Replaces an Objective-C method name fragment s by a marker of the form -// $n12, the number (12) can later be used as a key for obtaining the name -// fragment, from g_nameDict -static QCString escapeName(const char *s) -{ - QCString result; - result.sprintf("$n%d",g_currentNameId); - g_nameDict.insert(g_currentNameId,new QCString(s)); - g_currentNameId++; - return result; -} - -static QCString escapeObject(const char *s) -{ - QCString result; - result.sprintf("$o%d",g_currentObjId); - g_objectDict.insert(g_currentObjId,new QCString(s)); - g_currentObjId++; - return result; -} - -static QCString escapeWord(const char *s) -{ - QCString result; - result.sprintf("$w%d",g_currentWordId); - g_wordDict.insert(g_currentWordId,new QCString(s)); - g_currentWordId++; - return result; -} - -static QCString escapeComment(const char *s) -{ - QCString result; - result.sprintf("$d%d",g_currentCommentId); - g_commentDict.insert(g_currentCommentId,new QCString(s)); - g_currentCommentId++; - return result; -} - -static bool skipLanguageSpecificKeyword(const QCString &kw) -{ - return g_lang==SrcLangExt_Cpp && (kw == "remove" || kw == "set" || kw == "get"); -} - -static bool isCastKeyword(const QCString &s) -{ - int i=s.find('<'); - if (i==-1) return FALSE; - QCString kw = s.left(i).stripWhiteSpace(); - return kw=="const_cast" || kw=="static_cast" || kw=="dynamic_cast" || kw=="reinterpret_cast"; -} - -/* ----------------------------------------------------------------- - */ -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); - -static int yyread(char *buf,int max_size) -{ - int c=0; - while( c < max_size && g_inputString[g_inputPosition] ) - { - *buf = g_inputString[g_inputPosition++] ; - c++; buf++; - } - return c; -} - -%} - -B [ \t] -BN [ \t\n\r] -ID "$"?[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]* -SEP ("::"|"\\") -SCOPENAME ({SEP}{BN}*)?({ID}{BN}*{SEP}{BN}*)*("~"{BN}*)?{ID} -TEMPLIST "<"[^\"\}\{\(\)\/\n\>]*">" -SCOPETNAME (((({ID}{TEMPLIST}?){BN}*)?{SEP}{BN}*)*)((~{BN}*)?{ID}) -SCOPEPREFIX ({ID}{TEMPLIST}?{BN}*{SEP}{BN}*)+ -KEYWORD_OBJC ("@public"|"@private"|"@protected"|"@class"|"@implementation"|"@interface"|"@end"|"@selector"|"@protocol"|"@optional"|"@required"|"@throw"|"@synthesize"|"@property") -KEYWORD ("asm"|"__assume"|"auto"|"class"|"const"|"delete"|"enum"|"explicit"|"extern"|"false"|"friend"|"gcnew"|"gcroot"|"set"|"get"|"inline"|"internal"|"mutable"|"namespace"|"new"|"null"|"nullptr"|"override"|"operator"|"pin_ptr"|"private"|"protected"|"public"|"raise"|"register"|"remove"|"self"|"sizeof"|"static"|"struct"|"__super"|"function"|"template"|"generic"|"this"|"true"|"typedef"|"typeid"|"typename"|"union"|"using"|"virtual"|"volatile"|"abstract"|"final"|"import"|"synchronized"|"transient"|"alignas"|"alignof"|{KEYWORD_OBJC}) -FLOWKW ("break"|"catch"|"continue"|"default"|"do"|"else"|"finally"|"return"|"switch"|"throw"|"throws"|"@catch"|"@finally") -FLOWCONDITION ("case"|"for"|"foreach"|"for each"|"goto"|"if"|"try"|"while"|"@try") -TYPEKW ("bool"|"byte"|"char"|"double"|"float"|"int"|"long"|"object"|"short"|"signed"|"unsigned"|"void"|"wchar_t"|"size_t"|"boolean"|"id"|"SEL"|"string"|"nullptr") -TYPEKWSL ("LocalObject"|"Object"|"Value") -CASTKW ("const_cast"|"dynamic_cast"|"reinterpret_cast"|"static_cast") -CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) -ARITHOP "+"|"-"|"/"|"*"|"%"|"--"|"++" -ASSIGNOP "="|"*="|"/="|"%="|"+="|"-="|"<<="|">>="|"&="|"^="|"|=" -LOGICOP "=="|"!="|">"|"<"|">="|"<="|"&&"|"||"|"!" -BITOP "&"|"|"|"^"|"<<"|">>"|"~" -OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP} -RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"(" -RAWEND ")"[^ \t\(\)\\]{0,16}\" - -%option noyywrap - -%x SkipString -%x SkipStringS -%x SkipVerbString -%x SkipCPP -%x SkipComment -%x SkipCxxComment -%x RemoveSpecialCComment -%x StripSpecialCComment -%x Body -%x FuncCall -%x MemberCall -%x MemberCall2 -%x SkipInits -%x ClassName -%x AlignAs -%x AlignAsEnd -%x PackageName -%x ClassVar -%x CppCliTypeModifierFollowup -%x Bases -%x SkipSharp -%x ReadInclude -%x TemplDecl -%x TemplCast -%x CallEnd -%x ObjCMethod -%x ObjCParams -%x ObjCParamType -%x ObjCCall -%x ObjCMName -%x ObjCSkipStr -%x ObjCCallComment -%x OldStyleArgs -%x UsingName -%x RawString -%x InlineInit - -%% - -<*>\x0d -^([ \t]*"#"[ \t]*("include"|"import")[ \t]*)("<"|"\"") { - startFontClass("preprocessor"); - g_code->codify(yytext); - BEGIN( ReadInclude ); - } -("@interface"|"@implementation"|"@protocol")[ \t\n]+ { - g_insideObjC=TRUE; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - if (!g_insideTemplate) - BEGIN( ClassName ); - } -(("public"|"private"){B}+)?("ref"|"value"|"interface"|"enum"){B}+("class"|"struct") { - if (g_insideTemplate) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( ClassName ); - } -"property"|"event"/{BN}* { - if (g_insideTemplate) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - } -(KEYWORD_CPPCLI_DATATYPE|("partial"{B}+)?"class"|"struct"|"union"|"namespace"|"interface"){B}+ { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - if (!g_insideTemplate) - BEGIN( ClassName ); - } -("package")[ \t\n]+ { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( PackageName ); - } -\n { - if (!g_insideObjC) REJECT; - codifyLines(yytext); - BEGIN(Body); - } -"-"|"+" { - if (!g_insideObjC || g_insideBody) - { - g_code->codify(yytext); - } - else // Start of Objective-C method - { - //printf("Method!\n"); - g_code->codify(yytext); - BEGIN(ObjCMethod); - } - } -":" { - g_code->codify(yytext); - BEGIN(ObjCParams); - } -"(" { - g_code->codify(yytext); - BEGIN(ObjCParamType); - } -";"|"{" { - g_code->codify(yytext); - if (*yytext=='{') - { - if (g_searchingForBody) - { - g_searchingForBody=FALSE; - g_insideBody=TRUE; - } - if (g_insideBody) g_bodyCurlyCount++; - if (!g_curClassName.isEmpty()) // valid class name - { - pushScope(g_curClassName); - DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); - g_scopeStack.push(SCOPEBLOCK); - } - } - g_type.resize(0); - g_name.resize(0); - BEGIN(Body); - } -{ID}{B}*":" { - g_code->codify(yytext); - } -{TYPEKW} { - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - g_parmType=yytext; - } -{ID} { - generateClassOrGlobalLink(*g_code,yytext); - g_parmType=yytext; - } -")" { - g_code->codify(yytext); - BEGIN(ObjCParams); - } -{ID} { - g_code->codify(yytext); - g_parmName=yytext; - g_theVarContext.addVariable(g_parmType,g_parmName); - g_parmType.resize(0);g_parmName.resize(0); - } -{ID} { - generateClassOrGlobalLink(*g_code,yytext); - } -. { - g_code->codify(yytext); - } -\n { - codifyLines(yytext); - } -[^\n\"\>]+/(">"|"\"") { - //FileInfo *f; - bool ambig; - bool found=FALSE; - //QCString absPath = yytext; - //if (g_sourceFileDef && QDir::isRelativePath(absPath)) - //{ - // absPath = QDir::cleanDirPath(g_sourceFileDef->getPath()+"/"+absPath); - //} - - FileDef *fd=findFileDef(Doxygen::inputNameDict,yytext,ambig); - //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd); - if (fd && fd->isLinkable()) - { - if (ambig) // multiple input files match the name - { - //printf("===== yes %s is ambiguous\n",yytext); - QCString name = QDir::cleanDirPath(yytext).utf8(); - if (!name.isEmpty() && g_sourceFileDef) - { - FileName *fn = Doxygen::inputNameDict->find(name); - if (fn) - { - FileNameIterator fni(*fn); - // for each include name - for (fni.toFirst();!found && (fd=fni.current());++fni) - { - // see if this source file actually includes the file - found = g_sourceFileDef->isIncluded(fd->absFilePath()); - //printf(" include file %s found=%d\n",fd->absFilePath().data(),found); - } - } - } - } - else // not ambiguous - { - found = TRUE; - } - } - //printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "",found); - if (found) - { - writeMultiLineCodeLink(*g_code,fd,yytext); - } - else - { - g_code->codify(yytext); - } - char c=yyinput(); - QCString text; - text+=c; - g_code->codify(text); - endFontClass(); - BEGIN( Body ); - } -^[ \t]*"#" { - startFontClass("preprocessor"); - g_lastSkipCppContext = YY_START; - g_code->codify(yytext); - BEGIN( SkipCPP ) ; - } -. { - g_code->codify(yytext); - } -[^\n\/\\]+ { - g_code->codify(yytext); - } -\\[\r]?\n { - codifyLines(yytext); - } -"//" { - g_code->codify(yytext); - } -"{" { - g_theVarContext.pushScope(); - - DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); - - if (g_searchingForBody) - { - g_searchingForBody=FALSE; - g_insideBody=TRUE; - } - g_code->codify(yytext); - if (g_insideBody) - { - g_bodyCurlyCount++; - } - g_type.resize(0); - g_name.resize(0); - BEGIN( Body ); - } -"}" { - g_theVarContext.popScope(); - g_type.resize(0); - g_name.resize(0); - - int *scope = g_scopeStack.pop(); - DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); - if (scope==SCOPEBLOCK || scope==CLASSBLOCK) - { - popScope(); - } - - g_code->codify(yytext); - - DBG_CTX((stderr,"g_bodyCurlyCount=%d\n",g_bodyCurlyCount)); - if (--g_bodyCurlyCount<=0) - { - g_insideBody=FALSE; - g_currentMemberDef=0; - if (g_currentDefinition) - g_currentDefinition=g_currentDefinition->getOuterScope(); - } - BEGIN(Body); - } -"@end" { - //printf("End of objc scope fd=%s\n",g_sourceFileDef->name().data()); - if (g_sourceFileDef) - { - FileDef *fd=g_sourceFileDef; - g_insideObjC = fd->name().lower().right(2)==".m" || - fd->name().lower().right(3)==".mm"; - //printf("insideObjC=%d\n",g_insideObjC); - } - else - { - g_insideObjC = FALSE; - } - if (g_insideBody) - { - g_theVarContext.popScope(); - - int *scope = g_scopeStack.pop(); - DBG_CTX((stderr,"** scope stack pop SCOPEBLOCK=%d\n",scope==SCOPEBLOCK)); - if (scope==SCOPEBLOCK || scope==CLASSBLOCK) - { - popScope(); - } - g_insideBody=FALSE; - } - - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - - g_currentMemberDef=0; - if (g_currentDefinition) - g_currentDefinition=g_currentDefinition->getOuterScope(); - BEGIN(Body); - } -";" { - g_code->codify(yytext); - g_searchingForBody=FALSE; - BEGIN( Body ); - } -[*&^%]+ { - g_type=g_curClassName.copy(); - g_name.resize(0); - g_code->codify(yytext); - BEGIN( Body ); // variable of type struct * - } -"__declspec"{B}*"("{B}*{ID}{B}*")" { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - } -{ID}("."{ID})* | -{ID}("::"{ID})* { - if (g_lang==SrcLangExt_CSharp) - g_curClassName=substitute(yytext,".","::"); - else - g_curClassName=yytext; - addType(); - if (g_curClassName=="alignas") - { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - BEGIN( AlignAs ); - } - else - { - generateClassOrGlobalLink(*g_code,yytext); - BEGIN( ClassVar ); - } - } -"(" { - g_bracketCount=1; - g_code->codify(yytext); - BEGIN( AlignAsEnd ); - } -\n { g_yyLineNr++; - codifyLines(yytext); - } -. { g_code->codify(yytext); } -"(" { g_code->codify(yytext); - g_bracketCount++; - } -")" { - g_code->codify(yytext); - if (--g_bracketCount<=0) - { - BEGIN(ClassName); - } - } -\n { g_yyLineNr++; - codifyLines(yytext); - } -. { g_code->codify(yytext); } -{ID}("\\"{ID})* { // PHP namespace - g_curClassName=substitute(yytext,"\\","::"); - g_scopeStack.push(CLASSBLOCK); - pushScope(g_curClassName); - addType(); - generateClassOrGlobalLink(*g_code,yytext); - BEGIN( ClassVar ); - } -{ID}{B}*"("{ID}")" { // Obj-C category - g_curClassName=removeRedundantWhiteSpace(yytext); - g_scopeStack.push(CLASSBLOCK); - pushScope(g_curClassName); - addType(); - generateClassOrGlobalLink(*g_code,yytext); - BEGIN( ClassVar ); - } -{ID}("."{ID})* { - g_curClassName=substitute(yytext,".","::"); - //printf("found package: %s\n",g_curClassName.data()); - addType(); - codifyLines(yytext); - } -"=" { - unput(*yytext); - BEGIN( Body ); - } -("extends"|"implements") { // Java, Slice - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_curClassBases.clear(); - BEGIN( Bases ); - } -("sealed"|"abstract")/{BN}*(":"|"{") { - DBG_CTX((stderr,"***** C++/CLI modifier %s on g_curClassName=%s\n",yytext,g_curClassName.data())); - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( CppCliTypeModifierFollowup ); - } -{ID} { - g_type = g_curClassName.copy(); - g_name = yytext; - if (g_insideBody) - { - g_theVarContext.addVariable(g_type,g_name); - } - generateClassOrGlobalLink(*g_code,yytext); - } -{B}*":"{B}* { - codifyLines(yytext); - g_curClassBases.clear(); - BEGIN( Bases ); - } -[ \t]*";" | -^{B}*/"@"{ID} | // Objective-C interface -{B}*"{"{B}* { - g_theVarContext.pushScope(); - g_code->codify(yytext); - if (YY_START==ClassVar && g_curClassName.isEmpty()) - { - g_curClassName = g_name.copy(); - } - if (g_searchingForBody) - { - g_searchingForBody=FALSE; - g_insideBody=TRUE; - } - if (g_insideBody) g_bodyCurlyCount++; - if (!g_curClassName.isEmpty()) // valid class name - { - DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n")); - g_scopeStack.push(CLASSBLOCK); - pushScope(g_curClassName); - DBG_CTX((stderr,"***** g_curClassName=%s\n",g_curClassName.data())); - if (getResolvedClass(g_currentDefinition,g_sourceFileDef,g_curClassName)==0) - { - DBG_CTX((stderr,"Adding new class %s\n",g_curClassName.data())); - ClassDef *ncd=createClassDef("",1,1, - g_curClassName,ClassDef::Class,0,0,FALSE); - g_codeClassSDict->append(g_curClassName,ncd); - // insert base classes. - char *s=g_curClassBases.first(); - while (s) - { - const ClassDef *bcd=g_codeClassSDict->find(s); - if (bcd==0) bcd=getResolvedClass(g_currentDefinition,g_sourceFileDef,s); - if (bcd && bcd!=ncd) - { - ncd->insertBaseClass(const_cast(bcd),s,Public,Normal); - } - s=g_curClassBases.next(); - } - } - //printf("g_codeClassList.count()=%d\n",g_codeClassList.count()); - } - else // not a class name -> assume inner block - { - DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); - } - g_curClassName.resize(0); - g_curClassBases.clear(); - BEGIN( Body ); - } -"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - } -{SEP}?({ID}{SEP})*{ID} { - DBG_CTX((stderr,"%s:addBase(%s)\n",g_curClassName.data(),yytext)); - g_curClassBases.inSort(yytext); - generateClassOrGlobalLink(*g_code,yytext); - } -"<" { - g_code->codify(yytext); - if (!g_insideObjC) - { - g_sharpCount=1; - BEGIN ( SkipSharp ); - } - else - { - g_insideProtocolList=TRUE; - } - } -">" { - g_code->codify(yytext); - g_insideProtocolList=FALSE; - } -"<" { - g_code->codify(yytext); - ++g_sharpCount; - } -">" { - g_code->codify(yytext); - if (--g_sharpCount<=0) - BEGIN ( Bases ); - } -"\"" { - g_code->codify(yytext); - g_lastStringContext=YY_START; - BEGIN(SkipString); - } -"\'" { - g_code->codify(yytext); - g_lastStringContext=YY_START; - BEGIN(SkipStringS); - } -"(" { - g_code->codify(yytext); - g_sharpCount=1; - BEGIN ( SkipSharp ); - } -"(" { - g_code->codify(yytext); - ++g_sharpCount; - } -")" { - g_code->codify(yytext); - if (--g_sharpCount<=0) - BEGIN ( Bases ); - } - - -"," { - g_code->codify(yytext); - } - + yyextra->currentMemberDef=0; + if (yyextra->currentDefinition) + yyextra->currentDefinition=yyextra->currentDefinition->getOuterScope(); + BEGIN(Body); + } +";" { + yyextra->code->codify(yytext); + yyextra->searchingForBody=FALSE; + BEGIN( Body ); + } +[*&^%]+ { + yyextra->type=yyextra->curClassName.copy(); + yyextra->name.resize(0); + yyextra->code->codify(yytext); + BEGIN( Body ); // variable of type struct * + } +"__declspec"{B}*"("{B}*{ID}{B}*")" { + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + } +{ID}("."{ID})* | +{ID}("::"{ID})* { + if (yyextra->lang==SrcLangExt_CSharp) + yyextra->curClassName=substitute(yytext,".","::"); + else + yyextra->curClassName=yytext; + addType(yyscanner); + if (yyextra->curClassName=="alignas") + { + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( AlignAs ); + } + else + { + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + BEGIN( ClassVar ); + } + } +"(" { + yyextra->bracketCount=1; + yyextra->code->codify(yytext); + BEGIN( AlignAsEnd ); + } +\n { yyextra->yyLineNr++; + codifyLines(yyscanner,yytext); + } +. { yyextra->code->codify(yytext); } +"(" { yyextra->code->codify(yytext); + yyextra->bracketCount++; + } +")" { + yyextra->code->codify(yytext); + if (--yyextra->bracketCount<=0) + { + BEGIN(ClassName); + } + } +\n { yyextra->yyLineNr++; + codifyLines(yyscanner,yytext); + } +. { yyextra->code->codify(yytext); } +{ID}("\\"{ID})* { // PHP namespace + yyextra->curClassName=substitute(yytext,"\\","::"); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yyextra->curClassName); + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + BEGIN( ClassVar ); + } +{ID}{B}*"("{ID}")" { // Obj-C category + yyextra->curClassName=removeRedundantWhiteSpace(yytext); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yyextra->curClassName); + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + BEGIN( ClassVar ); + } +{ID}("."{ID})* { + yyextra->curClassName=substitute(yytext,".","::"); + //printf("found package: %s\n",yyextra->curClassName.data()); + addType(yyscanner); + codifyLines(yyscanner,yytext); + } +"=" { + unput(*yytext); + BEGIN( Body ); + } +("extends"|"implements") { // Java, Slice + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->curClassBases.clear(); + BEGIN( Bases ); + } +("sealed"|"abstract")/{BN}*(":"|"{") { + DBG_CTX((stderr,"***** C++/CLI modifier %s on yyextra->curClassName=%s\n",yytext,yyextra->curClassName.data())); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( CppCliTypeModifierFollowup ); + } +{ID} { + yyextra->type = yyextra->curClassName.copy(); + yyextra->name = yytext; + if (yyextra->insideBody) + { + yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name); + } + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + } +{B}*":"{B}* { + codifyLines(yyscanner,yytext); + yyextra->curClassBases.clear(); + BEGIN( Bases ); + } +[ \t]*";" | +^{B}*/"@"{ID} | // Objective-C interface +{B}*"{"{B}* { + yyextra->theVarContext.pushScope(); + yyextra->code->codify(yytext); + if (YY_START==ClassVar && yyextra->curClassName.isEmpty()) + { + yyextra->curClassName = yyextra->name.copy(); + } + if (yyextra->searchingForBody) + { + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; + } + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + if (!yyextra->curClassName.isEmpty()) // valid class name + { + DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n")); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yyextra->curClassName); + DBG_CTX((stderr,"***** yyextra->curClassName=%s\n",yyextra->curClassName.data())); + if (getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,yyextra->curClassName)==0) + { + DBG_CTX((stderr,"Adding new class %s\n",yyextra->curClassName.data())); + ClassDef *ncd=createClassDef("",1,1, + yyextra->curClassName,ClassDef::Class,0,0,FALSE); + yyextra->codeClassSDict->append(yyextra->curClassName,ncd); + // insert base classes. + char *s=yyextra->curClassBases.first(); + while (s) + { + const ClassDef *bcd=yyextra->codeClassSDict->find(s); + if (bcd==0) bcd=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,s); + if (bcd && bcd!=ncd) + { + ncd->insertBaseClass(const_cast(bcd),s,Public,Normal); + } + s=yyextra->curClassBases.next(); + } + } + //printf("yyextra->codeClassList.count()=%d\n",yyextra->codeClassList.count()); + } + else // not a class name -> assume inner block + { + DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); + yyextra->scopeStack.push(INNERBLOCK); + } + yyextra->curClassName.resize(0); + yyextra->curClassBases.clear(); + BEGIN( Body ); + } +"virtual"|"public"|"protected"|"private"|"@public"|"@private"|"@protected" { + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + } +{SEP}?({ID}{SEP})*{ID} { + DBG_CTX((stderr,"%s:addBase(%s)\n",yyextra->curClassName.data(),yytext)); + yyextra->curClassBases.inSort(yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + } +"<" { + yyextra->code->codify(yytext); + if (!yyextra->insideObjC) + { + yyextra->sharpCount=1; + BEGIN ( SkipSharp ); + } + else + { + yyextra->insideProtocolList=TRUE; + } + } +">" { + yyextra->code->codify(yytext); + yyextra->insideProtocolList=FALSE; + } +"<" { + yyextra->code->codify(yytext); + ++yyextra->sharpCount; + } +">" { + yyextra->code->codify(yytext); + if (--yyextra->sharpCount<=0) + BEGIN ( Bases ); + } +"\"" { + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + BEGIN(SkipString); + } +"\'" { + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + BEGIN(SkipStringS); + } +"(" { + yyextra->code->codify(yytext); + yyextra->sharpCount=1; + BEGIN ( SkipSharp ); + } +"(" { + yyextra->code->codify(yytext); + ++yyextra->sharpCount; + } +")" { + yyextra->code->codify(yytext); + if (--yyextra->sharpCount<=0) + BEGIN ( Bases ); + } + + +"," { + yyextra->code->codify(yytext); + } + {SCOPEPREFIX}?"operator"{B}*"()"{B}*/"(" { - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } {SCOPEPREFIX}?"operator"/"(" { - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } {SCOPEPREFIX}?"operator"[^a-z_A-Z0-9\(\n]+/"(" { - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } ("template"|"generic")/([^a-zA-Z0-9]) { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_insideTemplate=TRUE; - g_sharpCount=0; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->insideTemplate=TRUE; + yyextra->sharpCount=0; } "using"{BN}+"namespace"{BN}+ { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); BEGIN(UsingName); } -{ID}("::"{ID})* { addUsingDirective(yytext); - generateClassOrGlobalLink(*g_code,yytext); +{ID}("::"{ID})* { addUsingDirective(yyscanner,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n")); - g_scopeStack.push(CLASSBLOCK); - pushScope(yytext); + yyextra->scopeStack.push(CLASSBLOCK); + pushScope(yyscanner,yytext); BEGIN(Body); } -\n { codifyLines(yytext); BEGIN(Body); } -. { codifyLines(yytext); BEGIN(Body); } -"$"?"this"("->"|".") { g_code->codify(yytext); // this-> for C++, this. for C# - g_prefixed_with_this_keyword = TRUE; +\n { codifyLines(yyscanner,yytext); BEGIN(Body); } +. { codifyLines(yyscanner,yytext); BEGIN(Body); } +"$"?"this"("->"|".") { yyextra->code->codify(yytext); // this-> for C++, this. for C# + yyextra->prefixed_with_this_keyword = TRUE; } {KEYWORD}/([^a-z_A-Z0-9]) { - if (g_lang==SrcLangExt_Java && qstrcmp("internal",yytext) ==0) REJECT; - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - codifyLines(yytext); + if (yyextra->lang==SrcLangExt_Java && qstrcmp("internal",yytext) ==0) REJECT; + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); if (QCString(yytext)=="typedef") { - addType(); - g_name+=yytext; + addType(yyscanner); + yyextra->name+=yytext; } - endFontClass(); + endFontClass(yyscanner); } {KEYWORD}/{B}* { - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } {KEYWORD}/{BN}*"(" { - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_name.resize(0);g_type.resize(0); + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->name.resize(0);yyextra->type.resize(0); } "in"/{BN}* { - if (!g_inForEachExpression) REJECT; - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); + if (!yyextra->inForEachExpression) REJECT; + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); // insert the variable in the parent scope, see bug 546158 - g_theVarContext.popScope(); - g_theVarContext.addVariable(g_parmType,g_parmName); - g_theVarContext.pushScope(); - g_name.resize(0);g_type.resize(0); + yyextra->theVarContext.popScope(); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + yyextra->theVarContext.pushScope(); + yyextra->name.resize(0);yyextra->type.resize(0); } {FLOWKW}/{BN}*"(" { - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - g_name.resize(0);g_type.resize(0); - g_inForEachExpression = (qstrcmp(yytext,"for each")==0 || qstrcmp(yytext, "foreach")==0); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->name.resize(0);yyextra->type.resize(0); + yyextra->inForEachExpression = (qstrcmp(yytext,"for each")==0 || qstrcmp(yytext, "foreach")==0); BEGIN(FuncCall); } {FLOWCONDITION}/{BN}*"(" { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - g_name.resize(0);g_type.resize(0); - g_inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->name.resize(0);yyextra->type.resize(0); + yyextra->inForEachExpression = (strcmp(yytext,"for each")==0 || strcmp(yytext, "foreach")==0); BEGIN(FuncCall); } {FLOWKW}/([^a-z_A-Z0-9]) { - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - if (g_inFunctionTryBlock && (qstrcmp(yytext,"catch")==0 || qstrcmp(yytext,"finally")==0)) + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (yyextra->inFunctionTryBlock && (qstrcmp(yytext,"catch")==0 || qstrcmp(yytext,"finally")==0)) { - g_inFunctionTryBlock=FALSE; + yyextra->inFunctionTryBlock=FALSE; } } {FLOWCONDITION}/([^a-z_A-Z0-9]) { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); - if (g_inFunctionTryBlock && (strcmp(yytext,"catch")==0 || strcmp(yytext,"finally")==0)) + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + if (yyextra->inFunctionTryBlock && (strcmp(yytext,"catch")==0 || strcmp(yytext,"finally")==0)) { - g_inFunctionTryBlock=FALSE; + yyextra->inFunctionTryBlock=FALSE; } } {FLOWKW}/{B}* { - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } {FLOWCONDITION}/{B}* { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - startFontClass("keywordflow"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keywordflow"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } "*"{B}*")" { // end of cast? - g_code->codify(yytext); - g_theCallContext.popScope(g_name, g_type); - g_bracketCount--; - g_parmType = g_name; + yyextra->code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->bracketCount--; + yyextra->parmType = yyextra->name; BEGIN(FuncCall); } [\\|\)\+\-\/\%\~\!] { - g_code->codify(yytext); - g_name.resize(0);g_type.resize(0); + yyextra->code->codify(yytext); + yyextra->name.resize(0);yyextra->type.resize(0); if (*yytext==')') { - g_theCallContext.popScope(g_name, g_type); - g_bracketCount--; + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->bracketCount--; BEGIN(FuncCall); } } {TYPEKW}/{B}* { - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - addType(); - g_name+=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + addType(yyscanner); + yyextra->name+=yytext; } {TYPEKWSL}/{B}* { - if (g_lang!=SrcLangExt_Slice) + if (yyextra->lang!=SrcLangExt_Slice) { REJECT; } else { - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); - addType(); - g_name+=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + addType(yyscanner); + yyextra->name+=yytext; } } "generic"/{B}*"<"[^\n\/\-\.\{\"\>]*">"{B}* { - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - g_sharpCount=0; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->sharpCount=0; BEGIN(TemplDecl); } "template"/{B}*"<"[^\n\/\-\.\{\"\>]*">"{B}* { // template<...> - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - g_sharpCount=0; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->sharpCount=0; BEGIN(TemplDecl); } "class"|"typename" { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } "<" { - g_code->codify(yytext); - g_sharpCount++; + yyextra->code->codify(yytext); + yyextra->sharpCount++; } ">" { - g_code->codify(yytext); - g_sharpCount--; - if (g_sharpCount<=0) + yyextra->code->codify(yytext); + yyextra->sharpCount--; + if (yyextra->sharpCount<=0) { BEGIN(Body); } } ">" { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - BEGIN( g_lastTemplCastContext ); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastTemplCastContext ); } {ID}("::"{ID})* { - generateClassOrGlobalLink(*g_code,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); } ("const"|"volatile"){B}* { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } [*^]* { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } {CASTKW}{B}*"<" { // static_cast( - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); - g_lastTemplCastContext = YY_START; + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); + yyextra->lastTemplCastContext = YY_START; BEGIN(TemplCast); } "$this->"{SCOPENAME}/{BN}*[;,)\]] { // PHP member variable - addType(); - generatePHPVariableLink(*g_code,yytext); - g_name+=yytext+7; + addType(yyscanner); + generatePHPVariableLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext+7; } {SCOPENAME}{B}*"<"[^\n\/\-\.\{\"\>\(]*">"("::"{ID})*/{B}* { // A *pt; if (isCastKeyword(yytext) && YY_START==Body) { REJECT; } - addType(); - generateClassOrGlobalLink(*g_code,yytext); - g_name+=yytext; + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext; } {SCOPENAME}/{BN}*[:;,)\]] { // "int var;" or "var, var2" or "debug(f) macro" , or int var : 5; - addType(); + addType(yyscanner); // changed this to generateFunctionLink, see bug 624514 - //generateClassOrGlobalLink(*g_code,yytext,FALSE,TRUE); - generateFunctionLink(*g_code,yytext); - g_name+=yytext; + //generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,FALSE,TRUE); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext; } {SCOPENAME}/{B}* { // p->func() - addType(); - generateClassOrGlobalLink(*g_code,yytext); - g_name+=yytext; + addType(yyscanner); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->name+=yytext; } "("{B}*("*"{B}*)+{SCOPENAME}*{B}*")"/{B}* { // (*p)->func() but not "if (p) ..." - g_code->codify(yytext); + 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--; QCString varname = ((QCString)yytext).mid(s,e-s+1); - addType(); - g_name=varname; + addType(yyscanner); + yyextra->name=varname; } {SCOPETNAME}{B}*"<"[^\n\/\-\.\{\"\>]*">"/{BN}*"(" | {SCOPETNAME}/{BN}*"(" { // a() or c::a() or t::a() or A\B\foo() @@ -2663,223 +1206,223 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" { REJECT; } - addType(); - generateFunctionLink(*g_code,yytext); - g_bracketCount=0; - g_args.resize(0); - g_name+=yytext; + addType(yyscanner); + generateFunctionLink(yyscanner,*yyextra->code,yytext); + yyextra->bracketCount=0; + yyextra->args.resize(0); + yyextra->name+=yytext; BEGIN( FuncCall ); } {RAWBEGIN} { QCString text=yytext; int i=text.find('R'); - g_code->codify(text.left(i+1)); - startFontClass("stringliteral"); - g_code->codify(yytext+i+1); - g_lastStringContext=YY_START; - g_inForEachExpression = FALSE; - g_delimiter = yytext+i+2; - g_delimiter=g_delimiter.left(g_delimiter.length()-1); + yyextra->code->codify(text.left(i+1)); + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext+i+1); + yyextra->lastStringContext=YY_START; + yyextra->inForEachExpression = FALSE; + yyextra->delimiter = yytext+i+2; + yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1); BEGIN( RawString ); } \" { - startFontClass("stringliteral"); - g_code->codify(yytext); - g_lastStringContext=YY_START; - g_inForEachExpression = FALSE; + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + yyextra->inForEachExpression = FALSE; BEGIN( SkipString ); } \' { - startFontClass("stringliteral"); - g_code->codify(yytext); - g_lastStringContext=YY_START; - g_inForEachExpression = FALSE; + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext); + yyextra->lastStringContext=YY_START; + yyextra->inForEachExpression = FALSE; BEGIN( SkipStringS ); } [^\"\\\r\n]* { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [^\'\\\r\n]* { - g_code->codify(yytext); + yyextra->code->codify(yytext); } "//"|"/*" { - g_code->codify(yytext); + yyextra->code->codify(yytext); } @?\" { - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastStringContext ); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastStringContext ); } \' { - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastStringContext ); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastStringContext ); } \\. { - g_code->codify(yytext); + yyextra->code->codify(yytext); } {RAWEND} { - g_code->codify(yytext); + yyextra->code->codify(yytext); QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); - if (delimiter==g_delimiter) + if (delimiter==yyextra->delimiter) { - BEGIN( g_lastStringContext ); + BEGIN( yyextra->lastStringContext ); } } -[^)\n]+ { g_code->codify(yytext); } -. { g_code->codify(yytext); } -\n { codifyLines(yytext); } +[^)\n]+ { yyextra->code->codify(yytext); } +. { yyextra->code->codify(yytext); } +\n { codifyLines(yyscanner,yytext); } [^"\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } \"\" { // escaped quote - g_code->codify(yytext); + yyextra->code->codify(yytext); } \" { // end of string - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastVerbStringContext ); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastVerbStringContext ); } . { - g_code->codify(yytext); + yyextra->code->codify(yytext); } \n { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } ":" { - g_code->codify(yytext); - g_name.resize(0);g_type.resize(0); + yyextra->code->codify(yytext); + yyextra->name.resize(0);yyextra->type.resize(0); } "<" { - if (g_insideTemplate) + if (yyextra->insideTemplate) { - g_sharpCount++; + yyextra->sharpCount++; } - g_code->codify(yytext); + yyextra->code->codify(yytext); } ">" { - if (g_insideTemplate) + if (yyextra->insideTemplate) { - if (--g_sharpCount<=0) + if (--yyextra->sharpCount<=0) { - g_insideTemplate=FALSE; + yyextra->insideTemplate=FALSE; } } - g_code->codify(yytext); + yyextra->code->codify(yytext); } "'"((\\0[Xx0-9]+)|(\\.)|(.))"'" { - startFontClass("charliteral"); - g_code->codify(yytext); - endFontClass(); + startFontClass(yyscanner,"charliteral"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } "."|"->" { if (yytext[0]=='-') // -> could be overloaded { - updateCallContextForSmartPointer(); + updateCallContextForSmartPointer(yyscanner); } - g_code->codify(yytext); - g_memCallContext = YY_START; + yyextra->code->codify(yytext); + yyextra->memCallContext = YY_START; BEGIN( MemberCall ); } {SCOPETNAME}/{BN}*"(" { - if (g_theCallContext.getScope()) + if (yyextra->theCallContext.getScope()) { - if (!generateClassMemberLink(*g_code,g_theCallContext.getScope(),yytext)) + if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext)) { - g_code->codify(yytext); - addToSearchIndex(yytext); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); } - g_name.resize(0); + yyextra->name.resize(0); } else { - g_code->codify(yytext); - addToSearchIndex(yytext); - g_name.resize(0); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); + yyextra->name.resize(0); } - g_type.resize(0); - if (g_memCallContext==Body) + yyextra->type.resize(0); + if (yyextra->memCallContext==Body) { BEGIN(FuncCall); } else { - BEGIN(g_memCallContext); + BEGIN(yyextra->memCallContext); } } {SCOPENAME}/{B}* { - if (g_theCallContext.getScope()) + if (yyextra->theCallContext.getScope()) { - DBG_CTX((stderr,"g_theCallContext.getClass()=%p\n",g_theCallContext.getScope())); - if (!generateClassMemberLink(*g_code,g_theCallContext.getScope(),yytext)) + DBG_CTX((stderr,"yyextra->theCallContext.getClass()=%p\n",yyextra->theCallContext.getScope())); + if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getScope(),yytext)) { - g_code->codify(yytext); - addToSearchIndex(yytext); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); } - g_name.resize(0); + yyextra->name.resize(0); } else { DBG_CTX((stderr,"no class context!\n")); - g_code->codify(yytext); - addToSearchIndex(yytext); - g_name.resize(0); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yytext); + yyextra->name.resize(0); } - g_type.resize(0); - BEGIN(g_memCallContext); + yyextra->type.resize(0); + BEGIN(yyextra->memCallContext); } [,=;\[] { - if (g_insideObjC && *yytext=='[') + if (yyextra->insideObjC && *yytext=='[') { //printf("Found start of ObjC call!\n"); // start of a method call - g_contextDict.setAutoDelete(TRUE); - g_nameDict.setAutoDelete(TRUE); - g_objectDict.setAutoDelete(TRUE); - g_wordDict.setAutoDelete(TRUE); - g_commentDict.setAutoDelete(TRUE); - g_contextDict.clear(); - g_nameDict.clear(); - g_objectDict.clear(); - g_wordDict.clear(); - g_commentDict.clear(); - g_currentCtxId = 0; - g_currentNameId = 0; - g_currentObjId = 0; - g_currentCtx = 0; - g_braceCount = 0; + yyextra->contextDict.setAutoDelete(TRUE); + yyextra->nameDict.setAutoDelete(TRUE); + yyextra->objectDict.setAutoDelete(TRUE); + yyextra->wordDict.setAutoDelete(TRUE); + yyextra->commentDict.setAutoDelete(TRUE); + yyextra->contextDict.clear(); + yyextra->nameDict.clear(); + yyextra->objectDict.clear(); + yyextra->wordDict.clear(); + yyextra->commentDict.clear(); + yyextra->currentCtxId = 0; + yyextra->currentNameId = 0; + yyextra->currentObjId = 0; + yyextra->currentCtx = 0; + yyextra->braceCount = 0; unput('['); BEGIN(ObjCCall); } else { - g_code->codify(yytext); - g_saveName = g_name.copy(); - g_saveType = g_type.copy(); - if (*yytext!='[' && !g_type.isEmpty()) + yyextra->code->codify(yytext); + yyextra->saveName = yyextra->name.copy(); + yyextra->saveType = yyextra->type.copy(); + if (*yytext!='[' && !yyextra->type.isEmpty()) { - //printf("g_scopeStack.bottom()=%p\n",g_scopeStack.bottom()); - //if (g_scopeStack.top()!=CLASSBLOCK) // commented out for bug731363 + //printf("yyextra->scopeStack.bottom()=%p\n",yyextra->scopeStack.bottom()); + //if (yyextra->scopeStack.top()!=CLASSBLOCK) // commented out for bug731363 { //printf("AddVariable: '%s' '%s' context=%d\n", - // g_type.data(),g_name.data(),g_theVarContext.count()); - g_theVarContext.addVariable(g_type,g_name); + // yyextra->type.data(),yyextra->name.data(),yyextra->theVarContext.count()); + yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name); } - g_name.resize(0); + yyextra->name.resize(0); } if (*yytext==';' || *yytext=='=') { - g_type.resize(0); - g_name.resize(0); + yyextra->type.resize(0); + yyextra->name.resize(0); } else if (*yytext=='[') { - g_theCallContext.pushScope(g_name, g_type); + yyextra->theCallContext.pushScope(yyextra->name, yyextra->type); } - g_args.resize(0); - g_parmType.resize(0); - g_parmName.resize(0); + yyextra->args.resize(0); + yyextra->parmType.resize(0); + yyextra->parmName.resize(0); } } /* @@ -2887,216 +1430,216 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (qstrcmp(yytext,"self")==0 || qstrcmp(yytext,"super")==0) { // TODO: get proper base class for "super" - g_theCallContext.setClass(getClass(g_curClassName)); - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); + yyextra->theCallContext.setClass(getClass(yyextra->curClassName)); + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } else { - generateClassOrGlobalLink(*g_code,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); } - g_name.resize(0); + yyextra->name.resize(0); BEGIN(ObjCMemberCall2); } "[" { - g_code->codify(yytext); - g_theCallContext.pushScope(g_name, g_type); + yyextra->code->codify(yytext); + yyextra->theCallContext.pushScope(yyscanner,yyextra->name, yyextra->type); } {ID}":"? { - g_name+=yytext; - if (g_theCallContext.getClass()) + yyextra->name+=yytext; + if (yyextra->theCallContext.getClass()) { - //printf("Calling method %s\n",g_name.data()); - if (!generateClassMemberLink(*g_code,g_theCallContext.getClass(),g_name)) + //printf("Calling method %s\n",yyextra->name.data()); + if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getClass(),yyextra->name)) { - g_code->codify(yytext); - addToSearchIndex(g_name); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yyextra->name); } } else { - g_code->codify(yytext); - addToSearchIndex(g_name); + yyextra->code->codify(yytext); + addToSearchIndex(yyscanner,yyextra->name); } - g_name.resize(0); + yyextra->name.resize(0); BEGIN(ObjCMemberCall3); } "]" { - g_theCallContext.popScope(g_name, g_type); - g_code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->code->codify(yytext); BEGIN(Body); } */ "["|"{" { - saveObjCContext(); - g_currentCtx->format+=*yytext; + saveObjCContext(yyscanner); + yyextra->currentCtx->format+=*yytext; BEGIN(ObjCCall); //printf("open\n"); } "]"|"}" { - g_currentCtx->format+=*yytext; - restoreObjCContext(); + yyextra->currentCtx->format+=*yytext; + restoreObjCContext(yyscanner); BEGIN(ObjCMName); - if (g_currentCtx==0) + if (yyextra->currentCtx==0) { // end of call - writeObjCMethodCall(g_contextDict.find(0)); + writeObjCMethodCall(yyscanner,yyextra->contextDict.find(0)); BEGIN(Body); } //printf("close\n"); } "//".* { - g_currentCtx->format+=escapeComment(yytext); + yyextra->currentCtx->format+=escapeComment(yyscanner,yytext); } "/*" { - g_lastObjCCallContext = YY_START; - g_currentCtx->comment=yytext; + yyextra->lastObjCCallContext = YY_START; + yyextra->currentCtx->comment=yytext; BEGIN(ObjCCallComment); } "*/" { - g_currentCtx->comment+=yytext; - g_currentCtx->format+=escapeComment(g_currentCtx->comment); - BEGIN(g_lastObjCCallContext); + yyextra->currentCtx->comment+=yytext; + yyextra->currentCtx->format+=escapeComment(yyscanner,yyextra->currentCtx->comment); + BEGIN(yyextra->lastObjCCallContext); } -[^*\n]+ { g_currentCtx->comment+=yytext; } -"//"|"/*" { g_currentCtx->comment+=yytext; } -\n { g_currentCtx->comment+=*yytext; } -. { g_currentCtx->comment+=*yytext; } +[^*\n]+ { yyextra->currentCtx->comment+=yytext; } +"//"|"/*" { yyextra->currentCtx->comment+=yytext; } +\n { yyextra->currentCtx->comment+=*yytext; } +. { yyextra->currentCtx->comment+=*yytext; } {ID} { - g_currentCtx->format+=escapeObject(yytext); - if (g_braceCount==0) + yyextra->currentCtx->format+=escapeObject(yyscanner,yytext); + if (yyextra->braceCount==0) { - g_currentCtx->objectTypeOrName=yytext; - //printf("new type=%s\n",g_currentCtx->objectTypeOrName.data()); + yyextra->currentCtx->objectTypeOrName=yytext; + //printf("new type=%s\n",yyextra->currentCtx->objectTypeOrName.data()); BEGIN(ObjCMName); } } {ID}/{BN}*"]" { - if (g_braceCount==0 && - g_currentCtx->methodName.isEmpty()) + if (yyextra->braceCount==0 && + yyextra->currentCtx->methodName.isEmpty()) { - g_currentCtx->methodName=yytext; - g_currentCtx->format+=escapeName(yytext); + yyextra->currentCtx->methodName=yytext; + yyextra->currentCtx->format+=escapeName(yyscanner,yytext); } else { - g_currentCtx->format+=escapeWord(yytext); + yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); } } {ID}/{BN}*":" { - if (g_braceCount==0) + if (yyextra->braceCount==0) { - g_currentCtx->methodName+=yytext; - g_currentCtx->methodName+=":"; + yyextra->currentCtx->methodName+=yytext; + yyextra->currentCtx->methodName+=":"; } - g_currentCtx->format+=escapeName(yytext); + yyextra->currentCtx->format+=escapeName(yyscanner,yytext); } -[^\n\"$\\]* { g_currentCtx->format+=yytext; } -\\. { g_currentCtx->format+=yytext; } -"\"" { g_currentCtx->format+=yytext; - BEGIN(g_lastStringContext); +[^\n\"$\\]* { yyextra->currentCtx->format+=yytext; } +\\. { yyextra->currentCtx->format+=yytext; } +"\"" { yyextra->currentCtx->format+=yytext; + BEGIN(yyextra->lastStringContext); } -{CHARLIT} { g_currentCtx->format+=yytext; } -"@"?"\"" { g_currentCtx->format+=yytext; - g_lastStringContext=YY_START; +{CHARLIT} { yyextra->currentCtx->format+=yytext; } +"@"?"\"" { yyextra->currentCtx->format+=yytext; + yyextra->lastStringContext=YY_START; BEGIN(ObjCSkipStr); } -"$" { g_currentCtx->format+="$$"; } -"(" { g_currentCtx->format+=*yytext; g_braceCount++; } -")" { g_currentCtx->format+=*yytext; g_braceCount--; } +"$" { yyextra->currentCtx->format+="$$"; } +"(" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount++; } +")" { yyextra->currentCtx->format+=*yytext; yyextra->braceCount--; } "@"/"\"" { // needed to prevent matching the global rule (for C#) - g_currentCtx->format+=yytext; + yyextra->currentCtx->format+=yytext; } -{ID} { g_currentCtx->format+=escapeWord(yytext); } -. { g_currentCtx->format+=*yytext; } -\n { g_currentCtx->format+=*yytext; } +{ID} { yyextra->currentCtx->format+=escapeWord(yyscanner,yytext); } +. { yyextra->currentCtx->format+=*yytext; } +\n { yyextra->currentCtx->format+=*yytext; } "]" { - g_theCallContext.popScope(g_name, g_type); - g_code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->code->codify(yytext); // TODO: nested arrays like: a[b[0]->func()]->func() - g_name = g_saveName.copy(); - g_type = g_saveType.copy(); + yyextra->name = yyextra->saveName.copy(); + yyextra->type = yyextra->saveType.copy(); } [0-9]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [0-9]+[xX][0-9A-Fa-f]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } {KEYWORD}/([^a-z_A-Z0-9]) { - //addParmType(); - //g_parmName=yytext; - if (skipLanguageSpecificKeyword(yytext)) REJECT; - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); + //addParmType(yyscanner); + //yyextra->parmName=yytext; + if (skipLanguageSpecificKeyword(yyscanner,yytext)) REJECT; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {TYPEKW}/([^a-z_A-Z0-9]) { - addParmType(); - g_parmName=yytext; - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {TYPEKWSL}/([^a-z_A-Z0-9]) { - if (g_lang!=SrcLangExt_Slice) + if (yyextra->lang!=SrcLangExt_Slice) { REJECT; } else { - addParmType(); - g_parmName=yytext; - startFontClass("keywordtype"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordtype"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } } {FLOWKW}/([^a-z_A-Z0-9]) { - addParmType(); - g_parmName=yytext; - startFontClass("keywordflow"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordflow"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {FLOWCONDITION}/([^a-z_A-Z0-9]) { - if (g_currentMemberDef && g_currentMemberDef->isFunction()) + if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction()) { - g_currentMemberDef->incrementFlowKeyWordCount(); + yyextra->currentMemberDef->incrementFlowKeyWordCount(); } - addParmType(); - g_parmName=yytext; - startFontClass("keywordflow"); - g_code->codify(yytext); - endFontClass(); + addParmType(yyscanner); + yyextra->parmName=yytext; + startFontClass(yyscanner,"keywordflow"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } {ID}(({B}*"<"[^\n\[\](){}<>]*">")?({B}*"::"{B}*{ID})?)* { if (isCastKeyword(yytext)) { REJECT; } - addParmType(); - g_parmName=yytext; - generateClassOrGlobalLink(*g_code,yytext,!g_insideBody); + addParmType(yyscanner); + yyextra->parmName=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody); } ";" { // probably a cast, not a function call - g_code->codify(yytext); - g_inForEachExpression = FALSE; + yyextra->code->codify(yytext); + yyextra->inForEachExpression = FALSE; BEGIN( Body ); } , { - g_code->codify(yytext); - g_theVarContext.addVariable(g_parmType,g_parmName); - g_parmType.resize(0);g_parmName.resize(0); + yyextra->code->codify(yytext); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); } "{" { - if (g_bracketCount>0) + if (yyextra->bracketCount>0) { - g_code->codify(yytext); - g_skipInlineInitContext=YY_START; - g_curlyCount=0; + yyextra->code->codify(yytext); + yyextra->skipInlineInitContext=YY_START; + yyextra->curlyCount=0; BEGIN(InlineInit); } else @@ -3104,30 +1647,30 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" REJECT; } } -"{" { g_curlyCount++; - g_code->codify(yytext); +"{" { yyextra->curlyCount++; + yyextra->code->codify(yytext); } "}" { - g_code->codify(yytext); - if (--g_curlyCount<=0) + yyextra->code->codify(yytext); + if (--yyextra->curlyCount<=0) { - BEGIN(g_skipInlineInitContext); + BEGIN(yyextra->skipInlineInitContext); } } \n { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } . { - g_code->codify(yytext); + yyextra->code->codify(yytext); } "(" { - g_parmType.resize(0);g_parmName.resize(0); - g_code->codify(yytext); - g_bracketCount++; - g_theCallContext.pushScope(g_name, g_type); - if (YY_START==FuncCall && !g_insideBody) + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + yyextra->code->codify(yytext); + yyextra->bracketCount++; + yyextra->theCallContext.pushScope(yyextra->name, yyextra->type); + if (YY_START==FuncCall && !yyextra->insideBody) { - g_theVarContext.pushScope(); + yyextra->theVarContext.pushScope(); } } {OPERATOR} { // operator @@ -3137,34 +1680,34 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" qstrcmp(yytext,"%")) // typically a pointer or reference { // not a * or &, or C++/CLI's ^ or % - g_parmType.resize(0);g_parmName.resize(0); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); } - g_code->codify(yytext); + yyextra->code->codify(yytext); } ("*"{B}*)?")" { if (yytext[0]==')') // no a pointer cast { - //printf("addVariable(%s,%s)\n",g_parmType.data(),g_parmName.data()); - if (g_parmType.isEmpty()) + //printf("addVariable(%s,%s)\n",yyextra->parmType.data(),yyextra->parmName.data()); + if (yyextra->parmType.isEmpty()) { - g_parmType=g_parmName; - g_parmName.resize(0); + yyextra->parmType=yyextra->parmName; + yyextra->parmName.resize(0); } - g_theVarContext.addVariable(g_parmType,g_parmName); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); } else { - g_parmType = g_parmName; - g_parmName.resize(0); - g_theVarContext.addVariable(g_parmType,g_parmName); + yyextra->parmType = yyextra->parmName; + yyextra->parmName.resize(0); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); } - g_theCallContext.popScope(g_name, g_type); - g_inForEachExpression = FALSE; - //g_theCallContext.setClass(0); // commented out, otherwise a()->b() does not work for b(). - g_code->codify(yytext); - if (--g_bracketCount<=0) + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->inForEachExpression = FALSE; + //yyextra->theCallContext.setClass(0); // commented out, otherwise a()->b() does not work for b(). + yyextra->code->codify(yytext); + if (--yyextra->bracketCount<=0) { - if (g_name.isEmpty()) + if (yyextra->name.isEmpty()) { BEGIN( Body ); } @@ -3174,319 +1717,319 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } } } -[ \t\n]* { codifyLines(yytext); } +[ \t\n]* { codifyLines(yyscanner,yytext); } /* ")"[ \t\n]*[;:] { */ [;:] { - codifyLines(yytext); - g_bracketCount=0; - if (*yytext==';') g_searchingForBody=FALSE; - if (!g_type.isEmpty()) + codifyLines(yyscanner,yytext); + yyextra->bracketCount=0; + if (*yytext==';') yyextra->searchingForBody=FALSE; + if (!yyextra->type.isEmpty()) { - DBG_CTX((stderr,"add variable g_type=%s g_name=%s)\n",g_type.data(),g_name.data())); - g_theVarContext.addVariable(g_type,g_name); + DBG_CTX((stderr,"add variable yyextra->type=%s yyextra->name=%s)\n",yyextra->type.data(),yyextra->name.data())); + yyextra->theVarContext.addVariable(yyscanner,yyextra->type,yyextra->name); } - g_parmType.resize(0);g_parmName.resize(0); - g_theCallContext.setScope(0); - if (*yytext==';' || g_insideBody) + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + yyextra->theCallContext.setScope(0); + if (*yytext==';' || yyextra->insideBody) { - if (!g_insideBody) + if (!yyextra->insideBody) { - g_theVarContext.popScope(); + yyextra->theVarContext.popScope(); } - g_name.resize(0);g_type.resize(0); + yyextra->name.resize(0);yyextra->type.resize(0); BEGIN( Body ); } else { - g_bracketCount=0; + yyextra->bracketCount=0; BEGIN( SkipInits ); } } ("const"|"volatile"|"sealed"|"override")({BN}+("const"|"volatile"|"sealed"|"override"))*/{BN}*(";"|"="|"throw"{BN}*"(") { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } ("const"|"volatile"|"sealed"|"override")*({BN}+("const"|"volatile"|"sealed"|"override"))*{BN}*"{" { - if (g_insideBody) + if (yyextra->insideBody) { - g_theVarContext.pushScope(); + yyextra->theVarContext.pushScope(); } - g_theVarContext.addVariable(g_parmType,g_parmName); - //g_theCallContext.popScope(g_name, g_type); - g_parmType.resize(0);g_parmName.resize(0); - int index = g_name.findRev("::"); - DBG_CTX((stderr,"g_name=%s\n",g_name.data())); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + //yyextra->theCallContext.popScope(yyextra->name, yyextra->type); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); + int index = yyextra->name.findRev("::"); + DBG_CTX((stderr,"yyextra->name=%s\n",yyextra->name.data())); if (index!=-1) { - QCString scope = g_name.left(index); - if (!g_classScope.isEmpty()) scope.prepend(g_classScope+"::"); - const ClassDef *cd=getResolvedClass(Doxygen::globalScope,g_sourceFileDef,scope); + QCString scope = yyextra->name.left(index); + if (!yyextra->classScope.isEmpty()) scope.prepend(yyextra->classScope+"::"); + const ClassDef *cd=getResolvedClass(Doxygen::globalScope,yyextra->sourceFileDef,scope); if (cd) { - setClassScope(cd->name()); - g_scopeStack.push(SCOPEBLOCK); + setClassScope(yyscanner,cd->name()); + yyextra->scopeStack.push(SCOPEBLOCK); DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); } else { - //setClassScope(g_realScope); - g_scopeStack.push(INNERBLOCK); + //setClassScope(yyscanner,yyextra->realScope); + yyextra->scopeStack.push(INNERBLOCK); DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); } } else { DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); + yyextra->scopeStack.push(INNERBLOCK); } yytext[yyleng-1]='\0'; QCString cv(yytext); if (!cv.stripWhiteSpace().isEmpty()) { - startFontClass("keyword"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } else // just whitespace { - codifyLines(yytext); + codifyLines(yyscanner,yytext); } - g_code->codify("{"); - if (g_searchingForBody) + yyextra->code->codify("{"); + if (yyextra->searchingForBody) { - g_searchingForBody=FALSE; - g_insideBody=TRUE; + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; } - if (g_insideBody) g_bodyCurlyCount++; - g_type.resize(0); g_name.resize(0); + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + yyextra->type.resize(0); yyextra->name.resize(0); BEGIN( Body ); } "try" { // function-try-block - startFontClass("keyword"); - g_code->codify(yytext); - endFontClass(); - g_inFunctionTryBlock=TRUE; + startFontClass(yyscanner,"keyword"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); + yyextra->inFunctionTryBlock=TRUE; } {ID} { - if (g_insideBody || !g_parmType.isEmpty()) + if (yyextra->insideBody || !yyextra->parmType.isEmpty()) { REJECT; } // could be K&R style definition - addParmType(); - g_parmName=yytext; - generateClassOrGlobalLink(*g_code,yytext,!g_insideBody); + addParmType(yyscanner); + yyextra->parmName=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody); BEGIN(OldStyleArgs); } {ID} { - addParmType(); - g_parmName=yytext; - generateClassOrGlobalLink(*g_code,yytext,!g_insideBody); + addParmType(yyscanner); + yyextra->parmName=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext,!yyextra->insideBody); } [,;] { - g_code->codify(yytext); - g_theVarContext.addVariable(g_parmType,g_parmName); - if (*yytext==';') g_parmType.resize(0); - g_parmName.resize(0); + yyextra->code->codify(yytext); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + if (*yytext==';') yyextra->parmType.resize(0); + yyextra->parmName.resize(0); } "#" { - startFontClass("preprocessor"); - g_lastSkipCppContext = Body; - g_code->codify(yytext); + startFontClass(yyscanner,"preprocessor"); + yyextra->lastSkipCppContext = Body; + yyextra->code->codify(yytext); BEGIN( SkipCPP ); } . { unput(*yytext); - if (!g_insideBody) + if (!yyextra->insideBody) { - g_theVarContext.popScope(); + yyextra->theVarContext.popScope(); } - g_name.resize(0);g_args.resize(0); - g_parmType.resize(0);g_parmName.resize(0); + yyextra->name.resize(0);yyextra->args.resize(0); + yyextra->parmType.resize(0);yyextra->parmName.resize(0); BEGIN( Body ); } ";" { - g_code->codify(yytext); - g_type.resize(0); g_name.resize(0); + yyextra->code->codify(yytext); + yyextra->type.resize(0); yyextra->name.resize(0); BEGIN( Body ); } "{" { - g_code->codify(yytext); - if (g_searchingForBody) + yyextra->code->codify(yytext); + if (yyextra->searchingForBody) { - g_searchingForBody=FALSE; - g_insideBody=TRUE; + yyextra->searchingForBody=FALSE; + yyextra->insideBody=TRUE; } - if (g_insideBody) g_bodyCurlyCount++; - if (g_name.find("::")!=-1) + if (yyextra->insideBody) yyextra->bodyCurlyCount++; + if (yyextra->name.find("::")!=-1) { DBG_CTX((stderr,"** scope stack push SCOPEBLOCK\n")); - g_scopeStack.push(SCOPEBLOCK); - setClassScope(g_realScope); + yyextra->scopeStack.push(SCOPEBLOCK); + setClassScope(yyscanner,yyextra->realScope); } else { DBG_CTX((stderr,"** scope stack push INNERBLOCK\n")); - g_scopeStack.push(INNERBLOCK); + yyextra->scopeStack.push(INNERBLOCK); } - g_type.resize(0); g_name.resize(0); + yyextra->type.resize(0); yyextra->name.resize(0); BEGIN( Body ); } {ID} { - generateClassOrGlobalLink(*g_code,yytext); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); } {ID}/"(" { - generateFunctionLink(*g_code,yytext); + generateFunctionLink(yyscanner,*yyextra->code,yytext); } {ID}/("."|"->") { - g_name=yytext; - generateClassOrGlobalLink(*g_code,yytext); + yyextra->name=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); BEGIN( MemberCall2 ); } ("("{B}*("*"{B}*)+{ID}*{B}*")"{B}*)/("."|"->") { - g_code->codify(yytext); + yyextra->code->codify(yytext); int s=0;while (!isId(yytext[s])) s++; int e=(int)yyleng-1;while (!isId(yytext[e])) e--; - g_name=((QCString)yytext).mid(s,e-s+1); + yyextra->name=((QCString)yytext).mid(s,e-s+1); BEGIN( MemberCall2 ); } {ID}/([ \t\n]*"(") { - if (!g_args.isEmpty()) - generateMemberLink(*g_code,g_args,yytext); + if (!yyextra->args.isEmpty()) + generateMemberLink(yyscanner,*yyextra->code,yyextra->args,yytext); else - generateClassOrGlobalLink(*g_code,yytext); - g_args.resize(0); + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); + yyextra->args.resize(0); BEGIN( FuncCall ); } {ID}/([ \t\n]*("."|"->")) { - //g_code->codify(yytext); - g_name=yytext; - generateClassOrGlobalLink(*g_code,yytext); + //yyextra->code->codify(yytext); + yyextra->name=yytext; + generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); BEGIN( MemberCall2 ); } "->"|"." { if (yytext[0]=='-') // -> could be overloaded { - updateCallContextForSmartPointer(); + updateCallContextForSmartPointer(yyscanner); } - g_code->codify(yytext); - g_memCallContext = YY_START; + yyextra->code->codify(yytext); + yyextra->memCallContext = YY_START; BEGIN( MemberCall ); } "/*"("!"?)"*/" { - g_code->codify(yytext); - endFontClass(); - BEGIN( g_lastCContext ) ; + yyextra->code->codify(yytext); + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } "//"|"/*" { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [^*/\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } [ \t]*"*/" { - g_code->codify(yytext); - endFontClass(); - if (g_lastCContext==SkipCPP) + yyextra->code->codify(yytext); + endFontClass(yyscanner); + if (yyextra->lastCContext==SkipCPP) { - startFontClass("preprocessor"); + startFontClass(yyscanner,"preprocessor"); } - BEGIN( g_lastCContext ) ; + BEGIN( yyextra->lastCContext ) ; } [^\r\n]*"\\"[\r]?\n { // line continuation - codifyLines(yytext); + codifyLines(yyscanner,yytext); } [^\r\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } \r \n { unput('\n'); - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } . { - g_code->codify(yytext); + yyextra->code->codify(yytext); } "*/"{B}*\n({B}*\n)*({B}*(("//@"[{}])|("/*@"[{}]"*/")){B}*\n)?{B}*"/*"[*!]/[^/*] { - g_yyLineNr+=QCString(yytext).contains('\n'); + yyextra->yyLineNr+=QCString(yytext).contains('\n'); } "*/"{B}*\n({B}*\n)*({B}*(("//@"[{}])|("/*@"[{}]"*/")){B}*\n)? { - g_yyLineNr+=QCString(yytext).contains('\n'); - nextCodeLine(); - if (g_lastSpecialCContext==SkipCxxComment) + yyextra->yyLineNr+=QCString(yytext).contains('\n'); + nextCodeLine(yyscanner); + if (yyextra->lastSpecialCContext==SkipCxxComment) { // force end of C++ comment here - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } else { - BEGIN(g_lastSpecialCContext); + BEGIN(yyextra->lastSpecialCContext); } } "*/" { - BEGIN(g_lastSpecialCContext); + BEGIN(yyextra->lastSpecialCContext); } [^*\n]+ "//"|"/*" -\n { g_yyLineNr++; } +\n { yyextra->yyLineNr++; } . [^a-z_A-Z0-9(\n] { - g_code->codify(yytext); - g_type.resize(0); - g_name.resize(0); - BEGIN(g_memCallContext); + yyextra->code->codify(yytext); + yyextra->type.resize(0); + yyextra->name.resize(0); + BEGIN(yyextra->memCallContext); } <*>\n({B}*"//"[!/][^\n]*\n)+ { // remove special one-line comment if (YY_START==SkipCPP) REJECT; if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr+=((QCString)yytext).contains('\n'); - nextCodeLine(); + yyextra->yyLineNr+=((QCString)yytext).contains('\n'); + nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } if (YY_START==SkipCxxComment) { - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } } \n/.*\n { - endFontClass(); - codifyLines(yytext); - BEGIN( g_lastSkipCppContext ) ; + endFontClass(yyscanner); + codifyLines(yyscanner,yytext); + BEGIN( yyextra->lastSkipCppContext ) ; } <*>\n{B}*"//@"[{}].*\n { // remove one-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr+=2; - nextCodeLine(); + yyextra->yyLineNr+=2; + nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } if (YY_START==SkipCxxComment) { - endFontClass(); - BEGIN( g_lastCContext ) ; + endFontClass(yyscanner); + BEGIN( yyextra->lastCContext ) ; } } <*>\n{B}*"/*@"[{}] { // remove one-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; - g_yyLineNr++; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; + yyextra->yyLineNr++; BEGIN(RemoveSpecialCComment); } else @@ -3494,30 +2037,30 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - codifyLines(yytext); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); BEGIN(SkipComment); } } <*>^{B}*"//@"[{}].*\n { // remove one-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr++; - nextCodeLine(); + yyextra->yyLineNr++; + nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } } <*>^{B}*"/*@"[{}] { // remove multi-line group marker if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3525,24 +2068,24 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } <*>^{B}*"//"[!/][^\n]*\n { // remove special one-line comment if (Config_getBool(STRIP_CODE_COMMENTS)) { - g_yyLineNr++; - //nextCodeLine(); + yyextra->yyLineNr++; + //nextCodeLine(yyscanner); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } } <*>"//"[!/][^\n]*\n { // strip special one-line comment @@ -3550,26 +2093,26 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (Config_getBool(STRIP_CODE_COMMENTS)) { char c[2]; c[0]='\n'; c[1]=0; - codifyLines(c); + codifyLines(yyscanner,c); } else { - startFontClass("comment"); - codifyLines(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); + endFontClass(yyscanner); } } <*>"/*[tag:"[^\]\n]*"]*/"{B}* { // special pattern /*[tag:filename]*/ to force linking to a tag file - g_forceTagReference=yytext; - int s=g_forceTagReference.find(':'); - int e=g_forceTagReference.findRev(']'); - g_forceTagReference = g_forceTagReference.mid(s+1,e-s-1); + yyextra->forceTagReference=yytext; + int s=yyextra->forceTagReference.find(':'); + int e=yyextra->forceTagReference.findRev(']'); + yyextra->forceTagReference = yyextra->forceTagReference.mid(s+1,e-s-1); } <*>\n{B}*"/*"[!*]/[^/*] { if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; - g_yyLineNr++; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; + yyextra->yyLineNr++; BEGIN(RemoveSpecialCComment); } else @@ -3577,17 +2120,17 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - codifyLines(yytext); + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,yytext); BEGIN(SkipComment); } } <*>^{B}*"/**"[*]+/[^/] { // special C "banner" comment block at a new line if (Config_getBool(JAVADOC_BANNER) && Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3595,17 +2138,17 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } <*>^{B}*"/*"[!*]/[^/*] { // special C comment block at a new line if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3613,10 +2156,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } @@ -3624,7 +2167,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (YY_START==SkipString) REJECT; if (Config_getBool(STRIP_CODE_COMMENTS)) { - if (YY_START != RemoveSpecialCComment) g_lastSpecialCContext = YY_START; + if (YY_START != RemoveSpecialCComment) yyextra->lastSpecialCContext = YY_START; BEGIN(RemoveSpecialCComment); } else @@ -3632,10 +2175,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); BEGIN(SkipComment); } } @@ -3643,134 +2186,1724 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (YY_START==SkipString) REJECT; if (!Config_getBool(STRIP_CODE_COMMENTS)) { - startFontClass("comment"); - g_code->codify(yytext); - endFontClass(); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); + endFontClass(yyscanner); } } [^\*\n]+ { - g_code->codify(yytext); + yyextra->code->codify(yytext); } <*>"/*" { - startFontClass("comment"); - g_code->codify(yytext); + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); // check is to prevent getting stuck in skipping C++ comments if (YY_START != SkipComment && YY_START != SkipCxxComment) { - g_lastCContext = YY_START ; + yyextra->lastCContext = YY_START ; } BEGIN( SkipComment ) ; } <*>@\" { // C# verbatim string - startFontClass("stringliteral"); - g_code->codify(yytext); - g_lastVerbStringContext=YY_START; + startFontClass(yyscanner,"stringliteral"); + yyextra->code->codify(yytext); + yyextra->lastVerbStringContext=YY_START; BEGIN(SkipVerbString); } <*>"//" { - startFontClass("comment"); - g_code->codify(yytext); - g_lastCContext = YY_START ; + startFontClass(yyscanner,"comment"); + yyextra->code->codify(yytext); + yyextra->lastCContext = YY_START ; BEGIN( SkipCxxComment ) ; } <*>"("|"[" { - g_code->codify(yytext); - g_theCallContext.pushScope(g_name, g_type); + yyextra->code->codify(yytext); + yyextra->theCallContext.pushScope(yyextra->name, yyextra->type); } <*>")"|"]" { - g_code->codify(yytext); - g_theCallContext.popScope(g_name, g_type); + yyextra->code->codify(yytext); + yyextra->theCallContext.popScope(yyextra->name, yyextra->type); } <*>\n { - g_yyColNr++; - codifyLines(yytext); + yyextra->yyColNr++; + codifyLines(yyscanner,yytext); } <*>. { - g_yyColNr++; - g_code->codify(yytext); + yyextra->yyColNr++; + yyextra->code->codify(yytext); } /* <*>([ \t\n]*"\n"){2,} { // combine multiple blank lines //QCString sepLine=yytext; - //g_code->codify("\n\n"); - //g_yyLineNr+=sepLine.contains('\n'); + //yyextra->code->codify("\n\n"); + //yyextra->yyLineNr+=sepLine.contains('\n'); //char sepLine[3]="\n\n"; - codifyLines(yytext); + codifyLines(yyscanner,yytext); } */ -%% +%% + +/*@ ---------------------------------------------------------------------------- + */ + +void VariableContext::addVariable(yyscan_t yyscanner,const QCString &type,const QCString &name) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("VariableContext::addVariable(%s,%s)\n",type.data(),name.data()); + QCString ltype = type.simplifyWhiteSpace(); + QCString lname = name.simplifyWhiteSpace(); + if (ltype.left(7)=="struct ") + { + ltype = ltype.right(ltype.length()-7); + } + else if (ltype.left(6)=="union ") + { + ltype = ltype.right(ltype.length()-6); + } + if (ltype.isEmpty() || lname.isEmpty()) return; + DBG_CTX((stderr,"** addVariable trying: type='%s' name='%s' g_currentDefinition=%s\n", + ltype.data(),lname.data(),g_currentDefinition?g_currentDefinition->name().data():"")); + Scope *scope = m_scopes.count()==0 ? &m_globalScope : m_scopes.getLast(); + const ClassDef *varType; + int i=0; + if ( + (varType=yyextra->codeClassSDict->find(ltype)) || // look for class definitions inside the code block + (varType=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,ltype)) // look for global class definitions + ) + { + DBG_CTX((stderr,"** addVariable type='%s' name='%s'\n",ltype.data(),lname.data())); + scope->append(lname,varType); // add it to a list + } + else if ((i=ltype.find('<'))!=-1) + { + // probably a template class + QCString typeName(ltype.left(i)); + ClassDef* newDef = 0; + QCString templateArgs(ltype.right(ltype.length() - i)); + if ( !typeName.isEmpty() && + ( // look for class definitions inside the code block + (varType=yyextra->codeClassSDict->find(typeName)) || + // otherwise look for global class definitions + (varType=getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,typeName,0,0,TRUE,TRUE)) + ) && // and it must be a template + !varType->templateArguments().empty()) + { + newDef = varType->getVariableInstance( templateArgs ); + } + if (newDef) + { + DBG_CTX((stderr,"** addVariable type='%s' templ='%s' name='%s'\n",typeName.data(),templateArgs.data(),lname.data())); + scope->append(lname, newDef); + } + else + { + // Doesn't seem to be a template. Try just the base name. + addVariable(yyscanner,typeName,name); + } + } + else + { + if (m_scopes.count()>0) // for local variables add a dummy entry so the name + // is hidden to avoid false links to global variables with the same name + // TODO: make this work for namespaces as well! + { + DBG_CTX((stderr,"** addVariable: dummy context for '%s'\n",lname.data())); + scope->append(lname,dummyContext); + } + else + { + DBG_CTX((stderr,"** addVariable: not adding variable!\n")); + } + } +} + +ClassDef *VariableContext::findVariable(const QCString &name) +{ + if (name.isEmpty()) return 0; + ClassDef *result = 0; + QListIterator sli(m_scopes); + Scope *scope; + QCString key = name; + // search from inner to outer scope + for (sli.toLast();(scope=sli.current());--sli) + { + result = scope->find(key); + if (result) + { + DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); + return result; + } + } + // nothing found -> also try the global scope + result=m_globalScope.find(name); + DBG_CTX((stderr,"** findVariable(%s)=%p\n",name.data(),result)); + return result; +} + +const ClassDef *VariableContext::dummyContext = (ClassDef*)0x8; + +//------------------------------------------------------------------- + +/*! add class/namespace name s to the scope */ +static void pushScope(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + yyextra->classScopeLengthStack.push(new int(yyextra->classScope.length())); + if (yyextra->classScope.isEmpty() || leftScopeMatch(s,yyextra->classScope)) + { + yyextra->classScope = s; + } + else + { + yyextra->classScope += "::"; + yyextra->classScope += s; + } + //printf("pushScope(%s) result: '%s'\n",s,yyextra->classScope.data()); +} + + +/*! remove the top class/namespace name from the scope */ +static void popScope(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (!yyextra->classScopeLengthStack.isEmpty()) + { + int *pLength = yyextra->classScopeLengthStack.pop(); + yyextra->classScope.truncate(*pLength); + delete pLength; + } + else + { + //err("Too many end of scopes found!\n"); + } + //printf("popScope() result: '%s'\n",yyextra->classScope.data()); +} + +static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (Doxygen::searchIndex) + { + if (yyextra->searchCtx) + { + yyextra->code->setCurrentDoc(yyextra->searchCtx,yyextra->searchCtx->anchor(),FALSE); + } + else + { + yyextra->code->setCurrentDoc(yyextra->sourceFileDef,anchor,TRUE); + } + } +} + +static void addToSearchIndex(yyscan_t yyscanner,const char *text) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (Doxygen::searchIndex) + { + yyextra->code->addWord(text,FALSE); + } +} + +static void setClassScope(yyscan_t yyscanner,const QCString &name) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("setClassScope(%s)\n",name.data()); + QCString n=name; + n=n.simplifyWhiteSpace(); + int ts=n.find('<'); // start of template + int te=n.findRev('>'); // end of template + //printf("ts=%d te=%d\n",ts,te); + if (ts!=-1 && te!=-1 && te>ts) + { + // remove template from scope + n=n.left(ts)+n.right(n.length()-te-1); + } + while (!yyextra->classScopeLengthStack.isEmpty()) + { + popScope(yyscanner); + } + yyextra->classScope.resize(0); + int i; + while ((i=n.find("::"))!=-1) + { + pushScope(yyscanner,n.left(i)); + n = n.mid(i+2); + } + pushScope(yyscanner,n); + //printf("--->New class scope '%s'\n",yyextra->classScope.data()); +} + +/*! start a new line of code, inserting a line number if yyextra->sourceFileDef + * is TRUE. If a definition starts at the current line, then the line + * number is linked to the documentation of that definition. + */ +static void startCodeLine(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //if (yyextra->currentFontClass) { yyextra->code->endFontClass(yyscanner); } + if (yyextra->sourceFileDef && yyextra->lineNumbers) + { + //QCString lineNumber,lineAnchor; + //lineNumber.sprintf("%05d",yyextra->yyLineNr); + //lineAnchor.sprintf("l%05d",yyextra->yyLineNr); + + Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr); + //printf("%s:startCodeLine(%d)=%p\n",yyextra->sourceFileDef->name().data(),yyextra->yyLineNr,d); + if (!yyextra->includeCodeFragment && d) + { + yyextra->currentDefinition = d; + yyextra->currentMemberDef = yyextra->sourceFileDef->getSourceMember(yyextra->yyLineNr); + yyextra->insideBody = FALSE; + yyextra->searchingForBody = TRUE; + yyextra->realScope = d->name(); + //yyextra->classScope = ""; + yyextra->type.resize(0); + yyextra->name.resize(0); + yyextra->args.resize(0); + yyextra->parmType.resize(0); + yyextra->parmName.resize(0); + //printf("Real scope: '%s'\n",yyextra->realScope.data()); + yyextra->bodyCurlyCount = 0; + QCString lineAnchor; + lineAnchor.sprintf("l%05d",yyextra->yyLineNr); + if (yyextra->currentMemberDef) + { + yyextra->code->writeLineNumber(yyextra->currentMemberDef->getReference(), + yyextra->currentMemberDef->getOutputFileBase(), + yyextra->currentMemberDef->anchor(),yyextra->yyLineNr); + setCurrentDoc(yyscanner,lineAnchor); + } + else if (d->isLinkableInProject()) + { + yyextra->code->writeLineNumber(d->getReference(), + d->getOutputFileBase(), + 0,yyextra->yyLineNr); + setCurrentDoc(yyscanner,lineAnchor); + } + } + else + { + yyextra->code->writeLineNumber(0,0,0,yyextra->yyLineNr); + } + } + DBG_CTX((stderr,"startCodeLine(%d)\n",yyextra->yyLineNr)); + yyextra->code->startCodeLine(yyextra->sourceFileDef && yyextra->lineNumbers); + if (yyextra->currentFontClass) + { + yyextra->code->startFontClass(yyextra->currentFontClass); + } +} + + + +static void endCodeLine(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + DBG_CTX((stderr,"endCodeLine(%d)\n",yyextra->yyLineNr)); + endFontClass(yyscanner); + yyextra->code->endCodeLine(); +} + +static void nextCodeLine(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const char * fc = yyextra->currentFontClass; + endCodeLine(yyscanner); + if (yyextra->yyLineNrinputLines) + { + yyextra->currentFontClass = fc; + startCodeLine(yyscanner); + } +} + +/*! write a code fragment 'text' that may span multiple lines, inserting + * line numbers for each line. + */ +static void codifyLines(yyscan_t yyscanner,const char *text) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text); + const char *p=text,*sp=p; + char c; + bool done=FALSE; + while (!done) + { + sp=p; + while ((c=*p++) && c!='\n') { yyextra->yyColNr++; } + if (c=='\n') + { + yyextra->yyLineNr++; + yyextra->yyColNr=1; + //*(p-1)='\0'; + int l = (int)(p-sp-1); + char *tmp = (char*)malloc(l+1); + memcpy(tmp,sp,l); + tmp[l]='\0'; + yyextra->code->codify(tmp); + free(tmp); + nextCodeLine(yyscanner); + } + else + { + yyextra->code->codify(sp); + done=TRUE; + } + } +} + +/*! writes a link to a fragment \a text that may span multiple lines, inserting + * line numbers for each line. If \a text contains newlines, the link will be + * split into multiple links with the same destination, one for each line. + */ +static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol, + const Definition *d, + const char *text) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); + TooltipManager::instance()->addTooltip(d); + QCString ref = d->getReference(); + QCString file = d->getOutputFileBase(); + QCString anchor = d->anchor(); + QCString tooltip; + if (!sourceTooltips) // fall back to simple "title" tooltips + { + tooltip = d->briefDescriptionAsTooltip(); + } + bool done=FALSE; + char *p=(char *)text; + while (!done) + { + char *sp=p; + char c; + while ((c=*p++) && c!='\n') { } + if (c=='\n') + { + yyextra->yyLineNr++; + *(p-1)='\0'; + //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); + ol.writeCodeLink(ref,file,anchor,sp,tooltip); + nextCodeLine(yyscanner); + } + else + { + //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp); + ol.writeCodeLink(ref,file,anchor,sp,tooltip); + done=TRUE; + } + } +} + +static void addType(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->name=="const") { yyextra->name.resize(0); return; } + if (!yyextra->type.isEmpty()) yyextra->type += ' ' ; + yyextra->type += yyextra->name ; + yyextra->name.resize(0) ; + if (!yyextra->type.isEmpty()) yyextra->type += ' ' ; + yyextra->type += yyextra->args ; + yyextra->args.resize(0) ; +} + +static void addParmType(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->parmName=="const") { yyextra->parmName.resize(0); return; } + if (!yyextra->parmType.isEmpty()) yyextra->parmType += ' ' ; + yyextra->parmType += yyextra->parmName ; + yyextra->parmName.resize(0) ; +} + +static void addUsingDirective(yyscan_t yyscanner,const char *name) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->sourceFileDef && name) + { + NamespaceDef *nd = Doxygen::namespaceSDict->find(name); + if (nd) + { + yyextra->sourceFileDef->addUsingDirective(nd); + } + } +} + +static void setParameterList(yyscan_t yyscanner,const MemberDef *md) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + yyextra->classScope = md->getClassDef() ? md->getClassDef()->name().data() : ""; + for (const Argument &a : md->argumentList()) + { + yyextra->parmName = a.name; + yyextra->parmType = a.type; + int i = yyextra->parmType.find('*'); + if (i!=-1) yyextra->parmType = yyextra->parmType.left(i); + i = yyextra->parmType.find('&'); + if (i!=-1) yyextra->parmType = yyextra->parmType.left(i); + yyextra->parmType.stripPrefix("const "); + yyextra->parmType=yyextra->parmType.stripWhiteSpace(); + yyextra->theVarContext.addVariable(yyscanner,yyextra->parmType,yyextra->parmName); + } +} + +static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,Definition *d) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int pos=0; + QCString type = s; + QCString className; + QCString templSpec; + while (extractClassNameFromType(type,pos,className,templSpec)!=-1) + { + QCString clName=className+templSpec; + const ClassDef *cd=0; + if (!yyextra->classScope.isEmpty()) + { + cd=getResolvedClass(d,yyextra->sourceFileDef,yyextra->classScope+"::"+clName); + } + if (cd==0) + { + cd=getResolvedClass(d,yyextra->sourceFileDef,clName); + } + //printf("stripClass trying '%s' = %p\n",clName.data(),cd); + if (cd) + { + return cd; + } + } + + return 0; +} + +static MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &name) +{ + if (name.isEmpty()) return 0; + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + DBG_CTX((stderr,"setCallContextForVar(%s) yyextra->classScope=%s\n",name.data(),yyextra->classScope.data())); + + int scopeEnd = name.findRev("::"); + if (scopeEnd!=-1) // name with explicit scope + { + QCString scope = name.left(scopeEnd); + QCString locName = name.right(name.length()-scopeEnd-2); + //printf("explicit scope: name=%s scope=%s\n",locName.data(),scope.data()); + ClassDef *mcd = getClass(scope); + if (mcd && !locName.isEmpty()) + { + MemberDef *md=mcd->getMemberByName(locName); + if (md) + { + //printf("name=%s scope=%s\n",locName.data(),scope.data()); + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + return md; + } + } + else // check namespace as well + { + const NamespaceDef *mnd = getResolvedNamespace(scope); + if (mnd && !locName.isEmpty()) + { + MemberDef *md=mnd->getMemberByName(locName); + if (md) + { + //printf("name=%s scope=%s\n",locName.data(),scope.data()); + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + return md; + } + } + } + } + + MemberName *mn; + ClassDef *mcd = yyextra->theVarContext.findVariable(name); + if (mcd) // local variable + { + DBG_CTX((stderr,"local variable?\n")); + if (mcd!=VariableContext::dummyContext) + { + DBG_CTX((stderr,"local var '%s' mcd=%s\n",name.data(),mcd->name().data())); + yyextra->theCallContext.setScope(mcd); + } + } + else + { + DBG_CTX((stderr,"class member? scope=%s\n",yyextra->classScope.data())); + // look for a class member + mcd = getClass(yyextra->classScope); + if (mcd) + { + DBG_CTX((stderr,"Inside class %s\n",mcd->name().data())); + MemberDef *md=mcd->getMemberByName(name); + if (md) + { + DBG_CTX((stderr,"Found member %s\n",md->name().data())); + if (yyextra->scopeStack.top()!=CLASSBLOCK) + { + DBG_CTX((stderr,"class member '%s' mcd=%s\n",name.data(),mcd->name().data())); + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + } + return md; + } + } + } + + // look for a global member + if ((mn=Doxygen::functionNameSDict->find(name))) + { + //printf("global var '%s'\n",name.data()); + if (mn->count()==1) // global defined only once + { + MemberDef *md=mn->getFirst(); + if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef) + { + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + return md; + } + return 0; + } + else if (mn->count()>1) // global defined more than once + { + MemberNameIterator it(*mn); + MemberDef *md; + for (;(md=it.current());++it) + { + //printf("mn=%p md=%p md->getBodyDef()=%p yyextra->sourceFileDef=%p\n", + // mn,md, + // md->getBodyDef(),yyextra->sourceFileDef); + + // in case there are multiple members we could link to, we + // only link to members if defined in the same file or + // defined as external. + if ((!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef) && + (yyextra->forceTagReference.isEmpty() || yyextra->forceTagReference==md->getReference()) + ) + { + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + //printf("returning member %s in source file %s\n",md->name().data(),yyextra->sourceFileDef->name().data()); + return md; + } + } + return 0; + } + } + return 0; +} + +static void updateCallContextForSmartPointer(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const Definition *d = yyextra->theCallContext.getScope(); + //printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : ""); + MemberDef *md; + if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast(d))->isSmartPointer())) + { + const ClassDef *ncd = stripClassName(yyscanner,md->typeString(),md->getOuterScope()); + if (ncd) + { + yyextra->theCallContext.setScope(ncd); + //printf("Found smart pointer call %s->%s!\n",cd->name().data(),ncd->name().data()); + } + } +} + +static bool getLinkInScope(yyscan_t yyscanner, + const QCString &c, // scope + const QCString &m, // member + const char *memberText, // exact text + CodeOutputInterface &ol, + const char *text, + bool varOnly + ) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const MemberDef *md = 0; + const ClassDef *cd = 0; + const FileDef *fd = 0; + const NamespaceDef *nd = 0; + const GroupDef *gd = 0; + DBG_CTX((stderr,"getLinkInScope: trying '%s'::'%s' varOnly=%d\n",c.data(),m.data(),varOnly)); + if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,yyextra->sourceFileDef,FALSE,yyextra->forceTagReference) && + (!varOnly || md->isVariable())) + { + if (md->isLinkable()) + { + //printf("found it %s!\n",md->qualifiedName().data()); + if (yyextra->exampleBlock) + { + QCString anchor; + anchor.sprintf("a%d",yyextra->anchorCount); + //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), + // yyextra->exampleFile.data()); + if (const_cast(md)->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) + { + ol.writeCodeAnchor(anchor); + yyextra->anchorCount++; + } + } + + const Definition *d = md->getOuterScope()==Doxygen::globalScope ? + md->resolveAlias()->getFileDef() : md->getOuterScope(); + if (md->resolveAlias()->getGroupDef()) d = md->resolveAlias()->getGroupDef(); + if (d && d->isLinkable()) + { + yyextra->theCallContext.setScope(stripClassName(yyscanner,md->typeString(),md->getOuterScope())); + //printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n", + // yyextra->currentDefinition,yyextra->currentMemberDef,yyextra->insideBody); + + if (yyextra->currentDefinition && yyextra->currentMemberDef && + md!=yyextra->currentMemberDef && yyextra->insideBody && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(md)); + } + //printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data()); + + writeMultiLineCodeLink(yyscanner,ol,md, text ? text : memberText); + addToSearchIndex(yyscanner,text ? text : memberText); + return TRUE; + } + } + else // found member, but it is not linkable, so make sure content inside is not assigned + // to the previous member, see bug762760 + { + DBG_CTX((stderr,"unlinkable member %s\n",md->name().data())); + yyextra->currentMemberDef = 0; + } + } + return FALSE; +} + +static bool getLink(yyscan_t yyscanner, + const char *className, + const char *memberName, + CodeOutputInterface &ol, + const char *text, + bool varOnly) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("getLink(%s,%s) yyextra->curClassName=%s\n",className,memberName,yyextra->curClassName.data()); + QCString m=removeRedundantWhiteSpace(memberName); + QCString c=className; + if (!getLinkInScope(yyscanner,c,m,memberName,ol,text,varOnly)) + { + if (!yyextra->curClassName.isEmpty()) + { + if (!c.isEmpty()) c.prepend("::"); + c.prepend(yyextra->curClassName); + return getLinkInScope(yyscanner,c,m,memberName,ol,text,varOnly); + } + return FALSE; + } + return TRUE; +} + +static void generateClassOrGlobalLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + const char *clName, + bool typeOnly, + bool varOnly) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int i=0; + if (*clName=='~') // correct for matching negated values i.s.o. destructors. + { + yyextra->code->codify("~"); + clName++; + } + QCString className=clName; + if (className.isEmpty()) return; + if (yyextra->insideProtocolList) // for Obj-C + { + className+="-p"; + } + if (yyextra->lang==SrcLangExt_PHP) + { + className = substitute(className,"\\","::"); // for PHP namespaces + } + else if (yyextra->lang==SrcLangExt_CSharp || yyextra->lang==SrcLangExt_Java) + { + className = substitute(className,".","::"); // for PHP namespaces + } + const ClassDef *cd=0,*lcd=0; + const MemberDef *md=0; + bool isLocal=FALSE; + + //printf("generateClassOrGlobalLink(className=%s)\n",className.data()); + if (!yyextra->prefixed_with_this_keyword || (lcd=yyextra->theVarContext.findVariable(className))==0) // not a local variable + { + Definition *d = yyextra->currentDefinition; + //printf("d=%s yyextra->sourceFileDef=%s\n",d?d->name().data():"",yyextra->sourceFileDef?yyextra->sourceFileDef->name().data():""); + cd = getResolvedClass(d,yyextra->sourceFileDef,className,&md); + DBG_CTX((stderr,"non-local variable name=%s context=%d cd=%s md=%s!\n", + className.data(),yyextra->theVarContext.count(),cd?cd->name().data():"", + md?md->name().data():"")); + if (cd==0 && md==0 && (i=className.find('<'))!=-1) + { + QCString bareName = className.left(i); //stripTemplateSpecifiersFromScope(className); + DBG_CTX((stderr,"bareName=%s\n",bareName.data())); + if (bareName!=className) + { + cd=getResolvedClass(d,yyextra->sourceFileDef,bareName,&md); // try unspecialized version + } + } + const NamespaceDef *nd = getResolvedNamespace(className); + if (nd && nd->isLinkable()) + { + yyextra->theCallContext.setScope(nd); + addToSearchIndex(yyscanner,className); + writeMultiLineCodeLink(yyscanner,*yyextra->code,nd,clName); + return; + } + //printf("md=%s\n",md?md->name().data():""); + DBG_CTX((stderr,"is found as a type cd=%s nd=%s\n", + cd?cd->name().data():"", + nd?nd->name().data():"")); + if (cd==0 && md==0) // also see if it is variable or enum or enum value + { + if (getLink(yyscanner,yyextra->classScope,clName,ol,clName,varOnly)) + { + return; + } + } + } + else + { + //printf("local variable!\n"); + if (lcd!=VariableContext::dummyContext) + { + //printf("non-dummy context lcd=%s!\n",lcd->name().data()); + yyextra->theCallContext.setScope(lcd); + + // to following is needed for links to a global variable, but is + // no good for a link to a local variable that is also a global symbol. + + //if (getLink(yyscanner,yyextra->classScope,clName,ol,clName)) + //{ + //return; + //} + } + isLocal=TRUE; + DBG_CTX((stderr,"is a local variable cd=%p!\n",cd)); + } + yyextra->prefixed_with_this_keyword = FALSE; // discard the "this" prefix for the next calls + + if (cd && cd->isLinkable()) // is it a linkable class + { + DBG_CTX((stderr,"is linkable class %s\n",clName)); + if (yyextra->exampleBlock) + { + QCString anchor; + anchor.sprintf("_a%d",yyextra->anchorCount); + //printf("addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), + // yyextra->exampleFile.data()); + if (const_cast(cd)->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) + { + ol.writeCodeAnchor(anchor); + yyextra->anchorCount++; + } + } + writeMultiLineCodeLink(yyscanner,ol,cd,clName); + addToSearchIndex(yyscanner,className); + yyextra->theCallContext.setScope(cd); + if (md) + { + const Definition *d = md->getOuterScope()==Doxygen::globalScope ? + md->getFileDef() : md->getOuterScope(); + if (md->getGroupDef()) d = md->getGroupDef(); + if (d && d->isLinkable() && md->isLinkable() && + yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(md)); + } + } + } + else // not a class, maybe a global member + { + DBG_CTX((stderr,"class %s not linkable! cd=%p md=%p typeOnly=%d\n",clName,cd,md,typeOnly)); + if (!isLocal && (md!=0 || (cd==0 && !typeOnly))) // not a class, see if it is a global enum/variable/typedef. + { + if (md==0) // not found as a typedef + { + md = setCallContextForVar(yyscanner,clName); + //printf("setCallContextForVar(%s) md=%p yyextra->currentDefinition=%p\n",clName,md,yyextra->currentDefinition); + if (md && yyextra->currentDefinition) + { + DBG_CTX((stderr,"%s accessible from %s? %d md->getOuterScope=%s\n", + md->name().data(),yyextra->currentDefinition->name().data(), + isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md), + md->getOuterScope()->name().data())); + } + + if (md && yyextra->currentDefinition && + isAccessibleFrom(yyextra->currentDefinition,yyextra->sourceFileDef,md)==-1) + { + md=0; // variable not accessible + } + } + if (md && (!varOnly || md->isVariable())) + { + DBG_CTX((stderr,"is a global md=%p yyextra->currentDefinition=%s linkable=%d\n",md,yyextra->currentDefinition?yyextra->currentDefinition->name().data():"",md->isLinkable())); + if (md->isLinkable()) + { + QCString text; + if (!yyextra->forceTagReference.isEmpty()) // explicit reference to symbol in tag file + { + text=yyextra->forceTagReference; + if (text.right(4)==".tag") // strip .tag if present + { + text=text.left(text.length()-4); + } + text+=getLanguageSpecificSeparator(md->getLanguage()); + text+=clName; + const_cast(md)->setName(text); + const_cast(md)->setLocalName(text); + } + else // normal reference + { + text=clName; + } + writeMultiLineCodeLink(yyscanner,ol,md,text); + addToSearchIndex(yyscanner,clName); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(md)); + } + return; + } + } + } + + // nothing found, just write out the word + DBG_CTX((stderr,"not found!\n")); + codifyLines(yyscanner,clName); + addToSearchIndex(yyscanner,clName); + } +} + +static bool generateClassMemberLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + MemberDef *xmd, + const char *memName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + // extract class definition of the return type in order to resolve + // a->b()->c() like call chains + + //printf("type='%s' args='%s' class=%s\n", + // xmd->typeString(),xmd->argsString(), + // xmd->getClassDef()->name().data()); + + if (yyextra->exampleBlock) + { + QCString anchor; + anchor.sprintf("a%d",yyextra->anchorCount); + //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(), + // yyextra->exampleFile.data()); + if (xmd->addExample(anchor,yyextra->exampleName,yyextra->exampleFile)) + { + ol.writeCodeAnchor(anchor); + yyextra->anchorCount++; + } + } + + const ClassDef *typeClass = stripClassName(yyscanner,removeAnonymousScopes(xmd->typeString()),xmd->getOuterScope()); + DBG_CTX((stderr,"%s -> typeName=%p\n",xmd->typeString(),typeClass)); + yyextra->theCallContext.setScope(typeClass); + + const Definition *xd = xmd->getOuterScope()==Doxygen::globalScope ? + xmd->getFileDef() : xmd->getOuterScope(); + if (xmd->getGroupDef()) xd = xmd->getGroupDef(); + if (xd && xd->isLinkable()) + { + + //printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",yyextra->currentDefinition,yyextra->currentMemberDef,xmd,yyextra->insideBody); + + if (xmd->templateMaster()) xmd = xmd->templateMaster(); + + if (xmd->isLinkable()) + { + // add usage reference + if (yyextra->currentDefinition && yyextra->currentMemberDef && + /*xmd!=yyextra->currentMemberDef &&*/ yyextra->insideBody && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,xmd); + } + + // write the actual link + writeMultiLineCodeLink(yyscanner,ol,xmd,memName); + addToSearchIndex(yyscanner,memName); + return TRUE; + } + } + + return FALSE; +} + +static bool generateClassMemberLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + const Definition *def, + const char *memName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (def && def->definitionType()==Definition::TypeClass) + { + const ClassDef *cd = dynamic_cast(def); + MemberDef *xmd = cd->getMemberByName(memName); + //printf("generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd); + if (xmd) + { + return generateClassMemberLink(yyscanner,ol,xmd,memName); + } + else + { + Definition *innerDef = cd->findInnerCompound(memName); + if (innerDef) + { + yyextra->theCallContext.setScope(innerDef); + addToSearchIndex(yyscanner,memName); + writeMultiLineCodeLink(yyscanner,*yyextra->code,innerDef,memName); + return TRUE; + } + } + } + else if (def && def->definitionType()==Definition::TypeNamespace) + { + const NamespaceDef *nd = dynamic_cast(def); + //printf("Looking for %s inside namespace %s\n",memName,nd->name().data()); + Definition *innerDef = nd->findInnerCompound(memName); + if (innerDef) + { + yyextra->theCallContext.setScope(innerDef); + addToSearchIndex(yyscanner,memName); + writeMultiLineCodeLink(yyscanner,*yyextra->code,innerDef,memName); + return TRUE; + } + } + return FALSE; +} + +static void generateMemberLink(yyscan_t yyscanner, + CodeOutputInterface &ol, + const QCString &varName, + const char *memName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n", + // varName.data(),memName,yyextra->classScope.data()); + + if (varName.isEmpty()) return; + + // look for the variable in the current context + const ClassDef *vcd = yyextra->theVarContext.findVariable(varName); + if (vcd) + { + if (vcd!=VariableContext::dummyContext) + { + //printf("Class found!\n"); + if (getLink(yyscanner,vcd->name(),memName,ol)) + { + //printf("Found result!\n"); + return; + } + if (vcd->baseClasses()) + { + BaseClassListIterator bcli(*vcd->baseClasses()); + for ( ; bcli.current() ; ++bcli) + { + if (getLink(yyscanner,bcli.current()->classDef->name(),memName,ol)) + { + //printf("Found result!\n"); + return; + } + } + } + } + } + else // variable not in current context, maybe it is in a parent context + { + vcd = getResolvedClass(yyextra->currentDefinition,yyextra->sourceFileDef,yyextra->classScope); + if (vcd && vcd->isLinkable()) + { + //printf("Found class %s for variable '%s'\n",yyextra->classScope.data(),varName.data()); + MemberName *vmn=Doxygen::memberNameSDict->find(varName); + if (vmn==0) + { + int vi; + QCString vn=varName; + if ((vi=vn.findRev("::"))!=-1 || (vi=vn.findRev('.'))!=-1) // explicit scope A::b(), probably static member + { + ClassDef *jcd = getClass(vn.left(vi)); + vn=vn.right(vn.length()-vi-2); + vmn=Doxygen::memberNameSDict->find(vn); + //printf("Trying name '%s' scope=%s\n",vn.data(),scope.data()); + if (vmn) + { + MemberNameIterator vmni(*vmn); + const MemberDef *vmd; + for (;(vmd=vmni.current());++vmni) + { + if (/*(vmd->isVariable() || vmd->isFunction()) && */ + vmd->getClassDef()==jcd) + { + //printf("Found variable type=%s\n",vmd->typeString()); + const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope()); + if (mcd && mcd->isLinkable()) + { + if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return; + } + } + } + } + } + } + if (vmn) + { + //printf("There is a variable with name '%s'\n",varName); + MemberNameIterator vmni(*vmn); + const MemberDef *vmd; + for (;(vmd=vmni.current());++vmni) + { + if (/*(vmd->isVariable() || vmd->isFunction()) && */ + vmd->getClassDef()==vcd) + { + //printf("Found variable type=%s\n",vmd->typeString()); + const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope()); + if (mcd && mcd->isLinkable()) + { + if (generateClassMemberLink(yyscanner,ol,mcd,memName)) return; + } + } + } + } + } + } + // nothing found -> write result as is + codifyLines(yyscanner,memName); + addToSearchIndex(yyscanner,memName); + return; +} + +static void generatePHPVariableLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *varName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString name = varName+7; // strip $this-> + name.prepend("$"); + //printf("generatePHPVariableLink(%s) name=%s scope=%s\n",varName,name.data(),yyextra->classScope.data()); + if (!getLink(yyscanner,yyextra->classScope,name,ol,varName)) + { + codifyLines(yyscanner,varName); + } +} + +static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,const char *funcName) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //CodeClassDef *ccd=0; + ClassDef *ccd=0; + QCString locScope=yyextra->classScope; + QCString locFunc=removeRedundantWhiteSpace(funcName); + if (yyextra->lang==SrcLangExt_PHP && locFunc.startsWith("self::")) locFunc=locFunc.mid(4); + QCString funcScope; + QCString funcWithScope=locFunc; + QCString funcWithFullScope=locFunc; + QCString fullScope=locScope; + DBG_CTX((stdout,"*** locScope=%s locFunc=%s\n",locScope.data(),locFunc.data())); + int len=2; + int i=locFunc.findRev("::"); + if (yyextra->currentMemberDef && yyextra->currentMemberDef->resolveAlias()->getClassDef() && + funcName==yyextra->currentMemberDef->localName() && + yyextra->currentMemberDef->getDefLine()==yyextra->yyLineNr && + generateClassMemberLink(yyscanner,ol,yyextra->currentMemberDef,funcName) + ) + { + // special case where funcName is the name of a method that is also + // defined on this line. In this case we can directly link to + // yyextra->currentMemberDef, which is not only faster, but + // in case of overloaded methods, this will make sure that we link to + // the correct method, and thereby get the correct reimplemented relations. + // See also bug 549022. + goto exit; + } + if (i==-1) i=locFunc.findRev("."),len=1; + if (i==-1) i=locFunc.findRev("\\"),len=1; // for PHP + if (i>0) + { + funcScope=locFunc.left(i); + locFunc=locFunc.right(locFunc.length()-i-len).stripWhiteSpace(); + int ts=locScope.find('<'); // start of template + int te=locScope.findRev('>'); // end of template + //printf("ts=%d te=%d\n",ts,te); + if (ts!=-1 && te!=-1 && te>ts) + { + // remove template from scope + locScope=locScope.left(ts)+locScope.right(locScope.length()-te-1); + } + ts=funcScope.find('<'); // start of template + te=funcScope.findRev('>'); // end of template + //printf("ts=%d te=%d\n",ts,te); + if (ts!=-1 && te!=-1 && te>ts) + { + // remove template from scope + funcScope=funcScope.left(ts)+funcScope.right(funcScope.length()-te-1); + } + if (!funcScope.isEmpty()) + { + funcWithScope = funcScope+"::"+locFunc; + if (!locScope.isEmpty()) + { + fullScope=locScope+"::"+funcScope; + } + } + if (!locScope.isEmpty()) + { + funcWithFullScope = locScope+"::"+funcWithScope; + } + } + if (!fullScope.isEmpty() && (ccd=yyextra->codeClassSDict->find(fullScope))) + { + //printf("using classScope %s\n",yyextra->classScope.data()); + if (ccd->baseClasses()) + { + BaseClassListIterator bcli(*ccd->baseClasses()); + for ( ; bcli.current() ; ++bcli) + { + if (getLink(yyscanner,bcli.current()->classDef->name(),locFunc,ol,funcName)) + { + goto exit; + } + } + } + } + if (!locScope.isEmpty() && fullScope!=locScope && (ccd=yyextra->codeClassSDict->find(locScope))) + { + //printf("using classScope %s\n",yyextra->classScope.data()); + if (ccd->baseClasses()) + { + BaseClassListIterator bcli(*ccd->baseClasses()); + for ( ; bcli.current() ; ++bcli) + { + if (getLink(yyscanner,bcli.current()->classDef->name(),funcWithScope,ol,funcName)) + { + goto exit; + } + } + } + } + if (!getLink(yyscanner,locScope,funcWithScope,ol,funcName)) + { + generateClassOrGlobalLink(yyscanner,ol,funcName); + } +exit: + yyextra->forceTagReference.resize(0); + return; +} + +/*! counts the number of lines in the input */ +static int countLines(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + const char *p=yyextra->inputString; + char c; + int count=1; + while ((c=*p)) + { + p++ ; + if (c=='\n') count++; + } + if (p>yyextra->inputString && *(p-1)!='\n') + { // last line does not end with a \n, so we add an extra + // line and explicitly terminate the line after parsing. + count++, + yyextra->needsTermination=TRUE; + } + return count; +} + +static void endFontClass(yyscan_t yyscanner) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->currentFontClass) + { + yyextra->code->endFontClass(); + yyextra->currentFontClass=0; + } +} + +static void startFontClass(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + endFontClass(yyscanner); + yyextra->code->startFontClass(s); + yyextra->currentFontClass=s; +} + +//---------------------------------------------------------------------------- + +// recursively writes a linkified Objective-C method call +static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx) +{ + if (ctx==0) return; + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + char c; + const char *p = ctx->format.data(); + if (!ctx->methodName.isEmpty()) + { + //printf("writeObjCMethodCall(%s) obj=%s method=%s\n", + // ctx->format.data(),ctx->objectTypeOrName.data(),ctx->methodName.data()); + if (!ctx->objectTypeOrName.isEmpty() && ctx->objectTypeOrName.at(0)!='$') + { + //printf("Looking for object=%s method=%s\n",ctx->objectTypeOrName.data(), + // ctx->methodName.data()); + ClassDef *cd = yyextra->theVarContext.findVariable(ctx->objectTypeOrName); + if (cd==0) // not a local variable + { + if (ctx->objectTypeOrName=="self") + { + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ctx->objectType = dynamic_cast(yyextra->currentDefinition); + } + } + else + { + ctx->objectType = getResolvedClass( + yyextra->currentDefinition, + yyextra->sourceFileDef, + ctx->objectTypeOrName, + &ctx->method); + } + //printf(" object is class? %p\n",ctx->objectType); + if (ctx->objectType) // found class + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + //printf(" yes->method=%s\n",ctx->method?ctx->method->name().data():""); + } + else if (ctx->method==0) // search for class variable with the same name + { + //printf(" no\n"); + //printf("yyextra->currentDefinition=%p\n",yyextra->currentDefinition); + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ctx->objectVar = (dynamic_cast(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName); + //printf(" ctx->objectVar=%p\n",ctx->objectVar); + if (ctx->objectVar) + { + ctx->objectType = stripClassName(yyscanner,ctx->objectVar->typeString(),yyextra->currentDefinition); + //printf(" ctx->objectType=%p\n",ctx->objectType); + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + //printf(" ctx->method=%p\n",ctx->method); + } + } + } + } + } + else // local variable + { + //printf(" object is local variable\n"); + if (cd!=VariableContext::dummyContext && !ctx->methodName.isEmpty()) + { + ctx->method = cd->getMemberByName(ctx->methodName); + //printf(" class=%p method=%p\n",cd,ctx->method); + } + } + } + } + + //printf("["); + while ((c=*p++)) // for each character in ctx->format + { + if (c=='$') + { + char nc=*p++; + if (nc=='$') // escaped $ + { + yyextra->code->codify("$"); + } + else // name fragment or reference to a nested call + { + if (nc=='n') // name fragment + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pName = yyextra->nameDict.find(refId); + if (pName) + { + if (ctx->method && ctx->method->isLinkable()) + { + writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->method,pName->data()); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(ctx->method)); + } + } + else + { + codifyLines(yyscanner,pName->data()); + } + } + else + { + //printf("Invalid name: id=%d\n",refId); + } + } + else if (nc=='o') // reference to potential object name + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pObject = yyextra->objectDict.find(refId); + if (pObject) + { + if (*pObject=="self") + { + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ctx->objectType = dynamic_cast(yyextra->currentDefinition); + if (ctx->objectType->categoryOf()) + { + ctx->objectType = ctx->objectType->categoryOf(); + } + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } + } + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,pObject->data()); + endFontClass(yyscanner); + } + else if (*pObject=="super") + { + if (yyextra->currentDefinition && + yyextra->currentDefinition->definitionType()==Definition::TypeClass) + { + ClassDef *cd = dynamic_cast(yyextra->currentDefinition); + if (cd->categoryOf()) + { + cd = cd->categoryOf(); + } + BaseClassList *bcd = cd->baseClasses(); + if (bcd) // get direct base class (there should be only one) + { + BaseClassListIterator bli(*bcd); + BaseClassDef *bclass; + for (bli.toFirst();(bclass=bli.current());++bli) + { + if (bclass->classDef->compoundType()!=ClassDef::Protocol) + { + ctx->objectType = bclass->classDef; + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } + } + } + } + } + startFontClass(yyscanner,"keyword"); + codifyLines(yyscanner,pObject->data()); + endFontClass(yyscanner); + } + else if (ctx->objectVar && ctx->objectVar->isLinkable()) // object is class variable + { + writeMultiLineCodeLink(yyscanner,*yyextra->code,ctx->objectVar,pObject->data()); + if (yyextra->currentMemberDef && yyextra->collectXRefs) + { + addDocCrossReference(yyextra->currentMemberDef,const_cast(ctx->objectVar)); + } + } + else if (ctx->objectType && + ctx->objectType!=VariableContext::dummyContext && + ctx->objectType->isLinkable() + ) // object is class name + { + const ClassDef *cd = ctx->objectType; + writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,pObject->data()); + } + else // object still needs to be resolved + { + const ClassDef *cd = getResolvedClass(yyextra->currentDefinition, + yyextra->sourceFileDef, *pObject); + if (cd && cd->isLinkable()) + { + if (ctx->objectType==0) ctx->objectType=cd; + writeMultiLineCodeLink(yyscanner,*yyextra->code,cd,pObject->data()); + } + else + { + codifyLines(yyscanner,pObject->data()); + } + } + } + else + { + //printf("Invalid object: id=%d\n",refId); + } + } + else if (nc=='c') // reference to nested call + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + ObjCCallCtx *ictx = yyextra->contextDict.find(refId); + if (ictx) // recurse into nested call + { + writeObjCMethodCall(yyscanner,ictx); + if (ictx->method) // link to nested call successfully + { + // get the ClassDef representing the method's return type + if (QCString(ictx->method->typeString())=="id") + { + // see if the method name is unique, if so we link to it + MemberName *mn=Doxygen::memberNameSDict->find(ctx->methodName); + //printf("mn->count=%d ictx->method=%s ctx->methodName=%s\n", + // mn==0?-1:(int)mn->count(), + // ictx->method->name().data(), + // ctx->methodName.data()); + if (mn && mn->count()==1) // member name unique + { + ctx->method = mn->getFirst(); + } + } + else + { + ctx->objectType = stripClassName(yyscanner,ictx->method->typeString(),yyextra->currentDefinition); + if (ctx->objectType && !ctx->methodName.isEmpty()) + { + ctx->method = ctx->objectType->getMemberByName(ctx->methodName); + } + } + //printf(" ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType); + } + } + else + { + //printf("Invalid context: id=%d\n",refId); + } + } + else if (nc=='w') // some word + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pWord = yyextra->wordDict.find(refId); + if (pWord) + { + codifyLines(yyscanner,pWord->data()); + } + } + else if (nc=='d') // comment block + { + nc=*p++; + QCString refIdStr; + while (nc!=0 && isdigit(nc)) { refIdStr+=nc; nc=*p++; } + p--; + int refId=refIdStr.toInt(); + QCString *pComment = yyextra->commentDict.find(refId); + if (pComment) + { + startFontClass(yyscanner,"comment"); + codifyLines(yyscanner,pComment->data()); + endFontClass(yyscanner); + } + } + else // illegal marker + { + ASSERT(!"invalid escape sequence"); + } + } + } + else // normal non-marker character + { + char s[2]; + s[0]=c;s[1]=0; + codifyLines(yyscanner,s); + } + } + //printf("%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data()); + //printf("}=(type='%s',name='%s')", + // ctx->objectTypeOrName.data(), + // ctx->methodName.data()); +} + +// Replaces an Objective-C method name fragment s by a marker of the form +// $n12, the number (12) can later be used as a key for obtaining the name +// fragment, from yyextra->nameDict +static QCString escapeName(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$n%d",yyextra->currentNameId); + yyextra->nameDict.insert(yyextra->currentNameId,new QCString(s)); + yyextra->currentNameId++; + return result; +} + +static QCString escapeObject(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$o%d",yyextra->currentObjId); + yyextra->objectDict.insert(yyextra->currentObjId,new QCString(s)); + yyextra->currentObjId++; + return result; +} + +static QCString escapeWord(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$w%d",yyextra->currentWordId); + yyextra->wordDict.insert(yyextra->currentWordId,new QCString(s)); + yyextra->currentWordId++; + return result; +} + +static QCString escapeComment(yyscan_t yyscanner,const char *s) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + QCString result; + result.sprintf("$d%d",yyextra->currentCommentId); + yyextra->commentDict.insert(yyextra->currentCommentId,new QCString(s)); + yyextra->currentCommentId++; + return result; +} + +static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const QCString &kw) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + return yyextra->lang==SrcLangExt_Cpp && (kw == "remove" || kw == "set" || kw == "get"); +} + +static bool isCastKeyword(const QCString &s) +{ + int i=s.find('<'); + if (i==-1) return FALSE; + QCString kw = s.left(i).stripWhiteSpace(); + return kw=="const_cast" || kw=="static_cast" || kw=="dynamic_cast" || kw=="reinterpret_cast"; +} + +static int yyread(yyscan_t yyscanner,char *buf,int max_size) +{ + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + int inputPosition = yyextra->inputPosition; + const char *s = yyextra->inputString + yyextra->inputPosition; + int c=0; + while( c < max_size && *s ) + { + *buf++ = *s++; + c++; + } + yyextra->inputPosition += c; + return c; +} -/*@ ---------------------------------------------------------------------------- - */ -static void saveObjCContext() +static void saveObjCContext(yyscan_t yyscanner) { - if (g_currentCtx) + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + if (yyextra->currentCtx) { - g_currentCtx->format+=QCString().sprintf("$c%d",g_currentCtxId); - if (g_braceCount==0 && YY_START==ObjCCall) + yyextra->currentCtx->format+=QCString().sprintf("$c%d",yyextra->currentCtxId); + if (yyextra->braceCount==0 && YY_START==ObjCCall) { - g_currentCtx->objectTypeOrName=g_currentCtx->format.mid(1); - //printf("new type=%s\n",g_currentCtx->objectTypeOrName.data()); + yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1); + //printf("new type=%s\n",yyextra->currentCtx->objectTypeOrName.data()); } - g_contextStack.push(g_currentCtx); + yyextra->contextStack.push(yyextra->currentCtx); } else { //printf("Trying to save NULL context!\n"); } ObjCCallCtx *newCtx = new ObjCCallCtx; - newCtx->id = g_currentCtxId; + newCtx->id = yyextra->currentCtxId; newCtx->lexState = YY_START; - newCtx->braceCount = g_braceCount; + newCtx->braceCount = yyextra->braceCount; newCtx->objectType = 0; newCtx->objectVar = 0; newCtx->method = 0; //printf("save state=%d\n",YY_START); - g_contextDict.insert(g_currentCtxId,newCtx); - g_currentCtx = newCtx; - g_braceCount = 0; - g_currentCtxId++; + yyextra->contextDict.insert(yyextra->currentCtxId,newCtx); + yyextra->currentCtx = newCtx; + yyextra->braceCount = 0; + yyextra->currentCtxId++; } -static void restoreObjCContext() +static void restoreObjCContext(yyscan_t yyscanner) { - //printf("restore state=%d->%d\n",YY_START,g_currentCtx->lexState); - BEGIN(g_currentCtx->lexState); - g_braceCount = g_currentCtx->braceCount; - if (!g_contextStack.isEmpty()) + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; + //printf("restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState); + BEGIN(yyextra->currentCtx->lexState); + yyextra->braceCount = yyextra->currentCtx->braceCount; + if (!yyextra->contextStack.isEmpty()) { - g_currentCtx = g_contextStack.pop(); + yyextra->currentCtx = yyextra->contextStack.pop(); } else { - g_currentCtx = 0; - //printf("Trying to pop context while g_contextStack is empty!\n"); + yyextra->currentCtx = 0; + //printf("Trying to pop context while yyextra->contextStack is empty!\n"); } } -void resetCCodeParserState() +struct CodeScanner::Private +{ + yyscan_t yyscanner; + codeYY_state state; +}; + +CodeScanner::CodeScanner() +{ + p = new Private; + codeYYlex_init_extra(&p->state,&p->yyscanner); + YY_EXTRA_TYPE state = codeYYget_extra(p->yyscanner); +} + +CodeScanner::~CodeScanner() { - //printf("***initParseCodeContext()\n"); - g_forceTagReference.resize(0); - g_theVarContext.clear(); - g_classScopeLengthStack.setAutoDelete(TRUE); - g_classScopeLengthStack.clear(); - delete g_codeClassSDict; - g_codeClassSDict = new ClassSDict(17); - g_codeClassSDict->setAutoDelete(TRUE); - g_codeClassSDict->clear(); - g_curClassBases.clear(); - g_anchorCount = 0; + codeYYlex_destroy(p->yyscanner); + delete p; } -void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, +void CodeScanner::reset() +{ + struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner; + //printf("***CodeParser::reset()\n"); + yyextra->forceTagReference.resize(0); + yyextra->theVarContext.clear(); + yyextra->classScopeLengthStack.setAutoDelete(TRUE); + yyextra->classScopeLengthStack.clear(); + delete yyextra->codeClassSDict; + yyextra->codeClassSDict = new ClassSDict(17); + yyextra->codeClassSDict->setAutoDelete(TRUE); + yyextra->codeClassSDict->clear(); + yyextra->curClassBases.clear(); + yyextra->anchorCount = 0; +} + +void CodeScanner::parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, SrcLangExt lang,bool exBlock, const char *exName,FileDef *fd, int startLine,int endLine,bool inlineFragment, const MemberDef *memberDef,bool showLineNumbers,const Definition *searchCtx, bool collectXRefs) { + yyscan_t yyscanner = p->yyscanner; + struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("***parseCode() exBlock=%d exName=%s fd=%p className=%s searchCtx=%s\n", // exBlock,exName,fd,className,searchCtx?searchCtx->name().data():""); @@ -3778,103 +3911,92 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, printlex(yy_flex_debug, TRUE, __FILE__, fd ? fd->fileName().data(): NULL); - if (g_codeClassSDict==0) + if (yyextra->codeClassSDict==0) { - resetCCodeParserState(); + reset(); } - g_code = &od; - g_inputString = s; - g_inputPosition = 0; - g_currentFontClass = 0; - g_needsTermination = FALSE; - g_searchCtx = searchCtx; - g_collectXRefs = collectXRefs; - g_inFunctionTryBlock = FALSE; + yyextra->code = &od; + yyextra->inputString = s; + yyextra->inputPosition = 0; + yyextra->currentFontClass = 0; + yyextra->needsTermination = FALSE; + yyextra->searchCtx = searchCtx; + yyextra->collectXRefs = collectXRefs; + yyextra->inFunctionTryBlock = FALSE; if (startLine!=-1) - g_yyLineNr = startLine; + yyextra->yyLineNr = startLine; else - g_yyLineNr = 1; + yyextra->yyLineNr = 1; if (endLine!=-1) - g_inputLines = endLine+1; + yyextra->inputLines = endLine+1; else - g_inputLines = g_yyLineNr + countLines() - 1; - - g_curlyCount = 0; - g_bodyCurlyCount = 0; - g_bracketCount = 0; - g_sharpCount = 0; - g_insideTemplate = FALSE; - g_theCallContext.clear(); - g_scopeStack.clear(); - g_classScope = className; + yyextra->inputLines = yyextra->yyLineNr + countLines(yyscanner) - 1; + + yyextra->curlyCount = 0; + yyextra->bodyCurlyCount = 0; + yyextra->bracketCount = 0; + yyextra->sharpCount = 0; + yyextra->insideTemplate = FALSE; + yyextra->theCallContext.clear(); + yyextra->scopeStack.clear(); + yyextra->classScope = className; //printf("parseCCode %s\n",className); - g_exampleBlock = exBlock; - g_exampleName = exName; - g_sourceFileDef = fd; - g_lineNumbers = fd!=0 && showLineNumbers; + yyextra->exampleBlock = exBlock; + yyextra->exampleName = exName; + yyextra->sourceFileDef = fd; + yyextra->lineNumbers = fd!=0 && showLineNumbers; bool cleanupSourceDef = FALSE; if (fd==0) { // create a dummy filedef for the example - g_sourceFileDef = createFileDef("",(exName?exName:"generated")); + yyextra->sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } - g_lang = lang; - g_insideObjC = lang==SrcLangExt_ObjC; - if (g_sourceFileDef) + yyextra->lang = lang; + yyextra->insideObjC = lang==SrcLangExt_ObjC; + if (yyextra->sourceFileDef) { - setCurrentDoc("l00001"); + setCurrentDoc(yyscanner,"l00001"); } - g_currentDefinition = 0; - g_currentMemberDef = 0; - g_searchingForBody = exBlock; - g_insideBody = FALSE; - g_bracketCount = 0; - if (!g_exampleName.isEmpty()) + yyextra->currentDefinition = 0; + yyextra->currentMemberDef = 0; + yyextra->searchingForBody = exBlock; + yyextra->insideBody = FALSE; + yyextra->bracketCount = 0; + if (!yyextra->exampleName.isEmpty()) { - g_exampleFile = convertNameToFile(g_exampleName+"-example",FALSE,TRUE); - //printf("g_exampleFile=%s\n",g_exampleFile.data()); + yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example",FALSE,TRUE); + //printf("yyextra->exampleFile=%s\n",yyextra->exampleFile.data()); } - g_includeCodeFragment = inlineFragment; + yyextra->includeCodeFragment = inlineFragment; //printf("** exBlock=%d exName=%s include=%d\n",exBlock,exName,inlineFragment); - startCodeLine(); - g_type.resize(0); - g_name.resize(0); - g_args.resize(0); - g_parmName.resize(0); - g_parmType.resize(0); - if (memberDef) setParameterList(memberDef); - codeYYrestart( codeYYin ); + startCodeLine(yyscanner); + yyextra->type.resize(0); + yyextra->name.resize(0); + yyextra->args.resize(0); + yyextra->parmName.resize(0); + yyextra->parmType.resize(0); + if (memberDef) setParameterList(yyscanner,memberDef); BEGIN( Body ); - codeYYlex(); - g_lexInit=TRUE; - if (g_needsTermination) + codeYYlex(yyscanner); + yyextra->lexInit=TRUE; + if (yyextra->needsTermination) { - endFontClass(); - DBG_CTX((stderr,"endCodeLine(%d)\n",g_yyLineNr)); - g_code->endCodeLine(); + endFontClass(yyscanner); + DBG_CTX((stderr,"endCodeLine(%d)\n",yyextra->yyLineNr)); + yyextra->code->endCodeLine(); } if (cleanupSourceDef) { // delete the temporary file definition used for this example - delete g_sourceFileDef; - g_sourceFileDef=0; + delete yyextra->sourceFileDef; + yyextra->sourceFileDef=0; } printlex(yy_flex_debug, FALSE, __FILE__, fd ? fd->fileName().data(): NULL); return; } -void codeFreeScanner() -{ -#if defined(YY_FLEX_SUBMINOR_VERSION) - if (g_lexInit) - { - codeYYlex_destroy(); - } -#endif -} - #include "code.l.h" diff --git a/src/doxygen.cpp b/src/doxygen.cpp index b4a4deb..d4d55e7 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -8992,7 +8992,8 @@ static void generateExampleDocs() for (pdi.toFirst();(pd=pdi.current());++pdi) { msg("Generating docs for example %s...\n",pd->name().data()); - resetCCodeParserState(); + ParserInterface *pIntf = Doxygen::parserManager->getParser(".c"); // TODO: do this on code type + pIntf->resetCodeParserState(); QCString n=pd->getOutputFileBase(); startFile(*g_outputList,n,n,pd->name()); startTitle(*g_outputList,n); @@ -10187,7 +10188,6 @@ void cleanUpDoxygen() delete theTranslator; delete g_outputList; Mappers::freeMappers(); - codeFreeScanner(); if (Doxygen::symbolMap) { diff --git a/src/scanner.l b/src/scanner.l index 37fcb1c..2b277db 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -201,6 +201,8 @@ static bool g_nestedComment=0; static std::vector< std::pair > > g_outerScopeEntries; +static CodeScanner g_codeScanner; + static const char *stateToString(int state); //----------------------------------------------------------------------------- @@ -7359,6 +7361,7 @@ void CLanguageScanner::parseInput(const char *fileName, printlex(yy_flex_debug, FALSE, __FILE__, fileName); } + void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, const char * scopeName, const QCString & input, @@ -7375,7 +7378,7 @@ void CLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf, bool collectXRefs ) { - ::parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, + g_codeScanner.parseCCode(codeOutIntf,scopeName,input,lang,isExampleBlock,exampleName, fileDef,startLine,endLine,inlineFragment,memberDef, showLineNumbers,searchCtx,collectXRefs); } @@ -7392,7 +7395,7 @@ bool CLanguageScanner::needsPreprocessing(const QCString &extension) const void CLanguageScanner::resetCodeParserState() { - ::resetCCodeParserState(); + g_codeScanner.reset(); } void CLanguageScanner::parsePrototype(const char *text) -- cgit v0.12 From 146bec22e9ff91e8274becd719149f7ab9c7cfb9 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 22 Nov 2019 14:56:50 +0100 Subject: Better termination message In case a `WARN_LOGFILE` is used it in this file no clear whether doxygen finished correctly or exited beforehand in case a fatal error. Now a 'Exiting...' is also given in the warning log file in case an error is a fatal error. --- src/commentscan.l | 3 +- src/configimpl.l | 73 +++++++++++++++++++------------------------- src/defgen.cpp | 3 +- src/diagram.cpp | 3 +- src/docbookgen.cpp | 3 +- src/docsets.cpp | 12 +++----- src/dot.cpp | 4 +-- src/dotgfxhierarchytable.cpp | 2 +- src/dotgraph.cpp | 2 +- src/doxygen.cpp | 24 +++++---------- src/eclipsehelp.cpp | 3 +- src/formula.cpp | 5 ++- src/htmlgen.cpp | 3 +- src/htmlhelp.cpp | 9 ++---- src/latexgen.cpp | 9 ++---- src/mangen.cpp | 6 ++-- src/message.cpp | 28 +++++++++++++++++ src/message.h | 2 ++ src/outputgen.cpp | 3 +- src/perlmodgen.cpp | 3 +- src/qhp.cpp | 3 +- src/rtfgen.cpp | 3 +- src/util.cpp | 6 ++-- 23 files changed, 101 insertions(+), 111 deletions(-) diff --git a/src/commentscan.l b/src/commentscan.l index 2b10f87..9d09fa1 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -327,8 +327,7 @@ class DocCmdMapper { if (m_map.find(p->cmdName)!=0) { - err("DocCmdMapper: command %s already added\n",p->cmdName); - exit(1); + term(1,"DocCmdMapper: command %s already added\n",p->cmdName); } Cmd *cmd = new Cmd; cmd->func = p->handler; diff --git a/src/configimpl.l b/src/configimpl.l index 0cc5c88..ba95dce 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -56,6 +56,16 @@ void config_err(const char *fmt, ...) vfprintf(stderr, (QCString(error_str) + fmt).data(), args); va_end(args); } +void config_term(const int exitVal, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(stderr, (QCString(error_str) + fmt).data(), args); + va_end(args); + fprintf(stderr, "%s\n", "Exiting..."); + exit(exitVal); +} + void config_warn(const char *fmt, ...) { va_list args; @@ -213,13 +223,11 @@ QCString &ConfigImpl::getString(const char *fileName,int num,const char *name) c ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_String) { - config_err("%s<%d>: Internal error: Requested option %s not of string type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of string type!\n",fileName,num,name); } return *((ConfigString *)opt)->valueRef(); } @@ -229,13 +237,11 @@ QStrList &ConfigImpl::getList(const char *fileName,int num,const char *name) con ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_List) { - config_err("%s<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name); } return *((ConfigList *)opt)->valueRef(); } @@ -245,13 +251,11 @@ QCString &ConfigImpl::getEnum(const char *fileName,int num,const char *name) con ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Enum) { - config_err("%s<%d>: Internal error: Requested option %s not of enum type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of enum type!\n",fileName,num,name); } return *((ConfigEnum *)opt)->valueRef(); } @@ -261,13 +265,11 @@ int &ConfigImpl::getInt(const char *fileName,int num,const char *name) const ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Int) { - config_err("%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name); } return *((ConfigInt *)opt)->valueRef(); } @@ -277,13 +279,11 @@ bool &ConfigImpl::getBool(const char *fileName,int num,const char *name) const ConfigOption *opt = m_dict->find(name); if (opt==0) { - config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } else if (opt->kind()!=ConfigOption::O_Bool) { - config_err("%s<%d>: Internal error: Requested option %s not of boolean type!\n",fileName,num,name); - exit(1); + config_term(1,"%s<%d>: Internal error: Requested option %s not of boolean type!\n",fileName,num,name); } return *((ConfigBool *)opt)->valueRef(); } @@ -566,9 +566,8 @@ static QCString configStringRecode( void *cd = portable_iconv_open(outputEncoding,inputEncoding); if (cd==(void *)(-1)) { - fprintf(stderr,"Error: unsupported character conversion: '%s'->'%s'\n", + config_term(1,"Error: unsupported character conversion: '%s'->'%s'\n", inputEncoding.data(),outputEncoding.data()); - exit(1); } size_t iLeft=(size_t)inputSize; size_t oLeft=(size_t)outputSize; @@ -583,9 +582,8 @@ static QCString configStringRecode( } else { - fprintf(stderr,"Error: failed to translate characters from %s to %s: %s\n", + config_term(1,"Error: failed to translate characters from %s to %s: %s\n", inputEncoding.data(),outputEncoding.data(),strerror(errno)); - exit(1); } portable_iconv_close(cd); return output; @@ -638,9 +636,8 @@ static FILE *findFile(const char *fileName) static void readIncludeFile(const char *incName) { if (includeDepth==MAX_INCLUDE_DEPTH) { - config_err("maximum include depth (%d) reached, %s is not included. Aborting...\n", + config_term(1,"maximum include depth (%d) reached, %s is not included. Aborting...\n", MAX_INCLUDE_DEPTH,incName); - exit(1); } QCString inc = incName; @@ -678,8 +675,7 @@ static void readIncludeFile(const char *incName) } else { - config_err("@INCLUDE = %s: not found!\n",inc.data()); - exit(1); + config_term(1,"@INCLUDE = %s: not found!\n",inc.data()); } } @@ -1161,9 +1157,8 @@ void ConfigImpl::init() ConfigOption * opt = ConfigImpl::instance()->get(depName); if (opt==0) { - config_warn("Config option '%s' has invalid depends relation on unknown option '%s'\n", + config_term(1,"Config option '%s' has invalid depends relation on unknown option '%s'\n", option->name().data(),depName.data()); - exit(1); } } } @@ -1229,8 +1224,7 @@ static QCString configFileToString(const char *name) } if (!fileOpened) { - config_err("cannot open file '%s' for reading\n",name); - exit(1); + config_term(1,"cannot open file '%s' for reading\n",name); } return ""; } @@ -1408,9 +1402,8 @@ void Config::checkAndCorrect() QFileInfo fi(headerFile); if (!fi.exists()) { - err("tag HTML_HEADER: header file '%s' " + term(1,"tag HTML_HEADER: header file '%s' " "does not exist\n",headerFile.data()); - exit(1); } } // Test to see if HTML footer is valid @@ -1420,9 +1413,8 @@ void Config::checkAndCorrect() QFileInfo fi(footerFile); if (!fi.exists()) { - err("tag HTML_FOOTER: footer file '%s' " + term(1,"tag HTML_FOOTER: footer file '%s' " "does not exist\n",footerFile.data()); - exit(1); } } @@ -1435,9 +1427,8 @@ void Config::checkAndCorrect() QFileInfo fi(MathJaxCodefile); if (!fi.exists()) { - err("tag MATHJAX_CODEFILE file '%s' " + term(1,"tag MATHJAX_CODEFILE file '%s' " "does not exist\n",MathJaxCodefile.data()); - exit(1); } } QCString &path = Config_getString(MATHJAX_RELPATH); @@ -1455,9 +1446,8 @@ void Config::checkAndCorrect() QFileInfo fi(latexHeaderFile); if (!fi.exists()) { - err("tag LATEX_HEADER: header file '%s' " + term(1,"tag LATEX_HEADER: header file '%s' " "does not exist\n",latexHeaderFile.data()); - exit(1); } } // Test to see if LaTeX footer is valid @@ -1467,9 +1457,8 @@ void Config::checkAndCorrect() QFileInfo fi(latexFooterFile); if (!fi.exists()) { - err("tag LATEX_FOOTER: footer file '%s' " + term(1,"tag LATEX_FOOTER: footer file '%s' " "does not exist\n",latexFooterFile.data()); - exit(1); } } diff --git a/src/defgen.cpp b/src/defgen.cpp index f5e12aa..6ae98a6 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -572,9 +572,8 @@ void generateDEF() dir.setPath(QDir::currentDirPath()); if (!dir.mkdir(outputDirectory)) { - err("tag OUTPUT_DIRECTORY: Output directory '%s' does not " + term(1,"tag OUTPUT_DIRECTORY: Output directory '%s' does not " "exist and cannot be created\n",outputDirectory.data()); - exit(1); } else { diff --git a/src/diagram.cpp b/src/diagram.cpp index edc895d..3d0c22a 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -1101,8 +1101,7 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, f1.setName(epsName.data()); if (!f1.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",f1.name().data()); - exit(1); + term(1,"Could not open file %s for writing\n",f1.name().data()); } FTextStream t(&f1); diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 083aac3..8040c92 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -289,8 +289,7 @@ void DocbookGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } createSubDirs(d); diff --git a/src/docsets.cpp b/src/docsets.cpp index 055532a..b33aea5 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -62,8 +62,7 @@ void DocSets::initialize() QFile makefile(mfName); if (!makefile.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",mfName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",mfName.data()); } FTextStream ts(&makefile); @@ -113,8 +112,7 @@ void DocSets::initialize() QFile plist(plName); if (!plist.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",plName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",plName.data()); } FTextStream ts(&plist); @@ -149,8 +147,7 @@ void DocSets::initialize() m_nf = new QFile(notes); if (!m_nf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",notes.data()); - exit(1); + term(1,"Could not open file %s for writing\n",notes.data()); } //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; @@ -170,8 +167,7 @@ void DocSets::initialize() m_tf = new QFile(tokens); if (!m_tf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",tokens.data()); - exit(1); + term(1,"Could not open file %s for writing\n",tokens.data()); } m_tts.setDevice(m_tf); m_tts << "" << endl; diff --git a/src/dot.cpp b/src/dot.cpp index 5ad3916..2fb3b3e 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -272,7 +272,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, QDir d(outDir); if (!d.exists()) { - err("Output dir %s does not exist!\n",outDir); exit(1); + term(1,"Output dir %s does not exist!\n",outDir); } QCString imgExt = getDotImageExtension(); @@ -325,7 +325,7 @@ void writeDotImageMapFromFile(FTextStream &t, QDir d(outDir); if (!d.exists()) { - err("Output dir %s does not exist!\n",outDir.data()); exit(1); + term(1,"Output dir %s does not exist!\n",outDir.data()); } QCString mapName = baseName+".map"; diff --git a/src/dotgfxhierarchytable.cpp b/src/dotgfxhierarchytable.cpp index 0a7942f..df9f48f 100644 --- a/src/dotgfxhierarchytable.cpp +++ b/src/dotgfxhierarchytable.cpp @@ -86,7 +86,7 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out, // store the original directory if (!d.exists()) { - err("Output dir %s does not exist!\n",path); exit(1); + term(1,"Output dir %s does not exist!\n",path); } // put each connected subgraph of the hierarchy in a row of the HTML output diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index 9b7ddb7..c17523b 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -147,7 +147,7 @@ bool DotGraph::prepareDotFile() { if (!m_dir.exists()) { - err("Output dir %s does not exist!\n", m_dir.path().data()); exit(1); + term(1,"Output dir %s does not exist!\n", m_dir.path().data()); } QCString sigStr(33); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index d4d55e7..52381b8 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -8800,10 +8800,9 @@ static void computePageRelations(Entry *root) PageDef *subPd = Doxygen::pageSDict->find(bi.name); if (pd==subPd) { - err("page defined at line %d of file %s with label %s is a direct " + term(1,"page defined at line %d of file %s with label %s is a direct " "subpage of itself! Please remove this cyclic dependency.\n", pd->docLine(),pd->docFile().data(),pd->name().data()); - exit(1); } else if (subPd) { @@ -8828,10 +8827,9 @@ static void checkPageRelations() { if (ppd==pd) { - err("page defined at line %d of file %s with label %s is a subpage " + term(1,"page defined at line %d of file %s with label %s is a subpage " "of itself! Please remove this cyclic dependency.\n", pd->docLine(),pd->docFile().data(),pd->name().data()); - exit(1); } ppd=ppd->getOuterScope(); } @@ -9164,8 +9162,7 @@ static void generateConfigFile(const char *configFile,bool shortList, } else { - err("Cannot open file %s for writing\n",configFile); - exit(1); + term(1,"Cannot open file %s for writing\n",configFile); } } static void compareDoxyfile() @@ -9182,8 +9179,7 @@ static void compareDoxyfile() } else { - err("Cannot open file %s for writing\n",configFile); - exit(1); + term(1,"Cannot open file %s for writing\n",configFile); } } //---------------------------------------------------------------------------- @@ -9821,17 +9817,15 @@ void readFormulaRepository(QCString dir, bool cmp) { if ((f=Doxygen::formulaDict->find(formText))==0) { - err("discrepancy between formula repositories! Remove " + term(1,"discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } QCString formLabel; formLabel.sprintf("\\form#%d",f->getId()); if (formLabel != formName) { - err("discrepancy between formula repositories! Remove " + term(1,"discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } new_repository++; } @@ -9848,9 +9842,8 @@ void readFormulaRepository(QCString dir, bool cmp) } if (cmp && (current_repository != new_repository)) { - err("size discrepancy between formula repositories! Remove " + term(1,"size discrepancy between formula repositories! Remove " "formula.repository and from_* files from output directories."); - exit(1); } } @@ -11661,9 +11654,8 @@ void generateOutput() QDir searchDir(searchDirName); if (!searchDir.exists() && !searchDir.mkdir(searchDirName)) { - err("Could not create search results directory '%s' $PWD='%s'\n", + term(1,"Could not create search results directory '%s' $PWD='%s'\n", searchDirName.data(),QDir::currentDirPath().data()); - exit(1); } HtmlGenerator::writeSearchData(searchDirName); if (!serverBasedSearch) // client side search index diff --git a/src/eclipsehelp.cpp b/src/eclipsehelp.cpp index 2757308..04f2947 100644 --- a/src/eclipsehelp.cpp +++ b/src/eclipsehelp.cpp @@ -72,8 +72,7 @@ void EclipseHelp::initialize() m_tocfile = new QFile(name); if (!m_tocfile->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n", name.data()); - exit(1); + term(1,"Could not open file %s for writing\n", name.data()); } // -- initialize its text stream diff --git a/src/formula.cpp b/src/formula.cpp index 3d8e6ce..a17b9b7 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -51,7 +51,10 @@ void FormulaList::generateBitmaps(const char *path) int x1,y1,x2,y2; QDir d(path); // store the original directory - if (!d.exists()) { err("Output dir %s does not exist!\n",path); exit(1); } + if (!d.exists()) + { + term(1,"Output dir %s does not exist!\n",path); + } QCString oldDir = QDir::currentDirPath().utf8(); // go to the html output directory (i.e. path) QDir::setCurrent(d.absPath()); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index df39d32..ab3bfa4 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -733,8 +733,7 @@ void HtmlGenerator::init() QDir d(dname); if (!d.exists() && !d.mkdir(dname)) { - err("Could not create output directory %s\n",dname.data()); - exit(1); + term(1,"Could not create output directory %s\n",dname.data()); } //writeLogo(dname); if (!Config_getString(HTML_HEADER).isEmpty()) diff --git a/src/htmlhelp.cpp b/src/htmlhelp.cpp index c514102..6101984 100644 --- a/src/htmlhelp.cpp +++ b/src/htmlhelp.cpp @@ -308,8 +308,7 @@ void HtmlHelp::initialize() m_fromUtf8 = portable_iconv_open(str,"UTF-8"); if (m_fromUtf8==(void *)(-1)) { - err("unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str); - exit(1); + term(1,"unsupported character conversion for CHM_INDEX_ENCODING: '%s'->'UTF-8'\n", str); } /* open the contents file */ @@ -317,8 +316,7 @@ void HtmlHelp::initialize() cf = new QFile(fName); if (!cf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fName.data()); } /* Write the header of the contents file */ cts.setDevice(cf); @@ -334,8 +332,7 @@ void HtmlHelp::initialize() kf = new QFile(fName); if (!kf->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fName.data()); } /* Write the header of the contents file */ kts.setDevice(kf); diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 094232f..bd86038 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -288,8 +288,7 @@ static void writeLatexMakefile() QFile file(fileName); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } // inserted by KONNO Akihisa 2002-03-05 QCString latex_command = theTranslator->latexCommandName(); @@ -387,8 +386,7 @@ static void writeMakeBat() bool generateBib = !Doxygen::citeDict->isEmpty(); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } FTextStream t(&file); t << "set Dir_Old=%cd%\n"; @@ -468,8 +466,7 @@ void LatexGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } writeLatexMakefile(); diff --git a/src/mangen.cpp b/src/mangen.cpp index 06d3c4a..f4eba20 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -112,14 +112,12 @@ void ManGenerator::init() QDir d(manOutput); if (!d.exists() && !d.mkdir(manOutput)) { - err("Could not create output directory %s\n",manOutput.data()); - exit(1); + term(1,"Could not create output directory %s\n",manOutput.data()); } d.setPath(manOutput + "/" + getSubdir()); if (!d.exists() && !d.mkdir(manOutput + "/" + getSubdir())) { - err("Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); - exit(1); + term(1,"Could not create output directory %s/%s\n",manOutput.data(), getSubdir().data()); } createSubDirs(d); } diff --git a/src/message.cpp b/src/message.cpp index ddf757a..4b430da 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -251,6 +251,34 @@ extern void err_full(const char *file,int line,const char *fmt, ...) va_end(args); } +void term(const int exitVal, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vfprintf(warnFile, (QCString(error_str) + fmt).data(), args); + va_end(args); + if (warnFile != stderr) + { + for (int i = 0; i < strlen(error_str); i++) fprintf(warnFile, " "); + fprintf(warnFile, "%s\n", "Exiting..."); + } + exit(exitVal); +} + +extern void term_full(const int exitVal, const char *file,int line,const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + do_warn(TRUE, file, line, error_str, fmt, args); + va_end(args); + if (warnFile != stderr) + { + for (int i = 0; i < strlen(error_str); i++) fprintf(warnFile, " "); + fprintf(warnFile, "%s\n", "Exiting..."); + } + exit(exitVal); +} + void printlex(int dbg, bool enter, const char *lexName, const char *fileName) { const char *enter_txt = "entering"; diff --git a/src/message.h b/src/message.h index 3b1a294..56e7e27 100644 --- a/src/message.h +++ b/src/message.h @@ -30,6 +30,8 @@ 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 int exitVal, const char *fmt, ...); +extern void term_full(const int exitVal, const char *file,int line,const char *fmt, ...); void initWarningFormat(); extern void printlex(int dbg, bool enter, const char *lexName, const char *fileName); diff --git a/src/outputgen.cpp b/src/outputgen.cpp index 53d2d7f..ea8fd5e 100644 --- a/src/outputgen.cpp +++ b/src/outputgen.cpp @@ -46,8 +46,7 @@ void OutputGenerator::startPlainFile(const char *name) file = new QFile(fileName); if (!file->open(IO_WriteOnly)) { - err("Could not open file %s for writing\n",fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n",fileName.data()); } t.setDevice(file); } diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index be226b7..bf20d45 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -2271,9 +2271,8 @@ bool PerlModGenerator::createOutputDir(QDir &perlModDir) dir.setPath(QDir::currentDirPath()); if (!dir.mkdir(outputDirectory)) { - err("tag OUTPUT_DIRECTORY: Output directory '%s' does not " + term(1,"tag OUTPUT_DIRECTORY: Output directory '%s' does not " "exist and cannot be created\n",outputDirectory.data()); - exit(1); } else { diff --git a/src/qhp.cpp b/src/qhp.cpp index 6260d09..484475c 100644 --- a/src/qhp.cpp +++ b/src/qhp.cpp @@ -168,8 +168,7 @@ void Qhp::finalize() QFile file(fileName); if (!file.open(IO_WriteOnly)) { - err("Could not open file %s for writing\n", fileName.data()); - exit(1); + term(1,"Could not open file %s for writing\n", fileName.data()); } m_doc.dumpTo(file); } diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 92740f4..2702cca 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -175,8 +175,7 @@ void RTFGenerator::init() QDir d(dir); if (!d.exists() && !d.mkdir(dir)) { - err("Could not create output directory %s\n",dir.data()); - exit(1); + term(1,"Could not create output directory %s\n",dir.data()); } rtf_Style.setAutoDelete(TRUE); diff --git a/src/util.cpp b/src/util.cpp index f58a630..92b97b6 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7950,10 +7950,9 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size void *cd = portable_iconv_open(outputEncoding,inputEncoding); if (cd==(void *)(-1)) { - err("unsupported character conversion: '%s'->'%s': %s\n" + term(1,"unsupported character conversion: '%s'->'%s': %s\n" "Check the INPUT_ENCODING setting in the config file!\n", inputEncoding,outputEncoding,strerror(errno)); - exit(1); } int tmpBufSize=size*4+1; BufStr tmpBuf(tmpBufSize); @@ -7971,9 +7970,8 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size } else { - err("%s: failed to translate characters from %s to %s: check INPUT_ENCODING\n", + term(1,"%s: failed to translate characters from %s to %s: check INPUT_ENCODING\n", fileName,inputEncoding,outputEncoding); - exit(1); } portable_iconv_close(cd); return newSize; -- cgit v0.12 From 42355ace21f6fb72fba49316c73c025a12482b09 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 22 Nov 2019 16:50:03 +0100 Subject: Problem converting UCS big endian file When having a file with a Big Endian BOM this is not always handled in a correct way when using the generic UCS-2 approach, using the explicit version works well. (problems see with a gcc (SUSE Linux) 7.4.1 20190905 [gcc-7-branch revision 275407] and glibc-2.26-lp151.18.7.x86_64). --- src/util.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index f58a630..5868b62 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8033,13 +8033,18 @@ bool readInputFile(const char *fileName,BufStr &inBuf,bool filter,bool isSourceC int start=0; if (size>=2 && - (((uchar)inBuf.at(0)==0xFF && (uchar)inBuf.at(1)==0xFE) || // Little endian BOM - ((uchar)inBuf.at(0)==0xFE && (uchar)inBuf.at(1)==0xFF) // big endian BOM - ) - ) // UCS-2 encoded file + ((uchar)inBuf.at(0)==0xFF && (uchar)inBuf.at(1)==0xFE) // Little endian BOM + ) // UCS-2LE encoded file + { + transcodeCharacterBuffer(fileName,inBuf,inBuf.curPos(), + "UCS-2LE","UTF-8"); + } + else if (size>=2 && + ((uchar)inBuf.at(0)==0xFE && (uchar)inBuf.at(1)==0xFF) // big endian BOM + ) // UCS-2BE encoded file { transcodeCharacterBuffer(fileName,inBuf,inBuf.curPos(), - "UCS-2","UTF-8"); + "UCS-2BE","UTF-8"); } else if (size>=3 && (uchar)inBuf.at(0)==0xEF && -- cgit v0.12 From d29c0e80865c70d1afceeef5e611aac8aa4f079f Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 24 Nov 2019 13:28:28 +0100 Subject: Cleanup scanner.l code and naming --- src/scanner.l | 5479 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 2723 insertions(+), 2756 deletions(-) diff --git a/src/scanner.l b/src/scanner.l index 2b277db..e0095ba 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -59,149 +59,137 @@ * statics */ static ParserInterface *g_thisParser; -static const char * inputString; -static int inputPosition; -static QFile inputFile; -static int lastContext; -static int lastCContext; -static int lastDocContext; -static int lastCPPContext; -static int lastSkipSharpContext; -static int lastSkipRoundContext; -static int lastStringContext; -static int lastCurlyContext; -static int lastRoundContext; -static int lastSquareContext; -static int lastInitializerContext; -static int lastClassTemplSpecContext; -static int lastPreLineCtrlContext; -static int lastSkipVerbStringContext; -static int lastCommentInArgContext; -static int lastRawStringContext; -static int lastCSConstraint; -static int lastHereDocContext; -static int lastDefineContext; -static int lastAlignAsContext; -static int lastC11AttributeContext; -static int lastModifierContext; -static Protection protection; -static Protection baseProt; -static int sharpCount = 0 ; -static int roundCount = 0 ; -static int curlyCount = 0 ; -static int squareCount = 0 ; -static int padCount = 0 ; -static std::unique_ptr current; -static Entry* current_root = 0 ; -static Entry* global_root = 0 ; -static Entry* previous = 0 ; -static std::unique_ptr tempEntry; -static Entry* firstTypedefEntry = 0 ; -static Entry* memspecEntry = 0 ; -static int yyLineNr = 1 ; -static int yyBegLineNr = yyLineNr ; -static int yyColNr = 1 ; -static int yyBegColNr = yyColNr ; -static int anonCount = 0 ; -static int anonNSCount = 0 ; -static QCString yyFileName; -static MethodTypes mtype; -static bool gstat; -static bool removeSlashes; -static Specifier virt; -static Specifier baseVirt; -static QCString msType,msName,msArgs; -static bool isTypedef; -static int tmpDocType; -static QCString sectionLabel; -static QCString sectionTitle; -static QCString funcPtrType; -static QCString templateStr; -static QCString aliasName; -static QCString baseName; -static QCString* specName; -static QCString formulaText; -static bool useOverrideCommands = FALSE; - -static SrcLangExt language; -static bool insideIDL = FALSE; //!< processing IDL code? -static bool insideJava = FALSE; //!< processing Java code? -static bool insideCS = FALSE; //!< processing C# code? -static bool insideD = FALSE; //!< processing D code? -static bool insidePHP = FALSE; //!< processing PHP code? -static bool insideObjC = FALSE; //!< processing Objective C code? -static bool insideCli = FALSE; //!< processing C++/CLI code? -static bool insideJS = FALSE; //!< processing JavaScript code? -static bool insideSlice = FALSE; //!< processing Slice code? -static bool insideCpp = TRUE; //!< processing C/C++ code - -static bool sliceOpt = FALSE; - -static bool insideCppQuote = FALSE; -static bool insideProtocolList = FALSE; - -static int argRoundCount; -static int argSharpCount; -static int currentArgumentContext; -static int lastCopyArgStringContext; -static int lastCopyArgContext; -static QCString *copyArgString; -static QCString fullArgString; -static QCString dummyRawString; - -static ArgumentList *currentArgumentList; -static char lastCopyArgChar; - -static QCString *pCopyQuotedString; -static QCString *pCopyRoundString; -static QCString *pCopyCurlyString; -static QCString *pCopyRawString; - -static QGString *pCopyCurlyGString; -static QGString *pCopyRoundGString; -static QGString *pCopySquareGString; -static QGString *pCopyQuotedGString; -static QGString *pCopyHereDocGString; -static QGString *pCopyRawGString; -static QGString *pSkipVerbString; -static QStack autoGroupStack; - -static bool insideFormula; -static bool insideTryBlock=FALSE; -static bool insideCode; -static bool needsSemi; - -//static int depthIf; -static int initBracketCount; - -static QCString oldStyleArgType; -static QCString docBackup; -static QCString briefBackup; - -static int docBlockContext; -static QGString docBlock; -static QCString docBlockName; -static bool docBlockInBody; -static bool docBlockAutoBrief; -static char docBlockTerm; - -static QCString idlAttr; -static QCString idlProp; -static bool odlProp; - -static bool g_lexInit = FALSE; -static bool externC; +static const char * g_inputString = 0; +static int g_inputPosition = 0; +static int g_lastContext = 0; +static int g_lastCContext = 0; +static int g_lastDocContext = 0; +static int g_lastCPPContext = 0; +static int g_lastSkipSharpContext = 0; +static int g_lastSkipRoundContext = 0; +static int g_lastStringContext = 0; +static int g_lastCurlyContext = 0; +static int g_lastRoundContext = 0; +static int g_lastSquareContext = 0; +static int g_lastInitializerContext = 0; +static int g_lastClassTemplSpecContext = 0; +static int g_lastPreLineCtrlContext = 0; +static int g_lastSkipVerbStringContext = 0; +static int g_lastCommentInArgContext = 0; +static int g_lastRawStringContext = 0; +static int g_lastCSConstraint = 0; +static int g_lastHereDocContext = 0; +static int g_lastDefineContext = 0; +static int g_lastAlignAsContext = 0; +static int g_lastC11AttributeContext = 0; +static int g_lastModifierContext = 0; +static Protection g_protection = Public; +static Protection g_baseProt = Public; +static int g_sharpCount = 0 ; +static int g_roundCount = 0 ; +static int g_curlyCount = 0 ; +static int g_squareCount = 0 ; +static int g_padCount = 0 ; +static std::unique_ptr g_current; +static Entry* g_current_root = 0 ; +static Entry* g_previous = 0 ; +static std::unique_ptr g_tempEntry; +static Entry* g_firstTypedefEntry = 0 ; +static Entry* g_memspecEntry = 0 ; +static int g_yyLineNr = 1 ; +static int g_yyBegLineNr = 1 ; +static int g_yyColNr = 1 ; +static int g_yyBegColNr = 1 ; +static int g_anonCount = 0 ; +static int g_anonNSCount = 0 ; +static QCString g_yyFileName; +static MethodTypes g_mtype = Method; +static bool g_stat = false; +static Specifier g_virt = Normal; +static Specifier g_baseVirt = Normal; +static QCString g_msType; +static QCString g_msName; +static QCString g_msArgs; +static bool g_isTypedef = false; +static QCString g_funcPtrType; +static QCString g_templateStr; +static QCString g_aliasName; +static QCString g_baseName; +static QCString* g_specName = 0; + +static SrcLangExt g_language = SrcLangExt_Unknown; +static bool g_insideIDL = false; //!< processing IDL code? +static bool g_insideJava = false; //!< processing Java code? +static bool g_insideCS = false; //!< processing C# code? +static bool g_insideD = false; //!< processing D code? +static bool g_insidePHP = false; //!< processing PHP code? +static bool g_insideObjC = false; //!< processing Objective C code? +static bool g_insideCli = false; //!< processing C++/CLI code? +static bool g_insideJS = false; //!< processing JavaScript code? +static bool g_insideSlice = false; //!< processing Slice code? +static bool g_insideCpp = true; //!< processing C/C++ code + +static bool g_insideCppQuote = false; +static bool g_insideProtocolList = false; + +static int g_argRoundCount = 0; +static int g_argSharpCount = 0; +static int g_currentArgumentContext = 0; +static int g_lastCopyArgStringContext = 0; +static int g_lastCopyArgContext = 0; +static QCString *g_copyArgString = 0; +static QCString g_fullArgString; +static QCString g_dummyRawString; + +static ArgumentList *g_currentArgumentList = 0; +static char g_lastCopyArgChar = '\0'; + +static QCString *g_pCopyQuotedString = 0; +static QCString *g_pCopyRoundString = 0; +static QCString *g_pCopyCurlyString = 0; +static QCString *g_pCopyRawString = 0; +static QGString *g_pCopyCurlyGString = 0; +static QGString *g_pCopyRoundGString = 0; +static QGString *g_pCopySquareGString = 0; +static QGString *g_pCopyQuotedGString = 0; +static QGString *g_pCopyHereDocGString = 0; +static QGString *g_pCopyRawGString = 0; +static QGString *g_pSkipVerbString = 0; +static QStack g_autoGroupStack; + +static bool g_insideFormula = false; +static bool g_insideTryBlock = false; +static bool g_insideCode = false; +static bool g_needsSemi = false; + +static int g_initBracketCount = 0; + +static QCString g_oldStyleArgType; +static QCString g_docBackup; +static QCString g_briefBackup; + +static int g_docBlockContext = 0; +static QGString g_docBlock; +static QCString g_docBlockName; +static bool g_docBlockInBody = false; +static bool g_docBlockAutoBrief = false; +static char g_docBlockTerm = '\0'; + +static QCString g_idlAttr; +static QCString g_idlProp; +static bool g_odlProp = false; + +static bool g_lexInit = false; +static bool g_externC = false; static QCString g_delimiter; -static int g_column; - -static int g_fencedSize=0; -static bool g_nestedComment=0; +static int g_column = 0; +static int g_fencedSize = 0; +static bool g_nestedComment = 0; static std::vector< std::pair > > g_outerScopeEntries; - -static CodeScanner g_codeScanner; +static CodeScanner g_codeScanner; static const char *stateToString(int state); //----------------------------------------------------------------------------- @@ -215,46 +203,42 @@ static const char *stateToString(int state); static void initParser() { g_outerScopeEntries.clear(); - sectionLabel.resize(0); - sectionTitle.resize(0); - baseName.resize(0); - formulaText.resize(0); - protection = Public; - baseProt = Public; - sharpCount = 0; - roundCount = 0; - curlyCount = 0; - mtype = Method; - gstat = FALSE; - virt = Normal; - baseVirt = Normal; - isTypedef = FALSE; - autoGroupStack.clear(); - insideTryBlock = FALSE; - autoGroupStack.setAutoDelete(TRUE); - insideFormula = FALSE; - insideCode=FALSE; - insideCli=Config_getBool(CPP_CLI_SUPPORT); - sliceOpt=Config_getBool(OPTIMIZE_OUTPUT_SLICE); - previous = 0; - firstTypedefEntry = 0; - memspecEntry =0; + g_baseName.resize(0); + g_protection = Public; + g_baseProt = Public; + g_sharpCount = 0; + g_roundCount = 0; + g_curlyCount = 0; + g_mtype = Method; + g_stat = FALSE; + g_virt = Normal; + g_baseVirt = Normal; + g_isTypedef = FALSE; + g_autoGroupStack.clear(); + g_insideTryBlock = FALSE; + g_autoGroupStack.setAutoDelete(TRUE); + g_insideFormula = FALSE; + g_insideCode=FALSE; + g_insideCli=Config_getBool(CPP_CLI_SUPPORT); + g_previous = 0; + g_firstTypedefEntry = 0; + g_memspecEntry =0; } static void initEntry() { - if (insideJava) + if (g_insideJava) { - protection = (current_root->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; + g_protection = (g_current_root->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; } - current->protection = protection ; - current->mtype = mtype; - current->virt = virt; - current->stat = gstat; - current->lang = language; - //printf("*** initEntry() language=%d\n",language); - Doxygen::docGroup.initGroupInfo(current.get()); - isTypedef=FALSE; + g_current->protection = g_protection ; + g_current->mtype = g_mtype; + g_current->virt = g_virt; + g_current->stat = g_stat; + g_current->lang = g_language; + //printf("*** initEntry() g_language=%d\n",g_language); + Doxygen::docGroup.initGroupInfo(g_current.get()); + g_isTypedef=FALSE; } @@ -268,7 +252,7 @@ static void lineCount() { if (*p=='\n') { - yyLineNr++,g_column=0,yyColNr=1; + g_yyLineNr++,g_column=0,g_yyColNr=1; } else if (*p=='\t') { @@ -276,7 +260,7 @@ static void lineCount() } else { - g_column++,yyColNr++; + g_column++,g_yyColNr++; } } //printf("lineCount()=%d\n",g_column); @@ -299,21 +283,21 @@ static inline int computeIndent(const char *s,int startIndent) static void addType() { - uint tl=current->type.length(); - if( tl>0 && !current->name.isEmpty() && current->type.at(tl-1)!='.') + uint tl=g_current->type.length(); + if( tl>0 && !g_current->name.isEmpty() && g_current->type.at(tl-1)!='.') { - current->type += ' ' ; + g_current->type += ' ' ; } - current->type += current->name ; - current->name.resize(0) ; - tl=current->type.length(); - if( tl>0 && !current->args.isEmpty() && current->type.at(tl-1)!='.') + g_current->type += g_current->name ; + g_current->name.resize(0) ; + tl=g_current->type.length(); + if( tl>0 && !g_current->args.isEmpty() && g_current->type.at(tl-1)!='.') { - current->type += ' ' ; + g_current->type += ' ' ; } - current->type += current->args ; - current->args.resize(0) ; - current->argList.clear(); + g_current->type += g_current->args ; + g_current->args.resize(0) ; + g_current->argList.clear(); } @@ -350,24 +334,19 @@ static bool nameIsOperator(QCString &name) static void setContext() { - QCString fileName = yyFileName; - language = getLanguageFromFileName(fileName); - insideIDL = language==SrcLangExt_IDL; - insideJava = language==SrcLangExt_Java; - insideCS = language==SrcLangExt_CSharp; - insideD = language==SrcLangExt_D; - insidePHP = language==SrcLangExt_PHP; - insideObjC = language==SrcLangExt_ObjC; - insideJS = language==SrcLangExt_JS; - insideSlice = language==SrcLangExt_Slice; - insideCpp = language==SrcLangExt_Cpp; - if ( insidePHP ) - { - useOverrideCommands = TRUE; - } - //printf("setContext(%s) insideIDL=%d insideJava=%d insideCS=%d " - // "insideD=%d insidePHP=%d insideObjC=%d\n", - // yyFileName.data(),insideIDL,insideJava,insideCS,insideD,insidePHP,insideObjC + g_language = getLanguageFromFileName(g_yyFileName); + g_insideIDL = g_language==SrcLangExt_IDL; + g_insideJava = g_language==SrcLangExt_Java; + g_insideCS = g_language==SrcLangExt_CSharp; + g_insideD = g_language==SrcLangExt_D; + g_insidePHP = g_language==SrcLangExt_PHP; + g_insideObjC = g_language==SrcLangExt_ObjC; + g_insideJS = g_language==SrcLangExt_JS; + g_insideSlice = g_language==SrcLangExt_Slice; + g_insideCpp = g_language==SrcLangExt_Cpp; + //printf("setContext(%s) g_insideIDL=%d g_insideJava=%d g_insideCS=%d " + // "g_insideD=%d g_insidePHP=%d g_insideObjC=%d\n", + // g_yyFileName.data(),g_insideIDL,g_insideJava,g_insideCS,g_insideD,g_insidePHP,g_insideObjC // ); } @@ -375,26 +354,26 @@ static void setContext() static void prependScope() { - if (current_root->section & Entry::SCOPE_MASK) + if (g_current_root->section & Entry::SCOPE_MASK) { - //printf("--- prependScope %s to %s\n",current_root->name.data(),current->name.data()); - current->name.prepend(current_root->name+"::"); - //printf("prependScope #=%d #current=%d\n",current_root->tArgLists->count(),current->tArgLists->count()); - for (const ArgumentList &srcAl : current_root->tArgLists) + //printf("--- prependScope %s to %s\n",g_current_root->name.data(),g_current->name.data()); + g_current->name.prepend(g_current_root->name+"::"); + //printf("prependScope #=%d #g_current=%d\n",g_current_root->tArgLists->count(),g_current->tArgLists->count()); + for (const ArgumentList &srcAl : g_current_root->tArgLists) { - current->tArgLists.insert(current->tArgLists.begin(),srcAl); + g_current->tArgLists.insert(g_current->tArgLists.begin(),srcAl); } } } //----------------------------------------------------------------------------- -/*! Returns TRUE iff the current entry could be a K&R style C function */ +/*! Returns TRUE iff the g_current entry could be a K&R style C function */ static bool checkForKnRstyleC() { - if (((QCString)yyFileName).right(2).lower()!=".c") return FALSE; // must be a C file - if (current->argList.empty()) return FALSE; // must have arguments - for (const Argument &a : current->argList) + if (((QCString)g_yyFileName).right(2).lower()!=".c") return FALSE; // must be a C file + if (g_current->argList.empty()) return FALSE; // must have arguments + for (const Argument &a : g_current->argList) { // in K&R style argument do not have a type, but doxygen expects a type // so it will think the argument has no name @@ -407,56 +386,56 @@ static bool checkForKnRstyleC() static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName) { - int si = current->args.length(); - if (oldStyleArgType.isEmpty()) // new argument + int si = g_current->args.length(); + if (g_oldStyleArgType.isEmpty()) // new argument { static QRegExp re("([^)]*)"); - int bi1 = current->args.findRev(re); - int bi2 = bi1!=-1 ? current->args.findRev(re,bi1-1) : -1; + int bi1 = g_current->args.findRev(re); + int bi2 = bi1!=-1 ? g_current->args.findRev(re,bi1-1) : -1; char c; if (bi1!=-1 && bi2!=-1) // found something like "int (*func)(int arg)" { int s=bi2+1; - oldStyleArgType = current->args.left(s); + g_oldStyleArgType = g_current->args.left(s); int i=s; - while (iargs.at(i))=='*' || isspace((uchar)c))) i++; - oldStyleArgType += current->args.mid(s,i-s); + while (iargs.at(i))=='*' || isspace((uchar)c))) i++; + g_oldStyleArgType += g_current->args.mid(s,i-s); s=i; - while (iargs.at(i))) i++; - oldStyleArgName = current->args.mid(s,i-s); - oldStyleArgType+=current->args.mid(i); + while (iargs.at(i))) i++; + oldStyleArgName = g_current->args.mid(s,i-s); + g_oldStyleArgType+=g_current->args.mid(i); } else if (bi1!=-1) // redundant braces like in "int (*var)" { int s=bi1; - oldStyleArgType = current->args.left(s); + g_oldStyleArgType = g_current->args.left(s); s++; int i=s+1; - while (iargs.at(i))=='*' || isspace((uchar)c))) i++; - oldStyleArgType += current->args.mid(s,i-s); + while (iargs.at(i))=='*' || isspace((uchar)c))) i++; + g_oldStyleArgType += g_current->args.mid(s,i-s); s=i; - while (iargs.at(i))) i++; - oldStyleArgName = current->args.mid(s,i-s); + while (iargs.at(i))) i++; + oldStyleArgName = g_current->args.mid(s,i-s); } 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(current->args.at(i))) i--; + while (i>=0 && isId(g_current->args.at(i))) i--; j=i+1; // look for start of *'s - while (i>=0 && ((c=current->args.at(i))=='*' || isspace((uchar)c))) i--; + while (i>=0 && ((c=g_current->args.at(i))=='*' || isspace((uchar)c))) i--; i++; if (i!=l) { - oldStyleArgType=current->args.left(i); - oldStyleArgPtr=current->args.mid(i,j-i); - oldStyleArgName=current->args.mid(j).stripWhiteSpace(); + g_oldStyleArgType=g_current->args.left(i); + oldStyleArgPtr=g_current->args.mid(i,j-i); + oldStyleArgName=g_current->args.mid(j).stripWhiteSpace(); } else { - oldStyleArgName=current->args.copy().stripWhiteSpace(); + oldStyleArgName=g_current->args.copy().stripWhiteSpace(); } } } @@ -464,15 +443,15 @@ static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName) { int l=si,j=0; char c; - while (jargs.at(j))=='*' || isspace((uchar)c))) j++; + while (jargs.at(j))=='*' || isspace((uchar)c))) j++; if (j>0) { - oldStyleArgPtr=current->args.left(j); - oldStyleArgName=current->args.mid(j).stripWhiteSpace(); + oldStyleArgPtr=g_current->args.left(j); + oldStyleArgName=g_current->args.mid(j).stripWhiteSpace(); } else { - oldStyleArgName=current->args.copy().stripWhiteSpace(); + oldStyleArgName=g_current->args.copy().stripWhiteSpace(); } } } @@ -486,7 +465,7 @@ static void splitKnRArg(QCString &oldStyleArgPtr,QCString &oldStyleArgName) static void addKnRArgInfo(const QCString &type,const QCString &name, const QCString &brief,const QCString &docs) { - for (Argument &a : current->argList) + for (Argument &a : g_current->argList) { if (a.type==name) { @@ -534,9 +513,9 @@ void fixArgumentListForJavaScript(ArgumentList &al) static int yyread(char *buf,int max_size) { int c=0; - while( c < max_size && inputString[inputPosition] ) + while( c < max_size && g_inputString[g_inputPosition] ) { - *buf = inputString[inputPosition++] ; + *buf = g_inputString[g_inputPosition++] ; //printf("%d (%c)\n",*buf,*buf); c++; buf++; } @@ -738,32 +717,32 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %% "{" { - curlyCount=0; - needsSemi = TRUE; + g_curlyCount=0; + g_needsSemi = TRUE; BEGIN(SkipCurlyBlock); } "(" { - roundCount=0; + g_roundCount=0; BEGIN(SkipRoundBlock); } "(" { - ++roundCount; + ++g_roundCount; } ")" { - if (roundCount ) - --roundCount ; + if (g_roundCount ) + --g_roundCount ; else BEGIN( NextSemi ) ; } "{" { - ++curlyCount ; + ++g_curlyCount ; } "}" { - if( curlyCount ) + if( g_curlyCount ) { - --curlyCount ; + --g_curlyCount ; } - else if (needsSemi) + else if (g_needsSemi) { BEGIN( NextSemi ); } @@ -773,15 +752,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } \' { - if (insidePHP) + if (g_insidePHP) { - lastStringContext=NextSemi; + g_lastStringContext=NextSemi; BEGIN(SkipPHPString); } } -{CHARLIT} { if (insidePHP) REJECT; } +{CHARLIT} { if (g_insidePHP) REJECT; } \" { - lastStringContext=NextSemi; + g_lastStringContext=NextSemi; BEGIN(SkipString); } [;,] { @@ -793,12 +772,12 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } [{;,] { - current->args = current->args.simplifyWhiteSpace(); + g_current->args = g_current->args.simplifyWhiteSpace(); unput(*yytext); BEGIN( ClassVar ); } """?>"|"" { // PHP code end - if (insidePHP) + if (g_insidePHP) BEGIN( FindMembersPHP ); else REJECT; @@ -820,95 +799,95 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } . { // Non-PHP code text, ignore } -{PHPKW} { if (insidePHP) +{PHPKW} { if (g_insidePHP) BEGIN( NextSemi ); else REJECT; } "%{"[^\n]* { // Mozilla XPIDL lang-specific block - if (!insideIDL) + if (!g_insideIDL) REJECT; } "%}" { // Mozilla XPIDL lang-specific block end - if (!insideIDL) + if (!g_insideIDL) REJECT; } {B}*("properties"){BN}*":"{BN}* { // IDL or Borland C++ builder property - current->mtype = mtype = Property; - current->protection = protection = Public ; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->mtype = g_mtype = Property; + g_current->protection = g_protection = Public ; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } -{B}*"k_dcop"{BN}*":"{BN}* { current->mtype = mtype = DCOP; - current->protection = protection = Public ; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); +{B}*"k_dcop"{BN}*":"{BN}* { g_current->mtype = g_mtype = DCOP; + g_current->protection = g_protection = Public ; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } -{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { current->mtype = mtype = Signal; +{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { g_current->mtype = g_mtype = Signal; - current->protection = protection = Public ; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - current->protection = protection = Public ; - current->mtype = mtype = Slot; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->mtype = g_mtype = Slot; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount(); } {B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - current->protection = protection = Protected ; - current->mtype = mtype = Slot; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Protected ; + g_current->mtype = g_mtype = Slot; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount(); } {B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* { - current->protection = protection = Private ; - current->mtype = mtype = Slot; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Private ; + g_current->mtype = g_mtype = Slot; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount(); } {B}*("public"|"methods"|"__published"){BN}*":"{BN}* { - current->protection = protection = Public ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"internal"{BN}*":"{BN}* { // for now treat C++/CLI's internal as package... - if (insideCli) - { - current->protection = protection = Package ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + if (g_insideCli) + { + g_current->protection = g_protection = Package ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } else @@ -917,38 +896,38 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"protected"{BN}*":"{BN}* { - current->protection = protection = Protected ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Protected ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"private"{BN}*":"{BN}* { - current->protection = protection = Private ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Private ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"event"{BN}+ { - if (insideCli) + if (g_insideCli) { // C++/CLI event lineCount() ; - current->mtype = mtype = Event; - current->bodyLine = yyLineNr; - curlyCount=0; + g_current->mtype = g_mtype = Event; + g_current->bodyLine = g_yyLineNr; + g_curlyCount=0; BEGIN( CliPropertyType ); } - else if (insideCS) + else if (g_insideCS) { lineCount() ; - current->mtype = Event; - current->bodyLine = yyLineNr; + g_current->mtype = Event; + g_current->bodyLine = g_yyLineNr; } else { @@ -956,13 +935,13 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"property"{BN}+ { - if (insideCli) + if (g_insideCli) { // C++/CLI property lineCount() ; - current->mtype = mtype = Property; - current->bodyLine = yyLineNr; - curlyCount=0; + g_current->mtype = g_mtype = Property; + g_current->bodyLine = g_yyLineNr; + g_curlyCount=0; BEGIN( CliPropertyType ); } else @@ -972,15 +951,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {ID} { addType(); - current->name = yytext; + g_current->name = yytext; } "[" { // C++/CLI indexed property - current->args = "["; + g_current->args = "["; BEGIN( CliPropertyIndex ); } "{" { - curlyCount=0; - //printf("event: '%s' '%s'\n",current->type.data(),current->name.data()); + g_curlyCount=0; + //printf("event: '%s' '%s'\n",g_current->type.data(),g_current->name.data()); BEGIN( CSAccessorDecl ); } ";" { @@ -994,78 +973,78 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } . { addType(); - current->type += yytext; + g_current->type += yytext; } "]" { BEGIN( CliPropertyType ); - current->args+=yytext; + g_current->args+=yytext; } . { - current->args+=yytext; + g_current->args+=yytext; } /* {B}*"property"{BN}+ { - if (!current->type.isEmpty()) + if (!g_current->type.isEmpty()) { REJECT; } else { - current->mtype = mtype = Property; + g_current->mtype = g_mtype = Property; lineCount(); } } */ {B}*"@private"{BN}+ { - current->protection = protection = Private ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Private ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"@protected"{BN}+ { - current->protection = protection = Protected ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Protected ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } {B}*"@public"{BN}+ { - current->protection = protection = Public ; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->protection = g_protection = Public ; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); lineCount() ; } [\-+]{BN}* { - if (!insideObjC) + if (!g_insideObjC) { REJECT; } else { lineCount(); - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; - current->section = Entry::FUNCTION_SEC; - current->protection = protection = Public ; - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; - current->virt = Virtual; - current->stat=yytext[0]=='+'; - current->mtype = mtype = Method; - current->type.resize(0); - current->name.resize(0); - current->args.resize(0); - current->argList.clear(); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; + g_current->section = Entry::FUNCTION_SEC; + g_current->protection = g_protection = Public ; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; + g_current->virt = Virtual; + g_current->stat=yytext[0]=='+'; + g_current->mtype = g_mtype = Method; + g_current->type.resize(0); + g_current->name.resize(0); + g_current->args.resize(0); + g_current->argList.clear(); BEGIN( ObjCMethod ); } } @@ -1073,24 +1052,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( ObjCReturnType ); } {ID} { // found method name - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type = "id"; + g_current->type = "id"; } - current->name = yytext; - if (insideCpp || insideObjC) + g_current->name = yytext; + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } } ":"{B}* { // start of parameter list - current->name += ':'; + g_current->name += ':'; Argument a; - current->argList.push_back(a); + g_current->argList.push_back(a); BEGIN( ObjCParams ); } [^)]* { // TODO: check if nested braches are possible. - current->type = yytext; + g_current->type = yytext; } ")" { BEGIN( ObjCMethod ); @@ -1100,119 +1079,119 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) keyw=keyw.left(keyw.length()-1).stripWhiteSpace(); // strip : if (keyw.isEmpty()) { - current->name += " :"; + g_current->name += " :"; } else { - current->name += keyw+":"; + g_current->name += keyw+":"; } - if (current->argList.back().type.isEmpty()) + if (g_current->argList.back().type.isEmpty()) { - current->argList.back().type="id"; + g_current->argList.back().type="id"; } Argument a; a.attrib=(QCString)"["+keyw+"]"; - current->argList.push_back(a); + g_current->argList.push_back(a); } {ID}{BN}* { // name of parameter lineCount(); - current->argList.back().name=QCString(yytext).stripWhiteSpace(); + g_current->argList.back().name=QCString(yytext).stripWhiteSpace(); } ","{BN}*"..." { // name of parameter lineCount(); // do we want the comma as part of the name? - //current->name += ","; + //g_current->name += ","; Argument a; a.attrib="[,]"; a.type="..."; - current->argList.push_back(a); + g_current->argList.push_back(a); } /* ":" { - current->name += ':'; + g_current->name += ':'; } */ "(" { - roundCount=0; - current->argList.back().type.resize(0); + g_roundCount=0; + g_current->argList.back().type.resize(0); BEGIN( ObjCParamType ); } "(" { - roundCount++; - current->argList.back().type+=yytext; + g_roundCount++; + g_current->argList.back().type+=yytext; } ")"/{B}* { - if (roundCount<=0) + if (g_roundCount<=0) { BEGIN( ObjCParams ); } else { - current->argList.back().type+=yytext; - roundCount--; + g_current->argList.back().type+=yytext; + g_roundCount--; } } [^()]* { - current->argList.back().type+=QCString(yytext).stripWhiteSpace(); + g_current->argList.back().type+=QCString(yytext).stripWhiteSpace(); } ";" { // end of method declaration - if (!current->argList.empty() && current->argList.back().type.isEmpty()) + if (!g_current->argList.empty() && g_current->argList.back().type.isEmpty()) { - current->argList.back().type="id"; + g_current->argList.back().type="id"; } - if (current->argList.empty()) // method without parameters + if (g_current->argList.empty()) // method without parameters { - current->argList.noParameters = TRUE; + g_current->argList.noParameters = TRUE; } - current->args = argListToString(current->argList); - //printf("argList=%s\n",current->args.data()); + g_current->args = argListToString(g_current->argList); + //printf("argList=%s\n",g_current->args.data()); unput(';'); BEGIN( Function ); } (";"{BN}+)?"{" { // start of a method body lineCount(); //printf("Type=%s Name=%s args=%s\n", - // current->type.data(),current->name.data(),argListToString(current->argList).data() + // g_current->type.data(),g_current->name.data(),argListToString(g_current->argList).data() // ); - if (!current->argList.empty() && current->argList.back().type.isEmpty()) + if (!g_current->argList.empty() && g_current->argList.back().type.isEmpty()) { - current->argList.back().type="id"; + g_current->argList.back().type="id"; } - if (current->argList.empty()) // method without parameters + if (g_current->argList.empty()) // method without parameters { - current->argList.noParameters = TRUE; + g_current->argList.noParameters = TRUE; } - current->args = argListToString(current->argList); + g_current->args = argListToString(g_current->argList); unput('{'); BEGIN( Function ); } {B}*"sequence"{BN}*"<"{BN}* { - if (insideSlice) + if (g_insideSlice) { lineCount(); - current->bodyLine = yyLineNr; - current->fileName = yyFileName ; - current->startLine = yyLineNr ; - current->startColumn = yyColNr; - current->args.resize(0); - current->section = Entry::TYPEDEF_SEC ; - isTypedef = TRUE; + g_current->bodyLine = g_yyLineNr; + g_current->fileName = g_yyFileName ; + g_current->startLine = g_yyLineNr ; + g_current->startColumn = g_yyColNr; + g_current->args.resize(0); + g_current->section = Entry::TYPEDEF_SEC ; + g_isTypedef = TRUE; BEGIN( SliceSequence ); } else REJECT; } {B}*"dictionary"{BN}*"<"{BN}* { - if (insideSlice) + if (g_insideSlice) { lineCount(); - current->bodyLine = yyLineNr; - current->fileName = yyFileName ; - current->startLine = yyLineNr ; - current->startColumn = yyColNr; - current->args.resize(0); - current->section = Entry::TYPEDEF_SEC ; - isTypedef = TRUE; + g_current->bodyLine = g_yyLineNr; + g_current->fileName = g_yyFileName ; + g_current->startLine = g_yyLineNr ; + g_current->startColumn = g_yyColNr; + g_current->args.resize(0); + g_current->section = Entry::TYPEDEF_SEC ; + g_isTypedef = TRUE; BEGIN( SliceDictionary ); } else @@ -1222,18 +1201,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(); } "@"({ID}".")*{ID}{BN}*"(" { - if (insideJava) // Java annotation + if (g_insideJava) // Java annotation { lineCount(); - lastSkipRoundContext = YY_START; - roundCount=0; + g_lastSkipRoundContext = YY_START; + g_roundCount=0; BEGIN( SkipRound ); } else if (qstrncmp(yytext,"@property",9)==0) // ObjC 2.0 property { - current->mtype = mtype = Property; - current->spec|=Entry::Readable | Entry::Writable | Entry::Assign; - current->protection = Public ; + g_current->mtype = g_mtype = Property; + g_current->spec|=Entry::Readable | Entry::Writable | Entry::Assign; + g_current->protection = Public ; unput('('); BEGIN( ObjCPropAttr ); } @@ -1243,54 +1222,54 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } "getter="{ID} { - current->read = yytext+7; + g_current->read = yytext+7; } "setter="{ID} { - current->write = yytext+7; + g_current->write = yytext+7; } "readonly" { - current->spec&=~Entry::Writable; + g_current->spec&=~Entry::Writable; } "readwrite" { // default } "assign" { // default } "unsafe_unretained" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Unretained; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Unretained; } "retain" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Retain; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Retain; } "copy" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Copy; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Copy; } "weak" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Weak; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Weak; } "strong" { - current->spec&=~Entry::Assign; - current->spec|=Entry::Strong; + g_current->spec&=~Entry::Assign; + g_current->spec|=Entry::Strong; } "nonatomic" { - current->spec|=Entry::NonAtomic; + g_current->spec|=Entry::NonAtomic; } ")" { BEGIN(FindMembers); } "@"{ID} { - if (insideJava) // Java annotation + if (g_insideJava) // Java annotation { // skip annotation } else if (qstrcmp(yytext,"@property")==0) // ObjC 2.0 property { - current->mtype = mtype = Property; - current->spec|=Entry::Writable | Entry::Readable; - current->protection = Public ; + g_current->mtype = g_mtype = Property; + g_current->spec|=Entry::Writable | Entry::Readable; + g_current->protection = Public ; } else if (qstrcmp(yytext,"@synthesize")==0) { @@ -1309,57 +1288,57 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } {ID}(("."|"\\"){ID})* { - isTypedef=FALSE; - //printf("Found namespace %s lang=%d\n",yytext,current->lang); - current->name = yytext; - current->name = substitute(current->name,".","::"); - current->name = substitute(current->name,"\\","::"); - current->section = Entry::NAMESPACE_SEC; - current->type = "namespace" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_isTypedef=FALSE; + //printf("Found namespace %s lang=%d\n",yytext,g_current->lang); + g_current->name = yytext; + g_current->name = substitute(g_current->name,".","::"); + g_current->name = substitute(g_current->name,"\\","::"); + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "namespace" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount(); } ";" { - Entry *tmp = current.get(); - current_root->moveToSubEntryAndRefresh(current); - current_root = tmp; + Entry *tmp = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); + g_current_root = tmp; initEntry(); BEGIN(FindMembers); } "{" { - curlyCount=0; + g_curlyCount=0; BEGIN( ReadNSBody ); } {B}*"initonly"{BN}+ { - current->type += " initonly "; - if (insideCli) current->spec |= Entry::Initonly; + g_current->type += " initonly "; + if (g_insideCli) g_current->spec |= Entry::Initonly; lineCount(); } -{B}*"static"{BN}+ { current->type += " static "; - current->stat = TRUE; +{B}*"static"{BN}+ { g_current->type += " static "; + g_current->stat = TRUE; lineCount(); } {B}*"extern"{BN}+ { - current->stat = FALSE; - current->explicitExternal = TRUE; + g_current->stat = FALSE; + g_current->explicitExternal = TRUE; lineCount(); } -{B}*"const"{BN}+ { current->type += " const "; - if (insideCS) current->stat = TRUE; +{B}*"const"{BN}+ { g_current->type += " const "; + if (g_insideCS) g_current->stat = TRUE; lineCount(); } -{B}*"virtual"{BN}+ { current->type += " virtual "; - current->virt = Virtual; +{B}*"virtual"{BN}+ { g_current->type += " virtual "; + g_current->virt = Virtual; lineCount(); } {B}*"constexpr"{BN}+ { - if (insideCpp) + if (g_insideCpp) { - current->type += " constexpr "; - current->spec |= Entry::ConstExpr; + g_current->type += " constexpr "; + g_current->spec |= Entry::ConstExpr; lineCount(); } else @@ -1368,10 +1347,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"published"{BN}+ { // UNO IDL published keyword - if (insideIDL) + if (g_insideIDL) { lineCount(); - current->spec |= Entry::Published; + g_current->spec |= Entry::Published; } else { @@ -1379,42 +1358,42 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {B}*"abstract"{BN}+ { - if (!insidePHP) + if (!g_insidePHP) { - current->type += " abstract "; - if (!insideJava) + g_current->type += " abstract "; + if (!g_insideJava) { - current->virt = Pure; + g_current->virt = Pure; } else { - current->spec|=Entry::Abstract; + g_current->spec|=Entry::Abstract; } } else { - current->spec|=Entry::Abstract; + g_current->spec|=Entry::Abstract; } lineCount(); } -{B}*"inline"{BN}+ { current->spec|=Entry::Inline; +{B}*"inline"{BN}+ { g_current->spec|=Entry::Inline; lineCount(); } -{B}*"mutable"{BN}+ { current->spec|=Entry::Mutable; +{B}*"mutable"{BN}+ { g_current->spec|=Entry::Mutable; lineCount(); } -{B}*"explicit"{BN}+ { current->spec|=Entry::Explicit; +{B}*"explicit"{BN}+ { g_current->spec|=Entry::Explicit; lineCount(); } -{B}*"local"{BN}+ { current->spec|=Entry::Local; +{B}*"local"{BN}+ { g_current->spec|=Entry::Local; lineCount(); } {B}*"@required"{BN}+ { // Objective C 2.0 protocol required section - current->spec=(current->spec & ~Entry::Optional) | Entry::Required; + g_current->spec=(g_current->spec & ~Entry::Optional) | Entry::Required; lineCount(); } {B}*"@optional"{BN}+ { // Objective C 2.0 protocol optional section - current->spec=(current->spec & ~Entry::Required) | Entry::Optional; + g_current->spec=(g_current->spec & ~Entry::Required) | Entry::Optional; lineCount(); } /* @@ -1424,15 +1403,15 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) */ {B}*"typename"{BN}+ { lineCount(); } {B}*"namespace"{BN}*/[^a-z_A-Z0-9] { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "namespace" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "namespace" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount(); - if (insidePHP) + if (g_insidePHP) { BEGIN( PackageName ); } @@ -1443,18 +1422,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {B}*"module"{BN}+ { lineCount(); - if (insideIDL || insideSlice) - { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "module" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + if (g_insideIDL || g_insideSlice) + { + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "module" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } - else if (insideD) + else if (g_insideD) { lineCount(); BEGIN(PackageName); @@ -1462,175 +1441,175 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"library"{BN}+ { lineCount(); - if (insideIDL) - { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "library" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + if (g_insideIDL) + { + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "library" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"constants"{BN}+ { // UNO IDL constant group lineCount(); - if (insideIDL) - { - isTypedef=FALSE; - current->section = Entry::NAMESPACE_SEC; - current->type = "constants"; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + if (g_insideIDL) + { + g_isTypedef=FALSE; + g_current->section = Entry::NAMESPACE_SEC; + g_current->type = "constants"; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*("service"){BN}+ { // UNO IDL service lineCount(); - if (insideIDL) + if (g_insideIDL) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Service | + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Service | // preserve UNO IDL [optional] or published - (current->spec & (Entry::Optional|Entry::Published)); + (g_current->spec & (Entry::Optional|Entry::Published)); addType(); - current->type += " service " ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; + g_current->type += " service " ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*("singleton"){BN}+ { // UNO IDL singleton lineCount(); - if (insideIDL) + if (g_insideIDL) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Singleton | - (current->spec & Entry::Published); // preserve + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Singleton | + (g_current->spec & Entry::Published); // preserve addType(); - current->type += " singleton " ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; + g_current->type += " singleton " ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {BN}*((("disp")?"interface")|"valuetype"){BN}+ { // M$/Corba/UNO IDL/Java/Slice interface lineCount(); - if (insideIDL || insideJava || insideCS || insideD || insidePHP || insideSlice) + if (g_insideIDL || g_insideJava || g_insideCS || g_insideD || g_insidePHP || g_insideSlice) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Interface | + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Interface | // preserve UNO IDL [optional], published, Slice local - (current->spec & (Entry::Optional|Entry::Published|Entry::Local)); + (g_current->spec & (Entry::Optional|Entry::Published|Entry::Local)); addType(); - current->type += " interface" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } else { addType(); - current->name = QCString(yytext).stripWhiteSpace(); + g_current->name = QCString(yytext).stripWhiteSpace(); } } {B}*"@implementation"{BN}+ { // Objective-C class implementation lineCount(); - isTypedef=FALSE; - current->section = Entry::OBJCIMPL_SEC; - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; - current->protection = protection = Public ; + g_isTypedef=FALSE; + g_current->section = Entry::OBJCIMPL_SEC; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; + g_current->protection = g_protection = Public ; addType(); - current->type += " implementation" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->bodyLine = yyLineNr; + g_current->type += " implementation" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } {B}*"@interface"{BN}+ { // Objective-C class interface, or Java attribute lineCount(); - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Interface; - if (!insideJava) + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Interface; + if (!g_insideJava) { - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; } - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; addType(); - current->type += " interface" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } {B}*"@protocol"{BN}+ { // Objective-C protocol definition lineCount(); - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Protocol; - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; - current->protection = protection = Public ; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Protocol; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; + g_current->protection = g_protection = Public ; addType(); - current->type += " protocol" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " protocol" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; BEGIN( CompoundName ); } {B}*"exception"{BN}+ { // Corba IDL/Slice exception - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; // preserve UNO IDL, Slice local - current->spec = Entry::Exception | - (current->spec & Entry::Published) | - (current->spec & Entry::Local); + g_current->spec = Entry::Exception | + (g_current->spec & Entry::Published) | + (g_current->spec & Entry::Local); addType(); - current->type += " exception" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " exception" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount(); BEGIN( CompoundName ); } @@ -1638,38 +1617,38 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {B}*{TYPEDEFPREFIX}"class{" | {B}*{TYPEDEFPREFIX}"class"{BN}+ { QCString decl = yytext; - isTypedef=decl.find("typedef")!=-1; + g_isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - current->section = Entry::CLASS_SEC; + g_current->section = Entry::CLASS_SEC; addType(); - uint64 spec = current->spec; - if (insidePHP && current->spec&Entry::Abstract) + uint64 spec = g_current->spec; + if (g_insidePHP && g_current->spec&Entry::Abstract) { // convert Abstract to AbstractClass - current->spec=(current->spec&~Entry::Abstract)|Entry::AbstractClass; + g_current->spec=(g_current->spec&~Entry::Abstract)|Entry::AbstractClass; } - if (insideSlice && spec&Entry::Local) + if (g_insideSlice && spec&Entry::Local) { - current->spec|=Entry::Local; + g_current->spec|=Entry::Local; } if (isConst) { - current->type += " const"; + g_current->type += " const"; } else if (isVolatile) { - current->type += " volatile"; + g_current->type += " volatile"; } - current->type += " class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; if (yytext[0]=='@') { - language = current->lang = SrcLangExt_ObjC; - insideObjC = TRUE; + g_language = g_current->lang = SrcLangExt_ObjC; + g_insideObjC = TRUE; } lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); @@ -1677,145 +1656,145 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {B}*"value class{" | // C++/CLI extension {B}*"value class"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Value; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Value; addType(); - current->type += " value class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " value class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"ref class{" | // C++/CLI extension {B}*"ref class"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Ref; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Ref; addType(); - current->type += " ref class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " ref class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"interface class{" | // C++/CLI extension {B}*"interface class"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Interface; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Interface; addType(); - current->type += " interface class" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface class" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"coclass"{BN}+ { - if (insideIDL) + if (g_insideIDL) { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; addType(); - current->type += " coclass" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " coclass" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; BEGIN( CompoundName ) ; } else { addType(); - current->name = yytext; - current->name = current->name.stripWhiteSpace(); + g_current->name = yytext; + g_current->name = g_current->name.stripWhiteSpace(); lineCount(); } } {B}*{TYPEDEFPREFIX}"struct{" | {B}*{TYPEDEFPREFIX}"struct"/{BN}+ { QCString decl = yytext; - isTypedef=decl.find("typedef")!=-1; + g_isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - uint64 spec = current->spec; - current->section = Entry::CLASS_SEC ; + uint64 spec = g_current->spec; + g_current->section = Entry::CLASS_SEC ; // preserve UNO IDL & Inline attributes, Slice local - current->spec = Entry::Struct | - (current->spec & Entry::Published) | - (current->spec & Entry::Inline) | - (current->spec & Entry::Local); - // bug 582676: can be a struct nested in an interface so keep insideObjC state - //current->objc = insideObjC = FALSE; + g_current->spec = Entry::Struct | + (g_current->spec & Entry::Published) | + (g_current->spec & Entry::Inline) | + (g_current->spec & Entry::Local); + // bug 582676: can be a struct nested in an interface so keep g_insideObjC state + //g_current->objc = g_insideObjC = FALSE; addType(); if (isConst) { - current->type += " const"; + g_current->type += " const"; } else if (isVolatile) { - current->type += " volatile"; + g_current->type += " volatile"; } - current->type += " struct" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " struct" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"value struct{" | // C++/CLI extension {B}*"value struct"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Struct | Entry::Value; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Struct | Entry::Value; addType(); - current->type += " value struct" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " value struct" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"ref struct{" | // C++/CLI extension {B}*"ref struct"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Struct | Entry::Ref; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Struct | Entry::Ref; addType(); - current->type += " ref struct" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " ref struct" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } {B}*"interface struct{" | // C++/CLI extension {B}*"interface struct"{BN}+ { - isTypedef=FALSE; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Struct | Entry::Interface; + g_isTypedef=FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Struct | Entry::Interface; addType(); - current->type += " interface struct"; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " interface struct"; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1823,27 +1802,27 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {B}*{TYPEDEFPREFIX}"union{" | {B}*{TYPEDEFPREFIX}"union"{BN}+ { QCString decl=yytext; - isTypedef=decl.find("typedef")!=-1; + g_isTypedef=decl.find("typedef")!=-1; bool isConst=decl.find("const")!=-1; bool isVolatile=decl.find("volatile")!=-1; - current->section = Entry::CLASS_SEC; - current->spec = Entry::Union; - // bug 582676: can be a struct nested in an interface so keep insideObjC state - //current->objc = insideObjC = FALSE; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Union; + // bug 582676: can be a struct nested in an interface so keep g_insideObjC state + //g_current->objc = g_insideObjC = FALSE; addType(); if (isConst) { - current->type += " const"; + g_current->type += " const"; } else if (isVolatile) { - current->type += " volatile"; + g_current->type += " volatile"; } - current->type += " union" ; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->type += " union" ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1851,40 +1830,40 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?"{" | {B}*{TYPEDEFPREFIX}{IDLATTR}?"enum"({BN}+("class"|"struct"))?{BN}+ { // for IDL: typedef [something] enum QCString text=yytext; - isTypedef = text.find("typedef")!=-1; - bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1 || insideCS; - if (insideJava) + g_isTypedef = text.find("typedef")!=-1; + bool isStrongEnum = text.find("struct")!=-1 || text.find("class")!=-1 || g_insideCS; + if (g_insideJava) { - current->section = Entry::CLASS_SEC; - current->spec = Entry::Enum; + g_current->section = Entry::CLASS_SEC; + g_current->spec = Entry::Enum; } else { - current->section = Entry::ENUM_SEC ; + g_current->section = Entry::ENUM_SEC ; } addType(); - current->type += " enum"; + g_current->type += " enum"; if (isStrongEnum) { - current->spec |= Entry::Strong; + g_current->spec |= Entry::Strong; } - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->bodyLine = yyLineNr; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->bodyLine = g_yyLineNr; lineCount() ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; } "("{BN}*")"({BN}*"<"[^>]*">"){BN}*/"(" { // A::operator()(int arg) lineCount(); - current->name += "()"; + g_current->name += "()"; BEGIN( FindMembers ); } "("{BN}*")"{BN}*/"(" { lineCount(); - current->name += yytext ; - current->name = current->name.simplifyWhiteSpace(); + g_current->name += yytext ; + g_current->name = g_current->name.simplifyWhiteSpace(); BEGIN( FindMembers ) ; } ";" { // can occur when importing members @@ -1893,24 +1872,24 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } [^(] { lineCount(); - current->name += *yytext ; + g_current->name += *yytext ; } "<>" { /* skip guided templ specifiers */ } "(" { - current->name = current->name.simplifyWhiteSpace(); + g_current->name = g_current->name.simplifyWhiteSpace(); unput(*yytext); BEGIN( FindMembers ) ; } ("template"|"generic")({BN}*)"<"/[>]? { // generic is a C++/CLI extension lineCount(); ArgumentList al; - //current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template; - current->tArgLists.push_back(al); - currentArgumentList = ¤t->tArgLists.back(); - templateStr="<"; - fullArgString = templateStr; - copyArgString = &templateStr; - currentArgumentContext = FindMembers; + //g_current->spec |= (yytext[0]=='g') ? Entry::Generic : Entry::Template; + g_current->tArgLists.push_back(al); + g_currentArgumentList = &g_current->tArgLists.back(); + g_templateStr="<"; + g_fullArgString = g_templateStr; + g_copyArgString = &g_templateStr; + g_currentArgumentContext = FindMembers; BEGIN( ReadTempArgs ); } "namespace"{BN}+/{ID}{BN}*"=" { // namespace alias @@ -1918,21 +1897,21 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( NSAliasName ); } {ID} { - aliasName = yytext; + g_aliasName = yytext; BEGIN( NSAliasArg ); } ({ID}"::")*{ID} { - //printf("Inserting namespace alias %s::%s->%s\n",current_root->name.data(),aliasName.data(),yytext); - //if (current_root->name.isEmpty()) + //printf("Inserting namespace alias %s::%s->%s\n",g_current_root->name.data(),g_aliasName.data(),yytext); + //if (g_current_root->name.isEmpty()) //{ // TODO: namespace aliases are now treated as global entities // while they should be aware of the scope they are in - Doxygen::namespaceAliasDict.insert(aliasName,new QCString(yytext)); + Doxygen::namespaceAliasDict.insert(g_aliasName,new QCString(yytext)); //} //else //{ - // Doxygen::namespaceAliasDict.insert(current_root->name+"::"+aliasName, - // new QCString(current_root->name+"::"+yytext)); + // Doxygen::namespaceAliasDict.insert(g_current_root->name+"::"+g_aliasName, + // new QCString(g_current_root->name+"::"+yytext)); //} } ";" { @@ -1940,22 +1919,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ({ID}{BN}*"\\"{BN}*)*{ID}/{BN}+"as" { lineCount(); - aliasName=yytext; + g_aliasName=yytext; BEGIN(PHPUseAs); } ({ID}{BN}*"\\"{BN}*)*{ID} { lineCount(); - current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); - //printf("PHP: adding use relation: %s\n",current->name.data()); - current->fileName = yyFileName; + g_current->name=removeRedundantWhiteSpace(substitute(yytext,"\\","::")); + //printf("PHP: adding use relation: %s\n",g_current->name.data()); + g_current->fileName = g_yyFileName; // add a using declaration - current->section=Entry::USINGDECL_SEC; - current_root->copyToSubEntry(current); + g_current->section=Entry::USINGDECL_SEC; + g_current_root->copyToSubEntry(g_current); // also add it as a using directive - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); - aliasName.resize(0); + g_aliasName.resize(0); } {BN}+"as"{BN}+ { lineCount(); @@ -1963,14 +1942,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {PHPUSEKW} { } {ID} { - //printf("PHP: adding use as relation: %s->%s\n",yytext,aliasName.data()); - if (!aliasName.isEmpty()) + //printf("PHP: adding use as relation: %s->%s\n",yytext,g_aliasName.data()); + if (!g_aliasName.isEmpty()) { Doxygen::namespaceAliasDict.insert(yytext, new QCString(removeRedundantWhiteSpace( - substitute(aliasName,"\\","::")))); + substitute(g_aliasName,"\\","::")))); } - aliasName.resize(0); + g_aliasName.resize(0); } [,;] { if (*yytext==',') @@ -1985,59 +1964,59 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) ({ID}{BN}*"."{BN}*)+"*" { // package import => add as a using directive lineCount(); QCString scope=yytext; - current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::")); - current->fileName = yyFileName; - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->name=removeRedundantWhiteSpace(substitute(scope.left(scope.length()-1),".","::")); + g_current->fileName = g_yyFileName; + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(Using); } ({ID}{BN}*"."{BN}*)+{ID} { // class import => add as a using declaration lineCount(); QCString scope=yytext; - current->name=removeRedundantWhiteSpace(substitute(scope,".","::")); - current->fileName = yyFileName; - if (insideD) + g_current->name=removeRedundantWhiteSpace(substitute(scope,".","::")); + g_current->fileName = g_yyFileName; + if (g_insideD) { - current->section=Entry::USINGDIR_SEC; + g_current->section=Entry::USINGDIR_SEC; } else { - //printf("import name = %s -> %s\n",yytext,current->name.data()); - current->section=Entry::USINGDECL_SEC; + //printf("import name = %s -> %s\n",yytext,g_current->name.data()); + g_current->section=Entry::USINGDECL_SEC; } - previous = current.get(); - current_root->moveToSubEntryAndRefresh(current); + g_previous = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(Using); } "using"{BN}+ { - current->startLine=yyLineNr; - current->startColumn = yyColNr; + g_current->startLine=g_yyLineNr; + g_current->startColumn = g_yyColNr; lineCount(); BEGIN(Using); } "namespace"{BN}+ { lineCount(); BEGIN(UsingDirective); } ({ID}{BN}*("::"|"."){BN}*)*({ID}|{OPERATOR}) { lineCount(); - current->name=yytext; - current->fileName = yyFileName; - current->section=Entry::USINGDECL_SEC; - current->startLine = yyLineNr; - previous = current.get(); - current_root->moveToSubEntryAndRefresh(current); + g_current->name=yytext; + g_current->fileName = g_yyFileName; + g_current->section=Entry::USINGDECL_SEC; + g_current->startLine = g_yyLineNr; + g_previous = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); - if (insideCS) /* Hack: in C# a using declaration and + if (g_insideCS) /* Hack: in C# a using declaration and directive have the same syntax, so we also add it as a using directive here */ { - current->name=yytext; - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->name=yytext; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); } BEGIN(Using); @@ -2046,26 +2025,26 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(UsingAlias); } ";" { - previous->section=Entry::VARIABLE_SEC; - previous->type = "typedef "+previous->args; - previous->type=previous->type.simplifyWhiteSpace(); - previous->args.resize(0); - previous->name=previous->name.stripWhiteSpace(); - previous->bodyLine = yyLineNr; - previous->spec |= Entry::Alias; + g_previous->section=Entry::VARIABLE_SEC; + g_previous->type = "typedef "+g_previous->args; + g_previous->type=g_previous->type.simplifyWhiteSpace(); + g_previous->args.resize(0); + g_previous->name=g_previous->name.stripWhiteSpace(); + g_previous->bodyLine = g_yyLineNr; + g_previous->spec |= Entry::Alias; BEGIN(FindMembers); } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { - docBlockContext = UsingAliasEnd; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = UsingAliasEnd; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; lineCount(); - docBlockTerm = ';'; + g_docBlockTerm = ';'; if (yytext[yyleng-3]=='/') { startCommentBlock(TRUE); @@ -2078,27 +2057,27 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ">>" { - previous->args+="> >"; // see bug769552 + g_previous->args+="> >"; // see bug769552 } . { - previous->args+=yytext; + g_previous->args+=yytext; } \n { - previous->args+=yytext; + g_previous->args+=yytext; lineCount(); } ";" { - previous->doc = current->doc; - previous->brief = current->brief; - current->doc.resize(0); - current->brief.resize(0); + g_previous->doc = g_current->doc; + g_previous->brief = g_current->brief; + g_current->doc.resize(0); + g_current->brief.resize(0); unput(';'); BEGIN(UsingAlias); } -{SCOPENAME} { current->name=removeRedundantWhiteSpace(yytext); - current->fileName = yyFileName; - current->section=Entry::USINGDIR_SEC; - current_root->moveToSubEntryAndRefresh(current); +{SCOPENAME} { g_current->name=removeRedundantWhiteSpace(yytext); + g_current->fileName = g_yyFileName; + g_current->section=Entry::USINGDIR_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(Using); } @@ -2106,59 +2085,59 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {SCOPENAME}{BN}*"<>" { // guided template decl QCString n=yytext; addType(); - current->name=n.left(n.length()-2); + g_current->name=n.left(n.length()-2); } {SCOPENAME}{BN}*/"<" { // Note: this could be a return type! - roundCount=0; - sharpCount=0; + g_roundCount=0; + g_sharpCount=0; lineCount(); addType(); - current->name=yytext; - current->name=current->name.stripWhiteSpace(); - //current->scopeSpec.resize(0); - // currentTemplateSpec = ¤t->scopeSpec; - if (nameIsOperator(current->name)) + g_current->name=yytext; + g_current->name=g_current->name.stripWhiteSpace(); + //g_current->scopeSpec.resize(0); + // g_currentTemplateSpec = &g_current->scopeSpec; + if (nameIsOperator(g_current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } {SCOPENAME}{BN}*/"<" { - sharpCount=0; - roundCount=0; + g_sharpCount=0; + g_roundCount=0; lineCount(); - current->name+=((QCString)yytext).stripWhiteSpace(); - //current->memberSpec.resize(0); - // currentTemplateSpec = ¤t->memberSpec; - if (nameIsOperator(current->name)) + g_current->name+=((QCString)yytext).stripWhiteSpace(); + //g_current->memberSpec.resize(0); + // g_currentTemplateSpec = &g_current->memberSpec; + if (nameIsOperator(g_current->name)) BEGIN( Operator ); else BEGIN( EndTemplate ); } "<<<" { - if (!insidePHP) + if (!g_insidePHP) { REJECT; } else { - lastHereDocContext = YY_START; + g_lastHereDocContext = YY_START; BEGIN(HereDoc); } } "<<" { - current->name+=yytext; - // *currentTemplateSpec+=yytext; + g_current->name+=yytext; + // *g_currentTemplateSpec+=yytext; } "<" { - if (roundCount==0) + if (g_roundCount==0) { - // *currentTemplateSpec+='<'; - sharpCount++; + // *g_currentTemplateSpec+='<'; + g_sharpCount++; } - current->name+=yytext; + g_current->name+=yytext; } ">>" { - if (insideJava || insideCS || insideCli || roundCount==0) + if (g_insideJava || g_insideCS || g_insideCli || g_roundCount==0) { unput('>'); unput(' '); @@ -2166,65 +2145,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - current->name+=yytext; + g_current->name+=yytext; } - // *currentTemplateSpec+=yytext; + // *g_currentTemplateSpec+=yytext; } ">" { - current->name+='>'; - // *currentTemplateSpec+='>'; - if (roundCount==0 && --sharpCount<=0) + g_current->name+='>'; + // *g_currentTemplateSpec+='>'; + if (g_roundCount==0 && --g_sharpCount<=0) { - //printf("Found %s\n",current->name.data()); + //printf("Found %s\n",g_current->name.data()); BEGIN(FindMembers); } } ">"{BN}*"(" { lineCount(); - current->name+='>'; - // *currentTemplateSpec+='>'; - if (roundCount==0 && --sharpCount<=0) - { - current->bodyLine = yyLineNr; - current->args = "("; - currentArgumentContext = FuncQual; - fullArgString = current->args.copy(); - copyArgString = ¤t->args; - //printf("Found %s\n",current->name.data()); + g_current->name+='>'; + // *g_currentTemplateSpec+='>'; + if (g_roundCount==0 && --g_sharpCount<=0) + { + g_current->bodyLine = g_yyLineNr; + g_current->args = "("; + g_currentArgumentContext = FuncQual; + g_fullArgString = g_current->args.copy(); + g_copyArgString = &g_current->args; + //printf("Found %s\n",g_current->name.data()); BEGIN( ReadFuncArgType ) ; } } ">"{BN}*/"("({BN}*{ID}{BN}*"::")*({BN}*"*"{BN}*)+ { // function pointer returning a template instance lineCount(); - current->name+='>'; - if (roundCount==0) + g_current->name+='>'; + if (g_roundCount==0) { BEGIN(FindMembers); } } ">"{BN}*/"::" { lineCount(); - current->name+='>'; - // *currentTemplateSpec+='>'; - if (roundCount==0 && --sharpCount<=0) + g_current->name+='>'; + // *g_currentTemplateSpec+='>'; + if (g_roundCount==0 && --g_sharpCount<=0) { BEGIN(FindMemberName); } } -"(" { current->name+=*yytext; - roundCount++; +"(" { g_current->name+=*yytext; + g_roundCount++; } -")" { current->name+=*yytext; - if (roundCount>0) roundCount--; +")" { g_current->name+=*yytext; + if (g_roundCount>0) g_roundCount--; } . { - current->name+=*yytext; - // *currentTemplateSpec+=*yytext; + g_current->name+=*yytext; + // *g_currentTemplateSpec+=*yytext; } "define"{BN}*"("{BN}*["'] { - if (insidePHP) + if (g_insidePHP) { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( DefinePHP ); } else @@ -2232,12 +2211,12 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {ID} { // PHP heredoc g_delimiter = yytext; - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } "'"{ID}/"'" { // PHP nowdoc g_delimiter = &yytext[1]; - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; BEGIN(CopyHereDocEnd); } {ID} { // PHP heredoc @@ -2251,32 +2230,32 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) ^{ID} { // id at start of the line could mark the end of the block if (g_delimiter==yytext) // it is the end marker { - BEGIN(lastHereDocContext); + BEGIN(g_lastHereDocContext); } } . { } ^{ID} { // id at start of the line could mark the end of the block - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; if (g_delimiter==yytext) // it is the end marker { - BEGIN(lastHereDocContext); + BEGIN(g_lastHereDocContext); } } \n { - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; } {ID} { - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; } . { - *pCopyHereDocGString += yytext; + *g_pCopyHereDocGString += yytext; } "Q_OBJECT" { // Qt object macro } "Q_PROPERTY" { // Qt property declaration - current->protection = Public ; // see bug734245 & bug735462 - current->mtype = mtype = Property; - current->type.resize(0); + g_current->protection = Public ; // see bug734245 & bug735462 + g_current->mtype = g_mtype = Property; + g_current->type.resize(0); BEGIN(QtPropType); } "(" { // start of property arguments @@ -2286,25 +2265,25 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } "const"|"volatile"|"unsigned"|"signed"|"long"|"short" { - current->type+=yytext; + g_current->type+=yytext; } {B}+ { - current->type+=yytext; + g_current->type+=yytext; } ({TSCOPE}"::")*{TSCOPE} { - current->type+=yytext; + g_current->type+=yytext; BEGIN(QtPropName); } {ID} { - current->name=yytext; + g_current->name=yytext; BEGIN(QtPropAttr); } "READ" { - current->spec |= Entry::Readable; + g_current->spec |= Entry::Readable; BEGIN(QtPropRead); } "WRITE" { - current->spec |= Entry::Writable; + g_current->spec |= Entry::Writable; BEGIN(QtPropWrite); } "RESET"{B}+{ID} { // reset method => not supported yet @@ -2314,96 +2293,96 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) "DESIGNABLE"{B}+{ID} { // designable property => not supported yet } {ID} { - current->read = yytext; + g_current->read = yytext; BEGIN(QtPropAttr); } {ID} { - current->write = yytext; + g_current->write = yytext; BEGIN(QtPropAttr); } "friend"{BN}+("class"|"union"|"struct"){BN}+ { - current->name=yytext; + g_current->name=yytext; BEGIN(FindMembers); } {SCOPENAME} { - if (insideCpp || insideObjC) + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } - yyBegColNr=yyColNr; - yyBegLineNr=yyLineNr; + g_yyBegColNr=g_yyColNr; + g_yyBegLineNr=g_yyLineNr; lineCount(); - if (insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0) + if (g_insideIDL && yyleng==9 && qstrcmp(yytext,"cpp_quote")==0) { BEGIN(CppQuote); } - else if ((insideIDL || insideJava || insideD) && yyleng==6 && qstrcmp(yytext,"import")==0) + else if ((g_insideIDL || g_insideJava || g_insideD) && yyleng==6 && qstrcmp(yytext,"import")==0) { - if (insideIDL) + if (g_insideIDL) BEGIN(NextSemi); - else // insideJava or insideD + else // g_insideJava or g_insideD BEGIN(JavaImport); } - else if (insidePHP && qstrcmp(yytext,"use")==0) + else if (g_insidePHP && qstrcmp(yytext,"use")==0) { BEGIN(PHPUse); } - else if (insideJava && qstrcmp(yytext,"package")==0) + else if (g_insideJava && qstrcmp(yytext,"package")==0) { lineCount(); BEGIN(PackageName); } - else if (insideIDL && qstrcmp(yytext,"case")==0) + else if (g_insideIDL && qstrcmp(yytext,"case")==0) { BEGIN(IDLUnionCase); } - else if (insideTryBlock && qstrcmp(yytext,"catch")==0) + else if (g_insideTryBlock && qstrcmp(yytext,"catch")==0) { - insideTryBlock=FALSE; + g_insideTryBlock=FALSE; BEGIN(TryFunctionBlock); } - else if (insideCpp && qstrcmp(yytext,"alignas")==0) + else if (g_insideCpp && qstrcmp(yytext,"alignas")==0) { - lastAlignAsContext = YY_START; + g_lastAlignAsContext = YY_START; BEGIN(AlignAs); } - else if (insideJS && qstrcmp(yytext,"var")==0) + else if (g_insideJS && qstrcmp(yytext,"var")==0) { // javascript variable - current->type="var"; + g_current->type="var"; } - else if (insideJS && qstrcmp(yytext,"function")==0) + else if (g_insideJS && qstrcmp(yytext,"function")==0) { // javascript function - current->type="function"; + g_current->type="function"; } - else if (insideCS && qstrcmp(yytext,"this")==0) + else if (g_insideCS && qstrcmp(yytext,"this")==0) { // C# indexer addType(); - current->name="this"; + g_current->name="this"; BEGIN(CSIndexer); } - else if (insideCpp && qstrcmp(yytext,"static_assert")==0) + else if (g_insideCpp && qstrcmp(yytext,"static_assert")==0) { // C++11 static_assert BEGIN(StaticAssert); } - else if (insideCpp && qstrcmp(yytext,"decltype")==0) + else if (g_insideCpp && qstrcmp(yytext,"decltype")==0) { // C++11 decltype(x) - current->type+=yytext; + g_current->type+=yytext; BEGIN(DeclType); } - else if (insideSlice && qstrcmp(yytext,"optional")==0) + else if (g_insideSlice && qstrcmp(yytext,"optional")==0) { - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type = "optional"; + g_current->type = "optional"; } else { - current->type += " optional"; + g_current->type += " optional"; } - lastModifierContext = YY_START; + g_lastModifierContext = YY_START; BEGIN(SliceOptional); } else @@ -2412,65 +2391,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { addType(); } - bool javaLike = insideJava || insideCS || insideD || insidePHP || insideJS; + bool javaLike = g_insideJava || g_insideCS || g_insideD || g_insidePHP || g_insideJS; if (javaLike && qstrcmp(yytext,"public")==0) { - current->protection = Public; + g_current->protection = Public; } else if (javaLike && qstrcmp(yytext,"protected")==0) { - current->protection = Protected; + g_current->protection = Protected; } - else if ((insideCS || insideD || insidePHP || insideJS) && qstrcmp(yytext,"internal")==0) + else if ((g_insideCS || g_insideD || g_insidePHP || g_insideJS) && qstrcmp(yytext,"internal")==0) { - current->protection = Package; + g_current->protection = Package; } else if (javaLike && qstrcmp(yytext,"private")==0) { - current->protection = Private; + g_current->protection = Private; } else if (javaLike && qstrcmp(yytext,"static")==0) { if (YY_START==FindMembers) - current->name = yytext; + g_current->name = yytext; else - current->name += yytext; - current->stat = TRUE; + g_current->name += yytext; + g_current->stat = TRUE; } else { if (YY_START==FindMembers) - current->name = yytext; + g_current->name = yytext; else - current->name += yytext; - if (current->name.left(7)=="static ") + g_current->name += yytext; + if (g_current->name.left(7)=="static ") { - current->stat = TRUE; - current->name= current->name.mid(7); + g_current->stat = TRUE; + g_current->name= g_current->name.mid(7); } - else if (current->name.left(7)=="inline ") + else if (g_current->name.left(7)=="inline ") { - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type="inline"; + g_current->type="inline"; } else { - current->type+="inline "; + g_current->type+="inline "; } - current->name= current->name.mid(7); + g_current->name= g_current->name.mid(7); } - else if (current->name.left(6)=="const ") + else if (g_current->name.left(6)=="const ") { - if (current->type.isEmpty()) + if (g_current->type.isEmpty()) { - current->type="const"; + g_current->type="const"; } else { - current->type+="const "; + g_current->type+="const "; } - current->name=current->name.mid(6); + g_current->name=g_current->name.mid(6); } } QCString tmp=yytext; @@ -2480,14 +2459,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - externC=FALSE; // see bug759247 + g_externC=FALSE; // see bug759247 BEGIN(FindMembers); } } } "(" { - lastSkipRoundContext = FindMembers; - roundCount=0; + g_lastSkipRoundContext = FindMembers; + g_roundCount=0; BEGIN(SkipRound); } {BN}+ { lineCount(); } @@ -2496,10 +2475,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } "(" { - current->type+=yytext; - lastRoundContext=FindMembers; - pCopyRoundString=¤t->type; - roundCount=0; + g_current->type+=yytext; + g_lastRoundContext=FindMembers; + g_pCopyRoundString=&g_current->type; + g_roundCount=0; BEGIN(CopyRound); } {BN}+ { lineCount(); } @@ -2508,22 +2487,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FindMembers); } "["[^\n\]]*"]" { - current->name+=removeRedundantWhiteSpace(yytext); + g_current->name+=removeRedundantWhiteSpace(yytext); BEGIN(FindMembers); } [0-9]{ID} { // some number where we did not expect one } "." { - if (insideJava || insideCS || insideD) + if (g_insideJava || g_insideCS || g_insideD) { - current->name+="."; + g_current->name+="."; } } "::" { - current->name+=yytext; + g_current->name+=yytext; } "("{B}*"\"" { - insideCppQuote=TRUE; + g_insideCppQuote=TRUE; BEGIN(FindMembers); } "::" @@ -2532,8 +2511,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) . \n { lineCount(); } "{" { - curlyCount=0; - lastCurlyContext = TryFunctionBlockEnd ; + g_curlyCount=0; + g_lastCurlyContext = TryFunctionBlockEnd ; BEGIN( SkipCurly ); } . @@ -2546,123 +2525,123 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( FindMembers ); } ")" { - insideCppQuote=FALSE; + g_insideCppQuote=FALSE; BEGIN(FindMembers); } -{B}*"#" { if (insidePHP) +{B}*"#" { if (g_insidePHP) REJECT; - lastCPPContext = YY_START; + g_lastCPPContext = YY_START; BEGIN( SkipCPP ) ; } {B}*"#"{B}*("cmake")?"define" { - if (insidePHP) + if (g_insidePHP) REJECT; - current->bodyLine = yyLineNr; - lastDefineContext = YY_START; + g_current->bodyLine = g_yyLineNr; + g_lastDefineContext = YY_START; BEGIN( Define ); } {B}*"#"{B}+[0-9]+{B}+/"\"" { /* line control directive */ - yyLineNr = atoi(&yytext[1]); - //printf("setting line number to %d\n",yyLineNr); - lastPreLineCtrlContext = YY_START; + g_yyLineNr = atoi(&yytext[1]); + //printf("setting line number to %d\n",g_yyLineNr); + g_lastPreLineCtrlContext = YY_START; if (YY_START==ReadBody || YY_START==ReadNSBody || YY_START==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } BEGIN( PreLineCtrl ); } "\""[^\n\"]*"\"" { - yyFileName = stripQuotes(yytext); - if (lastPreLineCtrlContext==ReadBody || - lastPreLineCtrlContext==ReadNSBody || - lastPreLineCtrlContext==ReadBodyIntf) + g_yyFileName = stripQuotes(yytext); + if (g_lastPreLineCtrlContext==ReadBody || + g_lastPreLineCtrlContext==ReadNSBody || + g_lastPreLineCtrlContext==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } } . { - if (lastPreLineCtrlContext==ReadBody || - lastPreLineCtrlContext==ReadNSBody || - lastPreLineCtrlContext==ReadBodyIntf) + if (g_lastPreLineCtrlContext==ReadBody || + g_lastPreLineCtrlContext==ReadNSBody || + g_lastPreLineCtrlContext==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } } \n { - if (lastPreLineCtrlContext==ReadBody || - lastPreLineCtrlContext==ReadNSBody || - lastPreLineCtrlContext==ReadBodyIntf) + if (g_lastPreLineCtrlContext==ReadBody || + g_lastPreLineCtrlContext==ReadNSBody || + g_lastPreLineCtrlContext==ReadBodyIntf) { - current->program+=yytext; + g_current->program+=yytext; } lineCount(); - BEGIN( lastPreLineCtrlContext ); + BEGIN( g_lastPreLineCtrlContext ); } . \\[\r]*"\n"[\r]* { lineCount(); } [\r]*\n[\r]* { lineCount(); - BEGIN( lastCPPContext) ; + BEGIN( g_lastCPPContext) ; } {ID}{B}*"(" { - current->name = yytext; - current->name = current->name.left(current->name.length()-1).stripWhiteSpace(); - current->args = "("; - current->bodyLine = yyLineNr; - currentArgumentContext = DefineEnd; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->name = yytext; + g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); + g_current->args = "("; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = DefineEnd; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; } /* ")" { //printf("Define with args\n"); - current->args += ')'; + g_current->args += ')'; BEGIN( DefineEnd ); } . { - current->args += *yytext; + g_current->args += *yytext; } */ {ID} { //printf("Define '%s' without args\n",yytext); - if (insideCpp || insideObjC) + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } - current->bodyLine = yyLineNr; - current->name = yytext; + g_current->bodyLine = g_yyLineNr; + g_current->name = yytext; BEGIN(DefineEnd); } \n { - //printf("End define: doc=%s docFile=%s docLine=%d\n",current->doc.data(),current->docFile.data(),current->docLine); + //printf("End define: doc=%s docFile=%s docLine=%d\n",g_current->doc.data(),g_current->docFile.data(),g_current->docLine); lineCount(); - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->type.resize(0); - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::DEFINE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->type.resize(0); + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::DEFINE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); - BEGIN(lastDefineContext); + BEGIN(g_lastDefineContext); } ";" { //printf("End define\n"); - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->type.resize(0); - current->type = "const"; - QCString init = current->initializer.data(); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->type.resize(0); + g_current->type = "const"; + QCString init = g_current->initializer.data(); init = init.simplifyWhiteSpace(); init = init.left(init.length()-1); - current->initializer = init; - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->initializer = init; + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(FindMembers); } @@ -2671,34 +2650,34 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(); } \" { - if (insideIDL && insideCppQuote) + if (g_insideIDL && g_insideCppQuote) { BEGIN(EndCppQuote); } else { - lastStringContext=DefineEnd; + g_lastStringContext=DefineEnd; BEGIN(SkipString); } } . {ID}["']{BN}*","{BN}* { - current->name = yytext; - current->name = current->name.stripWhiteSpace(); - current->name = current->name.left(current->name.length()-1).stripWhiteSpace(); - current->name = current->name.left(current->name.length()-1); - current->bodyLine = yyLineNr; - lastRoundContext = DefinePHPEnd; - pCopyRoundGString = ¤t->initializer; - roundCount = 0; + g_current->name = yytext; + g_current->name = g_current->name.stripWhiteSpace(); + g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); + g_current->name = g_current->name.left(g_current->name.length()-1); + g_current->bodyLine = g_yyLineNr; + g_lastRoundContext = DefinePHPEnd; + g_pCopyRoundGString = &g_current->initializer; + g_roundCount = 0; BEGIN( GCopyRound ); } [\^%] { // ^ and % are C++/CLI extensions - if (insideCli) + if (g_insideCli) { addType(); - current->name = yytext ; + g_current->name = yytext ; } else { @@ -2706,31 +2685,31 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } [*&]+ { - current->name += yytext ; + g_current->name += yytext ; addType(); } ";"{BN}*("/**"|"//!"|"/*!"|"///")"<" { - if (current->bodyLine==-1) + if (g_current->bodyLine==-1) { - current->bodyLine=yyLineNr; + g_current->bodyLine=g_yyLineNr; } - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; //printf("indent=%d\n",computeIndent(yytext+1,g_column)); lineCount(); - docBlockTerm = ';'; - if (YY_START==EnumBaseType && current->section==Entry::ENUM_SEC) + g_docBlockTerm = ';'; + if (YY_START==EnumBaseType && g_current->section==Entry::ENUM_SEC) { - current->bitfields = ":"+current->args; - current->args.resize(0); - current->section=Entry::VARIABLE_SEC; + g_current->bitfields = ":"+g_current->args; + g_current->args.resize(0); + g_current->section=Entry::VARIABLE_SEC; } if (yytext[yyleng-3]=='/') { @@ -2744,22 +2723,22 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ","{BN}*("/**"|"//!"|"/*!"|"///")"<" { - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; lineCount(); - docBlockTerm = ','; - if (YY_START==EnumBaseType && current->section==Entry::ENUM_SEC) + g_docBlockTerm = ','; + if (YY_START==EnumBaseType && g_current->section==Entry::ENUM_SEC) { - current->bitfields = ":"+current->args; - current->args.resize(0); - current->section=Entry::VARIABLE_SEC; + g_current->bitfields = ":"+g_current->args; + g_current->args.resize(0); + g_current->section=Entry::VARIABLE_SEC; } if (yytext[yyleng-3]=='/') { @@ -2773,20 +2752,20 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {BN}*("/**"|"//!"|"/*!"|"///")"<" { - if (current->bodyLine==-1) + if (g_current->bodyLine==-1) { - current->bodyLine=yyLineNr; + g_current->bodyLine=g_yyLineNr; } - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); QCString indent; indent.fill(' ',computeIndent(yytext,g_column)); - docBlock=indent; + g_docBlock=indent; lineCount(); - docBlockTerm = 0; + g_docBlockTerm = 0; if (yytext[yyleng-3]=='/') { startCommentBlock(TRUE); @@ -2800,34 +2779,34 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ("//"([!/]){B}*{CMD}"{")|("/*"([!*]){B}*{CMD}"{") { - //handleGroupStartCommand(current->name); - if (previous && previous->section==Entry::GROUPDOC_SEC) + //handleGroupStartCommand(g_current->name); + if (g_previous && g_previous->section==Entry::GROUPDOC_SEC) { - // link open command to the group defined in the previous entry - Doxygen::docGroup.open(previous,yyFileName,yyLineNr); + // link open command to the group defined in the g_previous entry + Doxygen::docGroup.open(g_previous,g_yyFileName,g_yyLineNr); } else { - // link open command to the current entry - Doxygen::docGroup.open(current.get(),yyFileName,yyLineNr); + // link open command to the g_current entry + Doxygen::docGroup.open(g_current.get(),g_yyFileName,g_yyLineNr); } - //current = tmp; + //g_current = tmp; initEntry(); if (yytext[1]=='/') { if (yytext[2]=='!' || yytext[2]=='/') { - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlockAutoBrief = FALSE; - docBlock.resize(0); - docBlockTerm = 0; + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlockAutoBrief = FALSE; + g_docBlock.resize(0); + g_docBlockTerm = 0; startCommentBlock(TRUE); BEGIN(DocLine); } else { - lastCContext=YY_START; + g_lastCContext=YY_START; BEGIN(SkipCxxComment); } } @@ -2835,498 +2814,498 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { if (yytext[2]=='!' || yytext[2]=='*') { - docBlockContext = YY_START; - docBlockInBody = FALSE; - docBlock.resize(0); - docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || + g_docBlockContext = YY_START; + g_docBlockInBody = FALSE; + g_docBlock.resize(0); + g_docBlockAutoBrief = ( yytext[yyleng-2]=='*' && Config_getBool(JAVADOC_AUTOBRIEF) ) || ( yytext[yyleng-2]=='!' && Config_getBool(QT_AUTOBRIEF) ); - docBlockTerm = 0; + g_docBlockTerm = 0; startCommentBlock(FALSE); BEGIN(DocBlock); } else { - lastCContext=YY_START; + g_lastCContext=YY_START; BEGIN(SkipComment); } } } "//"([!/]){B}*{CMD}"}".*|"/*"([!*]){B}*{CMD}"}"[^*]*"*/" { - bool insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && lastInitializerContext==FindFields); // see bug746226 - Doxygen::docGroup.close(current.get(),yyFileName,yyLineNr,insideEnum); + bool g_insideEnum = YY_START==FindFields || (YY_START==ReadInitializer && g_lastInitializerContext==FindFields); // see bug746226 + Doxygen::docGroup.close(g_current.get(),g_yyFileName,g_yyLineNr,g_insideEnum); lineCount(); } "=" { // in PHP code this could also be due to "bodyLine = yyLineNr; - current->initializer = yytext; - lastInitializerContext = YY_START; - initBracketCount=0; + g_current->bodyLine = g_yyLineNr; + g_current->initializer = yytext; + g_lastInitializerContext = YY_START; + g_initBracketCount=0; BEGIN(ReadInitializer); } {BN}*[gs]"et"{BN}+"raises"{BN}*"("{BN}*{SCOPENAME}{BN}*(","{BN}*{SCOPENAME}{BN}*)*")"{BN}*";" { lineCount(); - current->exception += " "; - current->exception += removeRedundantWhiteSpace(yytext); + g_current->exception += " "; + g_current->exception += removeRedundantWhiteSpace(yytext); } "}" { - current->exception += " }"; + g_current->exception += " }"; BEGIN(FindMembers); } /* Read initializer rules */ "(" { - lastRoundContext=YY_START; - pCopyRoundGString=¤t->initializer; - roundCount=0; - current->initializer+=*yytext; + g_lastRoundContext=YY_START; + g_pCopyRoundGString=&g_current->initializer; + g_roundCount=0; + g_current->initializer+=*yytext; BEGIN(GCopyRound); } "[" { - if (!insidePHP) REJECT; - lastSquareContext=YY_START; - pCopySquareGString=¤t->initializer; - squareCount=0; - current->initializer+=*yytext; + if (!g_insidePHP) REJECT; + g_lastSquareContext=YY_START; + g_pCopySquareGString=&g_current->initializer; + g_squareCount=0; + g_current->initializer+=*yytext; BEGIN(GCopySquare); } "{" { - lastCurlyContext=YY_START; - pCopyCurlyGString=¤t->initializer; - curlyCount=0; - current->initializer+=*yytext; + g_lastCurlyContext=YY_START; + g_pCopyCurlyGString=&g_current->initializer; + g_curlyCount=0; + g_current->initializer+=*yytext; BEGIN(GCopyCurly); } [;,] { - //printf(">> initializer '%s' <<\n",current->initializer.data()); - if (*yytext==';' && (current_root->spec&Entry::Enum)) - { - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + //printf(">> initializer '%s' <<\n",g_current->initializer.data()); + if (*yytext==';' && (g_current_root->spec&Entry::Enum)) + { + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN(FindMembers); } - else if (*yytext==';' || (lastInitializerContext==FindFields && initBracketCount==0)) // initBracketCount==0 was added for bug 665778 + else if (*yytext==';' || (g_lastInitializerContext==FindFields && g_initBracketCount==0)) // g_initBracketCount==0 was added for bug 665778 { unput(*yytext); - BEGIN(lastInitializerContext); + BEGIN(g_lastInitializerContext); } - else if (*yytext==',' && initBracketCount==0) // for "int a=0,b=0" + else if (*yytext==',' && g_initBracketCount==0) // for "int a=0,b=0" { unput(*yytext); - BEGIN(lastInitializerContext); + BEGIN(g_lastInitializerContext); } else { - current->initializer+=*yytext; + g_current->initializer+=*yytext; } } {RAWBEGIN} { // C++11 raw string - if (!insideCpp) + if (!g_insideCpp) { REJECT; } else { QCString text=yytext; - current->initializer+=text; + g_current->initializer+=text; int i=text.find('"'); g_delimiter = yytext+i+1; g_delimiter=g_delimiter.left(g_delimiter.length()-1); - lastRawStringContext = YY_START; - pCopyRawGString = ¤t->initializer; + g_lastRawStringContext = YY_START; + g_pCopyRawGString = &g_current->initializer; BEGIN(RawGString); //printf("RawGString delimiter='%s'\n",delimiter.data()); } } {RAWEND} { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); if (delimiter==g_delimiter) { - BEGIN(lastRawStringContext); + BEGIN(g_lastRawStringContext); } } [^)\n]+ { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; } . { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; } \n { - *pCopyRawGString+=yytext; + *g_pCopyRawGString+=yytext; lineCount(); } {RAWEND} { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; QCString delimiter = yytext+1; delimiter=delimiter.left(delimiter.length()-1); if (delimiter==g_delimiter) { - BEGIN(lastRawStringContext); + BEGIN(g_lastRawStringContext); } } [^)]+ { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; } . { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; } \n { - *pCopyRawString+=yytext; - fullArgString+=yytext; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; lineCount(); } \" { - if (insideIDL && insideCppQuote) + if (g_insideIDL && g_insideCppQuote) { BEGIN(EndCppQuote); } else { - lastStringContext=YY_START; - current->initializer+=yytext; - pCopyQuotedGString=¤t->initializer; + g_lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString=&g_current->initializer; BEGIN(CopyGString); } } "->" { - current->initializer+=yytext; + g_current->initializer+=yytext; } "<<" { - current->initializer+=yytext; + g_current->initializer+=yytext; } ">>" { - current->initializer+=yytext; + g_current->initializer+=yytext; } [<\[{(] { - initBracketCount++; - current->initializer+=*yytext; + g_initBracketCount++; + g_current->initializer+=*yytext; } [>\]})] { - initBracketCount--; - current->initializer+=*yytext; + g_initBracketCount--; + g_current->initializer+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedGString = ¤t->initializer; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString = &g_current->initializer; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - current->initializer+=yytext; + g_current->initializer+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - current->initializer+=yytext; + g_current->initializer+=yytext; } } \n { - current->initializer+=*yytext; + g_current->initializer+=*yytext; lineCount(); } "@\"" { - //printf("insideCS=%d\n",insideCS); - current->initializer+=yytext; - if (!insideCS && !insideObjC) + //printf("g_insideCS=%d\n",g_insideCS); + g_current->initializer+=yytext; + if (!g_insideCS && !g_insideObjC) { REJECT; } else { // C#/ObjC verbatim string - lastSkipVerbStringContext=YY_START; - pSkipVerbString=¤t->initializer; + g_lastSkipVerbStringContext=YY_START; + g_pSkipVerbString=&g_current->initializer; BEGIN(SkipVerbString); } } [^\n"]+ { - *pSkipVerbString+=yytext; + *g_pSkipVerbString+=yytext; } "\"\"" { // quote escape - *pSkipVerbString+=yytext; + *g_pSkipVerbString+=yytext; } "\"" { - *pSkipVerbString+=*yytext; - BEGIN(lastSkipVerbStringContext); + *g_pSkipVerbString+=*yytext; + BEGIN(g_lastSkipVerbStringContext); } \n { - *pSkipVerbString+=*yytext; + *g_pSkipVerbString+=*yytext; lineCount(); } . { - *pSkipVerbString+=*yytext; + *g_pSkipVerbString+=*yytext; } "?>" { - if (insidePHP) + if (g_insidePHP) BEGIN( FindMembersPHP ); else - current->initializer+=yytext; + g_current->initializer+=yytext; } . { - current->initializer+=*yytext; + g_current->initializer+=*yytext; } /* generic quoted string copy rules */ \\. { - *pCopyQuotedString+=yytext; + *g_pCopyQuotedString+=yytext; } \" { - *pCopyQuotedString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedString+=*yytext; + BEGIN( g_lastStringContext ); } \' { - *pCopyQuotedString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedString+=*yytext; + BEGIN( g_lastStringContext ); } "/*"|"*/"|"//" { - *pCopyQuotedString+=yytext; + *g_pCopyQuotedString+=yytext; } \n { - *pCopyQuotedString+=*yytext; + *g_pCopyQuotedString+=*yytext; lineCount(); } . { - *pCopyQuotedString+=*yytext; + *g_pCopyQuotedString+=*yytext; } /* generic quoted growable string copy rules */ \\. { - *pCopyQuotedGString+=yytext; + *g_pCopyQuotedGString+=yytext; } \" { - *pCopyQuotedGString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedGString+=*yytext; + BEGIN( g_lastStringContext ); } \' { - *pCopyQuotedGString+=*yytext; - BEGIN( lastStringContext ); + *g_pCopyQuotedGString+=*yytext; + BEGIN( g_lastStringContext ); } ""/*"|"*/"|"//" { - *pCopyQuotedGString+=yytext; + *g_pCopyQuotedGString+=yytext; } \n { - *pCopyQuotedGString+=*yytext; + *g_pCopyQuotedGString+=*yytext; lineCount(); } . { - *pCopyQuotedGString+=*yytext; + *g_pCopyQuotedGString+=*yytext; } /* generic round bracket list copy rules */ \" { - *pCopyRoundString+=*yytext; - pCopyQuotedString=pCopyRoundString; - lastStringContext=YY_START; + *g_pCopyRoundString+=*yytext; + g_pCopyQuotedString=g_pCopyRoundString; + g_lastStringContext=YY_START; BEGIN(CopyString); } "(" { - *pCopyRoundString+=*yytext; - roundCount++; + *g_pCopyRoundString+=*yytext; + g_roundCount++; } ")" { - *pCopyRoundString+=*yytext; - if (--roundCount<0) - BEGIN(lastRoundContext); + *g_pCopyRoundString+=*yytext; + if (--g_roundCount<0) + BEGIN(g_lastRoundContext); } \n { lineCount(); - *pCopyRoundString+=*yytext; + *g_pCopyRoundString+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedString = pCopyRoundString; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedString = g_pCopyRoundString; + g_lastStringContext=YY_START; BEGIN(CopyPHPString); } else { - *pCopyRoundString+=yytext; + *g_pCopyRoundString+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *pCopyRoundString+=yytext; + *g_pCopyRoundString+=yytext; } } [^"'()\n]+ { - *pCopyRoundString+=yytext; + *g_pCopyRoundString+=yytext; } . { - *pCopyRoundString+=*yytext; + *g_pCopyRoundString+=*yytext; } /* generic round bracket list copy rules for growable strings */ \" { - *pCopyRoundGString+=*yytext; - pCopyQuotedGString=pCopyRoundGString; - lastStringContext=YY_START; + *g_pCopyRoundGString+=*yytext; + g_pCopyQuotedGString=g_pCopyRoundGString; + g_lastStringContext=YY_START; BEGIN(CopyGString); } "(" { - *pCopyRoundGString+=*yytext; - roundCount++; + *g_pCopyRoundGString+=*yytext; + g_roundCount++; } ")" { - *pCopyRoundGString+=*yytext; - if (--roundCount<0) - BEGIN(lastRoundContext); + *g_pCopyRoundGString+=*yytext; + if (--g_roundCount<0) + BEGIN(g_lastRoundContext); } \n { lineCount(); - *pCopyRoundGString+=*yytext; + *g_pCopyRoundGString+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedGString = pCopyRoundGString; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString = g_pCopyRoundGString; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - *pCopyRoundGString+=yytext; + *g_pCopyRoundGString+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *pCopyRoundGString+=yytext; + *g_pCopyRoundGString+=yytext; } } [^"'()\n/]+ { - *pCopyRoundGString+=yytext; + *g_pCopyRoundGString+=yytext; } . { - *pCopyRoundGString+=*yytext; + *g_pCopyRoundGString+=*yytext; } /* generic square bracket list copy rules for growable strings, we should only enter here in case of php, left the test part as in GCopyRound to keep it compatible with the round bracket version */ \" { - *pCopySquareGString+=*yytext; - pCopyQuotedGString=pCopySquareGString; - lastStringContext=YY_START; + *g_pCopySquareGString+=*yytext; + g_pCopyQuotedGString=g_pCopySquareGString; + g_lastStringContext=YY_START; BEGIN(CopyGString); } "[" { - *pCopySquareGString+=*yytext; - squareCount++; + *g_pCopySquareGString+=*yytext; + g_squareCount++; } "]" { - *pCopySquareGString+=*yytext; - if (--squareCount<0) - BEGIN(lastSquareContext); + *g_pCopySquareGString+=*yytext; + if (--g_squareCount<0) + BEGIN(g_lastSquareContext); } \n { lineCount(); - *pCopySquareGString+=*yytext; + *g_pCopySquareGString+=*yytext; } \' { - if (insidePHP) + if (g_insidePHP) { - current->initializer+=yytext; - pCopyQuotedGString = pCopySquareGString; - lastStringContext=YY_START; + g_current->initializer+=yytext; + g_pCopyQuotedGString = g_pCopySquareGString; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } else { - *pCopySquareGString+=yytext; + *g_pCopySquareGString+=yytext; } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *pCopySquareGString+=yytext; + *g_pCopySquareGString+=yytext; } } [^"\[\]\n/]+ { - *pCopySquareGString+=yytext; + *g_pCopySquareGString+=yytext; } . { - *pCopySquareGString+=*yytext; + *g_pCopySquareGString+=*yytext; } /* generic curly bracket list copy rules */ \" { - *pCopyCurlyString+=*yytext; - pCopyQuotedString=pCopyCurlyString; - lastStringContext=YY_START; + *g_pCopyCurlyString+=*yytext; + g_pCopyQuotedString=g_pCopyCurlyString; + g_lastStringContext=YY_START; BEGIN(CopyString); } \' { - *pCopyCurlyString+=*yytext; - if (insidePHP) + *g_pCopyCurlyString+=*yytext; + if (g_insidePHP) { - pCopyQuotedString=pCopyCurlyString; - lastStringContext=YY_START; + g_pCopyQuotedString=g_pCopyCurlyString; + g_lastStringContext=YY_START; BEGIN(CopyPHPString); } } "{" { - *pCopyCurlyString+=*yytext; - curlyCount++; + *g_pCopyCurlyString+=*yytext; + g_curlyCount++; } "}" { - *pCopyCurlyString+=*yytext; - if (--curlyCount<0) - BEGIN(lastCurlyContext); + *g_pCopyCurlyString+=*yytext; + if (--g_curlyCount<0) + BEGIN(g_lastCurlyContext); } -{CHARLIT} { if (insidePHP) +{CHARLIT} { if (g_insidePHP) { REJECT; } else { - *pCopyCurlyString+=yytext; + *g_pCopyCurlyString+=yytext; } } [^"'{}\/\n]+ { - *pCopyCurlyString+=yytext; + *g_pCopyCurlyString+=yytext; } -"/" { *pCopyCurlyString+=yytext; } +"/" { *g_pCopyCurlyString+=yytext; } \n { lineCount(); - *pCopyCurlyString+=*yytext; + *g_pCopyCurlyString+=*yytext; } . { - *pCopyCurlyString+=*yytext; + *g_pCopyCurlyString+=*yytext; } /* generic curly bracket list copy rules for growable strings */ @@ -3336,7 +3315,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) QCString line = QCString(yytext); int s = line.find(' '); int e = line.find('"',s); - yyLineNr = line.mid(s,e-s).toInt(); + g_yyLineNr = line.mid(s,e-s).toInt(); if (yytext[yyleng-1]=='\n') { lineCount(); @@ -3344,435 +3323,435 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } \" { - *pCopyCurlyGString+=*yytext; - pCopyQuotedGString=pCopyCurlyGString; - lastStringContext=YY_START; + *g_pCopyCurlyGString+=*yytext; + g_pCopyQuotedGString=g_pCopyCurlyGString; + g_lastStringContext=YY_START; BEGIN(CopyGString); } \' { - *pCopyCurlyGString+=*yytext; - if (insidePHP) + *g_pCopyCurlyGString+=*yytext; + if (g_insidePHP) { - pCopyQuotedGString=pCopyCurlyGString; - lastStringContext=YY_START; + g_pCopyQuotedGString=g_pCopyCurlyGString; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } } "{" { - *pCopyCurlyGString+=*yytext; - curlyCount++; + *g_pCopyCurlyGString+=*yytext; + g_curlyCount++; } "}" { - *pCopyCurlyGString+=*yytext; - if (--curlyCount<0) - BEGIN(lastCurlyContext); + *g_pCopyCurlyGString+=*yytext; + if (--g_curlyCount<0) + BEGIN(g_lastCurlyContext); } -{CHARLIT} { if (insidePHP) +{CHARLIT} { if (g_insidePHP) { REJECT; } else { - *pCopyCurlyGString+=yytext; + *g_pCopyCurlyGString+=yytext; } } [^"'{}\/\n,]+ { - *pCopyCurlyGString+=yytext; + *g_pCopyCurlyGString+=yytext; } [,]+ { - *pCopyCurlyGString+=yytext; + *g_pCopyCurlyGString+=yytext; } -"/" { *pCopyCurlyGString+=yytext; } +"/" { *g_pCopyCurlyGString+=yytext; } \n { lineCount(); - *pCopyCurlyGString+=*yytext; + *g_pCopyCurlyGString+=*yytext; } . { - *pCopyCurlyGString+=*yytext; + *g_pCopyCurlyGString+=*yytext; } /* ---------------------- */ ":" { - if (current->type.isEmpty() && - current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}' + if (g_current->type.isEmpty() && + g_current->name=="enum") // see bug 69041, C++11 style anon enum: 'enum : unsigned int {...}' { - current->section=Entry::ENUM_SEC; - current->name.resize(0); - current->args.resize(0); + g_current->section=Entry::ENUM_SEC; + g_current->name.resize(0); + g_current->args.resize(0); BEGIN(EnumBaseType); } else { - if (current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" + if (g_current->type.isEmpty()) // anonymous padding field, e.g. "int :7;" { addType(); - current->name.sprintf("__pad%d__",padCount++); + g_current->name.sprintf("__pad%d__",g_padCount++); } BEGIN(BitFields); - current->bitfields+=":"; + g_current->bitfields+=":"; } } . { - current->bitfields+=*yytext; + g_current->bitfields+=*yytext; } . { - current->args+=*yytext; + g_current->args+=*yytext; } \n { lineCount(); - current->args+=' '; + g_current->args+=' '; } [;,] { - QCString oldType = current->type; - if (current->bodyLine==-1) + QCString oldType = g_current->type; + if (g_current->bodyLine==-1) { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; } - if ( insidePHP && current->type.left(3) == "var" ) + if ( g_insidePHP && g_current->type.left(3) == "var" ) { - current->type = current->type.mid(3); + g_current->type = g_current->type.mid(3); } - if (isTypedef && current->type.left(8)!="typedef ") + if (g_isTypedef && g_current->type.left(8)!="typedef ") { - current->type.prepend("typedef "); + g_current->type.prepend("typedef "); } - bool stat = current->stat; - if (!current->name.isEmpty() && current->section!=Entry::ENUM_SEC) + bool stat = g_current->stat; + if (!g_current->name.isEmpty() && g_current->section!=Entry::ENUM_SEC) { - current->type=current->type.simplifyWhiteSpace(); - current->args=removeRedundantWhiteSpace(current->args); - current->name=current->name.stripWhiteSpace(); - if (current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;" + g_current->type=g_current->type.simplifyWhiteSpace(); + g_current->args=removeRedundantWhiteSpace(g_current->args); + g_current->name=g_current->name.stripWhiteSpace(); + if (g_current->section==Entry::CLASS_SEC) // remove spec for "struct Bla bla;" { - current->spec = 0; + g_current->spec = 0; } - current->section = Entry::VARIABLE_SEC ; - current->fileName = yyFileName; - current->startLine = yyBegLineNr; - current->startColumn = yyBegColNr; - current_root->moveToSubEntryAndRefresh( current ) ; + g_current->section = Entry::VARIABLE_SEC ; + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyBegLineNr; + g_current->startColumn = g_yyBegColNr; + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); } if ( *yytext == ',') { - current->stat = stat; // the static attribute holds for all variables - current->name.resize(0); - current->args.resize(0); - current->brief.resize(0); - current->doc.resize(0); - current->initializer.resize(0); - current->bitfields.resize(0); + g_current->stat = stat; // the static attribute holds for all variables + g_current->name.resize(0); + g_current->args.resize(0); + g_current->brief.resize(0); + g_current->doc.resize(0); + g_current->initializer.resize(0); + g_current->bitfields.resize(0); int i=oldType.length(); while (i>0 && (oldType[i-1]=='*' || oldType[i-1]=='&' || oldType[i-1]==' ')) i--; - current->type = oldType.left(i); + g_current->type = oldType.left(i); } else { - mtype = Method; - virt = Normal; - current->groups.clear(); + g_mtype = Method; + g_virt = Normal; + g_current->groups.clear(); initEntry(); } } "[" { - if (insideSlice) + if (g_insideSlice) { - squareCount=1; - lastSquareContext = YY_START; - current->metaData += "["; + g_squareCount=1; + g_lastSquareContext = YY_START; + g_current->metaData += "["; BEGIN( SliceMetadata ); } - else if (!insideCS && - (current->name.isEmpty() || - current->name=="typedef" + else if (!g_insideCS && + (g_current->name.isEmpty() || + g_current->name=="typedef" ) ) // IDL function property { - squareCount=1; - lastSquareContext = YY_START; - idlAttr.resize(0); - idlProp.resize(0); - current->mtype = mtype; + g_squareCount=1; + g_lastSquareContext = YY_START; + g_idlAttr.resize(0); + g_idlProp.resize(0); + g_current->mtype = g_mtype; if (Config_getBool(IDL_PROPERTY_SUPPORT) && - current->mtype == Property) - { // we are inside the properties section of a dispinterface - odlProp = true; - current->spec |= Entry::Gettable; - current->spec |= Entry::Settable; + g_current->mtype == Property) + { // we are g_inside the properties section of a dispinterface + g_odlProp = true; + g_current->spec |= Entry::Gettable; + g_current->spec |= Entry::Settable; } BEGIN( IDLAttribute ); } - else if (insideCS && - current->name.isEmpty()) + else if (g_insideCS && + g_current->name.isEmpty()) { - squareCount=1; - lastSquareContext = YY_START; + g_squareCount=1; + g_lastSquareContext = YY_START; // Skip the C# attribute // for this member - current->args.resize(0); + g_current->args.resize(0); BEGIN( SkipSquare ); } else { - current->args += yytext ; - squareCount=1; - externC=FALSE; // see bug759247 + g_current->args += yytext ; + g_squareCount=1; + g_externC=FALSE; // see bug759247 BEGIN( Array ) ; } } "[" { // Global metadata. - squareCount++; - current->metaData += "["; + g_squareCount++; + g_current->metaData += "["; } {BN}* { lineCount(); } \"[^\"]*\" { - current->metaData += yytext; + g_current->metaData += yytext; } "," { - current->metaData += yytext; + g_current->metaData += yytext; } "]" { - current->metaData += yytext; - if (--squareCount<=0) + g_current->metaData += yytext; + if (--g_squareCount<=0) { - BEGIN (lastSquareContext); + BEGIN (g_lastSquareContext); } } "(" { - current->type += "("; - roundCount++; + g_current->type += "("; + g_roundCount++; } [0-9]+ { - current->type += yytext; + g_current->type += yytext; } ")" { - current->type += ")"; - if(--roundCount<=0) + g_current->type += ")"; + if(--g_roundCount<=0) { - BEGIN (lastModifierContext); + BEGIN (g_lastModifierContext); } } "]" { // end of IDL function attribute - if (--squareCount<=0) + if (--g_squareCount<=0) { lineCount(); - if (current->mtype == Property) + if (g_current->mtype == Property) BEGIN( IDLPropName ); else - BEGIN( lastSquareContext ); + BEGIN( g_lastSquareContext ); } } "propput" { if (Config_getBool(IDL_PROPERTY_SUPPORT)) { - current->mtype = Property; + g_current->mtype = Property; } - current->spec |= Entry::Settable; + g_current->spec |= Entry::Settable; } "propget" { if (Config_getBool(IDL_PROPERTY_SUPPORT)) { - current->mtype = Property; + g_current->mtype = Property; } - current->spec |= Entry::Gettable; + g_current->spec |= Entry::Gettable; } "property" { // UNO IDL property - current->spec |= Entry::Property; + g_current->spec |= Entry::Property; } "attribute" { // UNO IDL attribute - current->spec |= Entry::Attribute; + g_current->spec |= Entry::Attribute; } "optional" { // on UNO IDL interface/service/attribute/property - current->spec |= Entry::Optional; + g_current->spec |= Entry::Optional; } "readonly" { // on UNO IDL attribute or property - if (Config_getBool(IDL_PROPERTY_SUPPORT) && odlProp) + if (Config_getBool(IDL_PROPERTY_SUPPORT) && g_odlProp) { - current->spec ^= Entry::Settable; + g_current->spec ^= Entry::Settable; } else { - current->spec |= Entry::Readonly; + g_current->spec |= Entry::Readonly; } } "bound" { // on UNO IDL attribute or property - current->spec |= Entry::Bound; + g_current->spec |= Entry::Bound; } "removable" { // on UNO IDL property - current->spec |= Entry::Removable; + g_current->spec |= Entry::Removable; } "constrained" { // on UNO IDL property - current->spec |= Entry::Constrained; + g_current->spec |= Entry::Constrained; } "transient" { // on UNO IDL property - current->spec |= Entry::Transient; + g_current->spec |= Entry::Transient; } "maybevoid" { // on UNO IDL property - current->spec |= Entry::MaybeVoid; + g_current->spec |= Entry::MaybeVoid; } "maybedefault" { // on UNO IDL property - current->spec |= Entry::MaybeDefault; + g_current->spec |= Entry::MaybeDefault; } "maybeambiguous" { // on UNO IDL property - current->spec |= Entry::MaybeAmbiguous; + g_current->spec |= Entry::MaybeAmbiguous; } . { } {BN}*{ID}{BN}* { // return type (probably HRESULT) - skip it - if (odlProp) + if (g_odlProp) { // property type - idlProp = yytext; + g_idlProp = yytext; } } {ID}{BN}*"(" { - current->name = yytext; - current->name = current->name.left(current->name.length()-1).stripWhiteSpace(); - current->startLine = yyLineNr; - current->startColumn = yyColNr; + g_current->name = yytext; + g_current->name = g_current->name.left(g_current->name.length()-1).stripWhiteSpace(); + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; BEGIN( IDLProp ); } {BN}*"("{BN}*{ID}{BN}*")"{BN}* { - if (odlProp) + if (g_odlProp) { - idlProp += yytext; + g_idlProp += yytext; } } {ID}{BN}*/";" { - if (odlProp) + if (g_odlProp) { - current->name = yytext; - idlProp = idlProp.stripWhiteSpace(); - odlProp = false; + g_current->name = yytext; + g_idlProp = g_idlProp.stripWhiteSpace(); + g_odlProp = false; BEGIN( IDLProp ); } } {BN}*"["[^\]]*"]"{BN}* { // attribute of a parameter - idlAttr = yytext; - idlAttr=idlAttr.stripWhiteSpace(); + g_idlAttr = yytext; + g_idlAttr=g_idlAttr.stripWhiteSpace(); } {ID} { // property type - idlProp = yytext; + g_idlProp = yytext; } {BN}*{ID}{BN}*"," { // Rare: Another parameter ([propput] HRESULT Item(int index, [in] Type theRealProperty);) - if (!current->args) - current->args = "("; + if (!g_current->args) + g_current->args = "("; else - current->args += ", "; - current->args += idlAttr; - current->args += " "; - current->args += idlProp; // prop was actually type of extra parameter - current->args += " "; - current->args += yytext; - current->args = current->args.left(current->args.length() - 1); // strip comma - idlProp.resize(0); - idlAttr.resize(0); + g_current->args += ", "; + g_current->args += g_idlAttr; + g_current->args += " "; + g_current->args += g_idlProp; // prop was actually type of extra parameter + g_current->args += " "; + g_current->args += yytext; + g_current->args = g_current->args.left(g_current->args.length() - 1); // strip comma + g_idlProp.resize(0); + g_idlAttr.resize(0); BEGIN( IDLProp ); } {BN}*{ID}{BN}*")"{BN}* { // the parameter name for the property - just skip. } ";" { - current->fileName = yyFileName; - current->type = idlProp; - current->args = current->args.simplifyWhiteSpace(); - if (current->args) - current->args += ")"; - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->fileName = g_yyFileName; + g_current->type = g_idlProp; + g_current->args = g_current->args.simplifyWhiteSpace(); + if (g_current->args) + g_current->args += ")"; + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); BEGIN( FindMembers ); } . { // spaces, *, or other stuff - //idlProp+=yytext; + //g_idlProp+=yytext; } -"]" { current->args += *yytext ; - if (--squareCount<=0) +"]" { g_current->args += *yytext ; + if (--g_squareCount<=0) BEGIN( FindMembers ) ; } -"]" { current->args += *yytext ; - if (--squareCount<=0) +"]" { g_current->args += *yytext ; + if (--g_squareCount<=0) BEGIN( Function ) ; } -"[" { current->args += *yytext ; - squareCount++; +"[" { g_current->args += *yytext ; + g_squareCount++; } -. { current->args += *yytext ; } -"[" { squareCount++; } +. { g_current->args += *yytext ; } +"[" { g_squareCount++; } "]" { - if (--squareCount<=0) - BEGIN( lastSquareContext ); + if (--g_squareCount<=0) + BEGIN( g_lastSquareContext ); } \" { - lastStringContext=YY_START; + g_lastStringContext=YY_START; BEGIN( SkipString ); } [^\n\[\]\"]+ "<" { addType(); - current->type += yytext ; + g_current->type += yytext ; BEGIN( Sharp ) ; } -">" { current->type += *yytext ; - if (--sharpCount<=0) +">" { g_current->type += *yytext ; + if (--g_sharpCount<=0) BEGIN( FindMembers ) ; } -"<" { current->type += *yytext ; - sharpCount++; +"<" { g_current->type += *yytext ; + g_sharpCount++; } {BN}+ { - current->type += ' '; + g_current->type += ' '; lineCount(); } -. { current->type += *yytext ; } +. { g_current->type += *yytext ; } {ID} { - if (insideCpp || insideObjC) + if (g_insideCpp || g_insideObjC) { - current->id = ClangParser::instance()->lookup(yyLineNr,yytext); + g_current->id = ClangParser::instance()->lookup(g_yyLineNr,yytext); } - current->bodyLine = yyLineNr; - current->name = yytext; + g_current->bodyLine = g_yyLineNr; + g_current->name = yytext; } "(" { // Java enum initializer unput('('); - lastInitializerContext = YY_START; - initBracketCount=0; - current->initializer = "="; + g_lastInitializerContext = YY_START; + g_initBracketCount=0; + g_current->initializer = "="; BEGIN(ReadInitializer); } "=" { - lastInitializerContext = YY_START; - initBracketCount=0; - current->initializer = yytext; + g_lastInitializerContext = YY_START; + g_initBracketCount=0; + g_current->initializer = yytext; BEGIN(ReadInitializer); } ";" { - if (insideJava) // last enum field in Java class + if (g_insideJava) // g_last enum field in Java class { - if (!current->name.isEmpty()) + if (!g_current->name.isEmpty()) { - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - if (!(current_root->spec&Entry::Enum)) + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + if (!(g_current_root->spec&Entry::Enum)) { - current->type = "@"; // enum marker + g_current->type = "@"; // enum marker } - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; - current_root->moveToSubEntryAndRefresh(current); + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); } @@ -3789,65 +3768,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) [^\n]* "," { //printf("adding '%s' '%s' '%s' to enum '%s' (mGrpId=%d)\n", - // current->type.data(), current->name.data(), - // current->args.data(), current_root->name.data(),current->mGrpId); - if (!current->name.isEmpty()) - { - current->fileName = yyFileName; - current->startLine = yyLineNr; - current->startColumn = yyColNr; - if (!(current_root->spec&Entry::Enum)) + // g_current->type.data(), g_current->name.data(), + // g_current->args.data(), g_current_root->name.data(),g_current->mGrpId); + if (!g_current->name.isEmpty()) + { + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyLineNr; + g_current->startColumn = g_yyColNr; + if (!(g_current_root->spec&Entry::Enum)) { - current->type = "@"; // enum marker + g_current->type = "@"; // enum marker } - current->args = current->args.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - current->section = Entry::VARIABLE_SEC; + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + g_current->section = Entry::VARIABLE_SEC; // add to the scope of the enum - if (!insideCS && !insideJava && - !(current_root->spec&Entry::Strong)) + if (!g_insideCS && !g_insideJava && + !(g_current_root->spec&Entry::Strong)) // for C# and Java 1.5+ enum values always have to be explicitly qualified, // same for C++11 style enums (enum class Name {}) { // add to the scope surrounding the enum (copy!) // we cannot during it directly as that would invalidate the iterator in parseCompounds. - //printf("*** adding outer scope entry for %s\n",current->name.data()); - g_outerScopeEntries.emplace_back(current_root->parent(), std::make_unique(*current)); + //printf("*** adding outer scope entry for %s\n",g_current->name.data()); + g_outerScopeEntries.emplace_back(g_current_root->parent(), std::make_unique(*g_current)); } - current_root->moveToSubEntryAndRefresh(current); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); } else // probably a redundant , { - current->reset(); + g_current->reset(); initEntry(); } } "[" { // attribute list in IDL - squareCount=1; - lastSquareContext = YY_START; + g_squareCount=1; + g_lastSquareContext = YY_START; BEGIN(SkipSquare); } /* "," { unput(*yytext); BEGIN(FindFields); } */ -[^\r\n\#{}"@'/<]* { current->program += yytext ; } -"//".* { current->program += yytext ; } -"#".* { if (!insidePHP) +[^\r\n\#{}"@'/<]* { g_current->program += yytext ; } +"//".* { g_current->program += yytext ; } +"#".* { if (!g_insidePHP) REJECT; // append PHP comment. - current->program += yytext ; + g_current->program += yytext ; } -@\" { current->program += yytext ; - pSkipVerbString = ¤t->program; - lastSkipVerbStringContext=YY_START; +@\" { g_current->program += yytext ; + g_pSkipVerbString = &g_current->program; + g_lastSkipVerbStringContext=YY_START; BEGIN( SkipVerbString ); } -"<<<" { if (insidePHP) +"<<<" { if (g_insidePHP) { - current->program += yytext ; - pCopyHereDocGString = ¤t->program; - lastHereDocContext=YY_START; + g_current->program += yytext ; + g_pCopyHereDocGString = &g_current->program; + g_lastHereDocContext=YY_START; BEGIN( CopyHereDoc ); } else @@ -3855,154 +3834,154 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) REJECT; } } -\" { current->program += yytext ; - pCopyQuotedGString = ¤t->program; - lastStringContext=YY_START; +\" { g_current->program += yytext ; + g_pCopyQuotedGString = &g_current->program; + g_lastStringContext=YY_START; BEGIN( CopyGString ); } -"/*"{B}* { current->program += yytext ; - lastContext = YY_START ; +"/*"{B}* { g_current->program += yytext ; + g_lastContext = YY_START ; BEGIN( Comment ) ; } -"/*"{BL} { current->program += yytext ; - ++yyLineNr ; - lastContext = YY_START ; +"/*"{BL} { g_current->program += yytext ; + ++g_yyLineNr ; + g_lastContext = YY_START ; BEGIN( Comment ) ; } "'" { - if (!insidePHP) + if (!g_insidePHP) { - current->program += yytext; + g_current->program += yytext; } else { // begin of single quoted string - current->program += yytext; - pCopyQuotedGString = ¤t->program; - lastStringContext=YY_START; + g_current->program += yytext; + g_pCopyQuotedGString = &g_current->program; + g_lastStringContext=YY_START; BEGIN(CopyPHPGString); } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; // for PHP code single quotes // are used for strings of arbitrary length } else { - current->program += yytext; + g_current->program += yytext; } } -"{" { current->program += yytext ; - ++curlyCount ; +"{" { g_current->program += yytext ; + ++g_curlyCount ; } "}" { - current->program += yytext ; - --curlyCount ; + g_current->program += yytext ; + --g_curlyCount ; } -"}" { //err("ReadBody count=%d\n",curlyCount); - if ( curlyCount>0 ) +"}" { //err("ReadBody count=%d\n",g_curlyCount); + if ( g_curlyCount>0 ) { - current->program += yytext ; - --curlyCount ; + g_current->program += yytext ; + --g_curlyCount ; } else { - current->endBodyLine = yyLineNr; - Entry * original_root = current_root; // save root this namespace is in - if (current->section == Entry::NAMESPACE_SEC && current->type == "namespace") + g_current->endBodyLine = g_yyLineNr; + Entry * original_root = g_current_root; // save root this namespace is in + if (g_current->section == Entry::NAMESPACE_SEC && g_current->type == "namespace") { int split_point; // save documentation values - QCString doc = current->doc; - int docLine = current->docLine; - QCString docFile = current->docFile; - QCString brief = current->brief; - int briefLine = current->briefLine; - QCString briefFile = current->briefFile; + QCString doc = g_current->doc; + int docLine = g_current->docLine; + QCString docFile = g_current->docFile; + QCString brief = g_current->brief; + int briefLine = g_current->briefLine; + QCString briefFile = g_current->briefFile; // reset documentation values - current->doc = ""; - current->docLine = 0; - current->docFile = ""; - current->brief = ""; - current->briefLine = 0; - current->briefFile = ""; - while ((split_point = current->name.find("::")) != -1) + g_current->doc = ""; + g_current->docLine = 0; + g_current->docFile = ""; + g_current->brief = ""; + g_current->briefLine = 0; + g_current->briefFile = ""; + while ((split_point = g_current->name.find("::")) != -1) { - std::unique_ptr new_current = std::make_unique(*current); - current->program = ""; - new_current->name = current->name.mid(split_point + 2); - current->name = current->name.left(split_point); - if (!current_root->name.isEmpty()) current->name.prepend(current_root->name+"::"); - - Entry *tmp = current.get(); - current_root->moveToSubEntryAndKeep(current); - current_root = tmp; - current.swap(new_current); + std::unique_ptr new_g_current = std::make_unique(*g_current); + g_current->program = ""; + new_g_current->name = g_current->name.mid(split_point + 2); + g_current->name = g_current->name.left(split_point); + if (!g_current_root->name.isEmpty()) g_current->name.prepend(g_current_root->name+"::"); + + Entry *tmp = g_current.get(); + g_current_root->moveToSubEntryAndKeep(g_current); + g_current_root = tmp; + g_current.swap(new_g_current); } // restore documentation values - current->doc = doc; - current->docLine = docLine; - current->docFile = docFile; - current->brief = brief; - current->briefLine = briefLine; - current->briefFile = briefFile; + g_current->doc = doc; + g_current->docLine = docLine; + g_current->docFile = docFile; + g_current->brief = brief; + g_current->briefLine = briefLine; + g_current->briefFile = briefFile; } - QCString &cn = current->name; - QCString rn = current_root->name.copy(); - //printf("cn='%s' rn='%s' isTypedef=%d\n",cn.data(),rn.data(),isTypedef); + QCString &cn = g_current->name; + QCString rn = g_current_root->name.copy(); + //printf("cn='%s' rn='%s' g_isTypedef=%d\n",cn.data(),rn.data(),g_isTypedef); if (!cn.isEmpty() && !rn.isEmpty()) { prependScope(); } - if (isTypedef && cn.isEmpty()) + if (g_isTypedef && cn.isEmpty()) { //printf("Typedef Name\n"); BEGIN( TypedefName ); } else { - if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum)) + if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) { - current->program+=','; // add field terminator + g_current->program+=','; // add field terminator } // add compound definition to the tree - current->args=removeRedundantWhiteSpace(current->args); - // was: current->args.simplifyWhiteSpace(); - current->type = current->type.simplifyWhiteSpace(); - current->name = current->name.stripWhiteSpace(); - //printf("adding '%s' '%s' '%s' brief=%s insideObjC=%d %x\n",current->type.data(),current->name.data(),current->args.data(),current->brief.data(),insideObjC,current->section); - if (insideObjC && - ((current->spec&Entry::Interface) || (current->spec==Entry::Category)) + g_current->args=removeRedundantWhiteSpace(g_current->args); + // was: g_current->args.simplifyWhiteSpace(); + g_current->type = g_current->type.simplifyWhiteSpace(); + g_current->name = g_current->name.stripWhiteSpace(); + //printf("adding '%s' '%s' '%s' brief=%s g_insideObjC=%d %x\n",g_current->type.data(),g_current->name.data(),g_current->args.data(),g_current->brief.data(),g_insideObjC,g_current->section); + if (g_insideObjC && + ((g_current->spec&Entry::Interface) || (g_current->spec==Entry::Category)) ) // method definition follows { BEGIN( ReadBodyIntf ) ; } else { - memspecEntry = current.get(); - current_root->copyToSubEntry( current ) ; - if (current->section==Entry::NAMESPACE_SEC || - (current->spec==Entry::Interface) || - insideJava || insidePHP || insideCS || insideD || insideJS || - insideSlice + g_memspecEntry = g_current.get(); + g_current_root->copyToSubEntry( g_current ) ; + if (g_current->section==Entry::NAMESPACE_SEC || + (g_current->spec==Entry::Interface) || + g_insideJava || g_insidePHP || g_insideCS || g_insideD || g_insideJS || + g_insideSlice ) { // namespaces and interfaces and java classes ends with a closing bracket without semicolon - current->reset(); - current_root = original_root; // restore scope from before namespace descent + g_current->reset(); + g_current_root = original_root; // restore scope from before namespace descent initEntry(); - memspecEntry = 0; + g_memspecEntry = 0; BEGIN( FindMembers ) ; } else { static QRegExp re("@[0-9]+$"); - if (!isTypedef && memspecEntry && - memspecEntry->name.find(re)==-1) // not typedef or anonymous type (see bug691071) + if (!g_isTypedef && g_memspecEntry && + g_memspecEntry->name.find(re)==-1) // not typedef or anonymous type (see bug691071) { // enabled the next two lines for bug 623424 - current->doc.resize(0); - current->brief.resize(0); + g_current->doc.resize(0); + g_current->brief.resize(0); } BEGIN( MemberSpec ) ; } @@ -4010,19 +3989,19 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } } -"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",curlyCount); +"}"{BN}+"typedef"{BN}+ { //err("ReadBody count=%d\n",g_curlyCount); lineCount(); - if ( curlyCount>0 ) + if ( g_curlyCount>0 ) { - current->program += yytext ; - --curlyCount ; + g_current->program += yytext ; + --g_curlyCount ; } else { - isTypedef = TRUE; - current->endBodyLine = yyLineNr; - QCString &cn = current->name; - QCString rn = current_root->name.copy(); + g_isTypedef = TRUE; + g_current->endBodyLine = g_yyLineNr; + QCString &cn = g_current->name; + QCString rn = g_current_root->name.copy(); if (!cn.isEmpty() && !rn.isEmpty()) { prependScope(); @@ -4032,38 +4011,38 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ("const"|"volatile"){BN} { // late "const" or "volatile" keyword lineCount(); - current->type.prepend(yytext); + g_current->type.prepend(yytext); } {ID} { - if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum)) + if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) { - current->program+=","; // add field terminator + g_current->program+=","; // add field terminator } - current->name=yytext; + g_current->name=yytext; prependScope(); - current->args = current->args.simplifyWhiteSpace(); - current->type = current->type.simplifyWhiteSpace(); - //printf("Adding compound %s %s %s\n",current->type.data(),current->name.data(),current->args.data()); - if (!firstTypedefEntry) + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->type = g_current->type.simplifyWhiteSpace(); + //printf("Adding compound %s %s %s\n",g_current->type.data(),g_current->name.data(),g_current->args.data()); + if (!g_firstTypedefEntry) { - firstTypedefEntry = current.get(); + g_firstTypedefEntry = g_current.get(); } - current_root->moveToSubEntryAndRefresh( current ) ; + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); - isTypedef=TRUE; // to undo reset by initEntry() + g_isTypedef=TRUE; // to undo reset by initEntry() BEGIN(MemberSpecSkip); } ";" { /* typedef of anonymous type */ - current->name.sprintf("@%d",anonCount++); - if ((current->section == Entry::ENUM_SEC) || (current->spec&Entry::Enum)) + g_current->name.sprintf("@%d",g_anonCount++); + if ((g_current->section == Entry::ENUM_SEC) || (g_current->spec&Entry::Enum)) { - current->program+=','; // add field terminator + g_current->program+=','; // add field terminator } // add compound definition to the tree - current->args = current->args.simplifyWhiteSpace(); - current->type = current->type.simplifyWhiteSpace(); - memspecEntry = current.get(); - current_root->moveToSubEntryAndRefresh( current ) ; + g_current->args = g_current->args.simplifyWhiteSpace(); + g_current->type = g_current->type.simplifyWhiteSpace(); + g_memspecEntry = g_current.get(); + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); unput(';'); BEGIN( MemberSpec ) ; @@ -4072,51 +4051,51 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(); int i=0,l=(int)yyleng,j; while (ispec&Entry::Struct) + if (g_firstTypedefEntry->spec&Entry::Struct) { - msType.prepend("struct "+firstTypedefEntry->name); + g_msType.prepend("struct "+g_firstTypedefEntry->name); } - else if (firstTypedefEntry->spec&Entry::Union) + else if (g_firstTypedefEntry->spec&Entry::Union) { - msType.prepend("union "+firstTypedefEntry->name); + g_msType.prepend("union "+g_firstTypedefEntry->name); } - else if (firstTypedefEntry->section==Entry::ENUM_SEC) + else if (g_firstTypedefEntry->section==Entry::ENUM_SEC) { - msType.prepend("enum "+firstTypedefEntry->name); + g_msType.prepend("enum "+g_firstTypedefEntry->name); } else { - msType.prepend(firstTypedefEntry->name); + g_msType.prepend(g_firstTypedefEntry->name); } } } "(" { // function with struct return type addType(); - current->name = msName; - current->spec = 0; + g_current->name = g_msName; + g_current->spec = 0; unput('('); BEGIN(FindMembers); } [,;] { - if (msName.isEmpty() && !current->name.isEmpty()) + if (g_msName.isEmpty() && !g_current->name.isEmpty()) { - // see if the compound does not have a name or is inside another + // see if the compound does not have a name or is g_inside another // anonymous compound. If so we insert a // special 'anonymous' variable. - //Entry *p=current_root; - const Entry *p=current.get(); + //Entry *p=g_current_root; + const Entry *p=g_current.get(); while (p) { // only look for class scopes, not namespace scopes @@ -4127,164 +4106,164 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) int pi = (i==-1) ? 0 : i+2; if (p->name.at(pi)=='@') { - // anonymous compound inside -> insert dummy variable name + // anonymous compound g_inside -> insert dummy variable name //printf("Adding anonymous variable for scope %s\n",p->name.data()); - msName.sprintf("@%d",anonCount++); + g_msName.sprintf("@%d",g_anonCount++); break; } } //p=p->parent; - if (p==current.get()) p=current_root; else p=p->parent(); + if (p==g_current.get()) p=g_current_root; else p=p->parent(); } } - //printf("msName=%s current->name=%s\n",msName.data(),current->name.data()); - if (!msName.isEmpty() - /*&& msName!=current->name*/) // skip typedef T {} T;, removed due to bug608493 + //printf("g_msName=%s g_current->name=%s\n",g_msName.data(),g_current->name.data()); + if (!g_msName.isEmpty() + /*&& g_msName!=g_current->name*/) // skip typedef T {} T;, removed due to bug608493 { static bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT); // case 1: typedef struct _S { ... } S_t; // -> omit typedef and use S_t as the struct name if (typedefHidesStruct && - isTypedef && - ((current->spec&(Entry::Struct|Entry::Union)) || - current->section==Entry::ENUM_SEC )&& - msType.stripWhiteSpace().isEmpty() && - memspecEntry) + g_isTypedef && + ((g_current->spec&(Entry::Struct|Entry::Union)) || + g_current->section==Entry::ENUM_SEC )&& + g_msType.stripWhiteSpace().isEmpty() && + g_memspecEntry) { - memspecEntry->name=msName; + g_memspecEntry->name=g_msName; } else // case 2: create a typedef field { std::unique_ptr varEntry=std::make_unique(); - varEntry->lang = language; - varEntry->protection = current->protection ; - varEntry->mtype = current->mtype; - varEntry->virt = current->virt; - varEntry->stat = current->stat; + varEntry->lang = g_language; + varEntry->protection = g_current->protection ; + varEntry->mtype = g_current->mtype; + varEntry->virt = g_current->virt; + varEntry->stat = g_current->stat; varEntry->section = Entry::VARIABLE_SEC; - varEntry->name = msName.stripWhiteSpace(); - varEntry->type = current->type.simplifyWhiteSpace()+" "; - varEntry->args = msArgs; - if (isTypedef) + varEntry->name = g_msName.stripWhiteSpace(); + varEntry->type = g_current->type.simplifyWhiteSpace()+" "; + varEntry->args = g_msArgs; + if (g_isTypedef) { varEntry->type.prepend("typedef "); - // //printf("current->name = %s %s\n",current->name.data(),msName.data()); + // //printf("g_current->name = %s %s\n",g_current->name.data(),g_msName.data()); } if (typedefHidesStruct && - isTypedef && - (current->spec&(Entry::Struct|Entry::Union)) && - memspecEntry + g_isTypedef && + (g_current->spec&(Entry::Struct|Entry::Union)) && + g_memspecEntry ) // case 1: use S_t as type for pS_t in "typedef struct _S {} S_t, *pS_t;" { - varEntry->type+=memspecEntry->name+msType; + varEntry->type+=g_memspecEntry->name+g_msType; } else // case 2: use _S as type for for pS_t { - varEntry->type+=current->name+msType; + varEntry->type+=g_current->name+g_msType; } - varEntry->fileName = yyFileName; - varEntry->startLine = yyLineNr; - varEntry->startColumn = yyColNr; - varEntry->doc = current->doc.copy(); - varEntry->brief = current->brief.copy(); - varEntry->mGrpId = current->mGrpId; - varEntry->initializer = current->initializer; - varEntry->groups = current->groups; - varEntry->sli = current->sli; + varEntry->fileName = g_yyFileName; + varEntry->startLine = g_yyLineNr; + varEntry->startColumn = g_yyColNr; + varEntry->doc = g_current->doc.copy(); + varEntry->brief = g_current->brief.copy(); + varEntry->mGrpId = g_current->mGrpId; + varEntry->initializer = g_current->initializer; + varEntry->groups = g_current->groups; + varEntry->sli = g_current->sli; //printf("Add: type='%s',name='%s',args='%s' brief=%s doc=%s\n", // varEntry->type.data(),varEntry->name.data(), // varEntry->args.data(),varEntry->brief.data(),varEntry->doc.data()); - current_root->moveToSubEntryAndKeep(varEntry); + g_current_root->moveToSubEntryAndKeep(varEntry); } } if (*yytext==';') // end of a struct/class ... { - if (!isTypedef && msName.isEmpty() && memspecEntry && (current->section&Entry::COMPOUND_MASK)) + if (!g_isTypedef && g_msName.isEmpty() && g_memspecEntry && (g_current->section&Entry::COMPOUND_MASK)) { // case where a class/struct has a doc block after it - if (!current->doc.isEmpty()) + if (!g_current->doc.isEmpty()) { - memspecEntry->doc += current->doc; + g_memspecEntry->doc += g_current->doc; } - if (!current->brief.isEmpty()) + if (!g_current->brief.isEmpty()) { - memspecEntry->brief += current->brief; + g_memspecEntry->brief += g_current->brief; } } - msType.resize(0); - msName.resize(0); - msArgs.resize(0); - isTypedef=FALSE; - firstTypedefEntry=0; - memspecEntry=0; - current->reset(); + g_msType.resize(0); + g_msName.resize(0); + g_msArgs.resize(0); + g_isTypedef=FALSE; + g_firstTypedefEntry=0; + g_memspecEntry=0; + g_current->reset(); initEntry(); BEGIN( FindMembers ); } else { - current->doc.resize(0); - current->brief.resize(0); + g_current->doc.resize(0); + g_current->brief.resize(0); } } "=" { - lastInitializerContext=YY_START; - initBracketCount=0; - current->initializer = yytext; + g_lastInitializerContext=YY_START; + g_initBracketCount=0; + g_current->initializer = yytext; BEGIN(ReadInitializer); /* BEGIN(MemberSpecSkip); */ } /* "{" { - curlyCount=0; - lastCurlyContext = MemberSpecSkip; - previous = current; + g_curlyCount=0; + g_lastCurlyContext = MemberSpecSkip; + g_previous = g_current; BEGIN(SkipCurly); } */ "," { BEGIN(MemberSpec); } ";" { unput(';'); BEGIN(MemberSpec); } -{BN}{1,80} { current->program += yytext ; +{BN}{1,80} { g_current->program += yytext ; lineCount() ; } "@end"/[^a-z_A-Z0-9] { // end of Objective C block - current_root->moveToSubEntryAndRefresh( current ) ; + g_current_root->moveToSubEntryAndRefresh( g_current ) ; initEntry(); - language = current->lang = SrcLangExt_Cpp; // see bug746361 - insideObjC=FALSE; + g_language = g_current->lang = SrcLangExt_Cpp; // see bug746361 + g_insideObjC=FALSE; BEGIN( FindMembers ); } -. { current->program += yytext ; } +. { g_current->program += yytext ; } "("/{BN}*"::"*{BN}*({TSCOPE}{BN}*"::")*{TSCOPE}{BN}*")"{BN}*"(" | /* typedef void (A::func_t)(args...) */ ("("({BN}*"::"*{BN}*{TSCOPE}{BN}*"::")*({BN}*[*&\^]{BN}*)+)+ { /* typedef void (A::*ptr_t)(args...) or int (*func(int))[], the ^ is for Obj-C blocks */ - if (insidePHP) // reference parameter + if (g_insidePHP) // reference parameter { REJECT } else { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; lineCount(); addType(); - funcPtrType=yytext; - roundCount=0; - //current->type += yytext; + g_funcPtrType=yytext; + g_roundCount=0; + //g_current->type += yytext; BEGIN( FuncPtr ); } } {SCOPENAME} { - current->name = yytext; - if (nameIsOperator(current->name)) + g_current->name = yytext; + if (nameIsOperator(g_current->name)) { BEGIN( FuncPtrOperator ); } else { - if (current->name=="const" || current->name=="volatile") + if (g_current->name=="const" || g_current->name=="volatile") { - funcPtrType += current->name; + g_funcPtrType += g_current->name; } else { @@ -4293,65 +4272,65 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } . { - //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,yyLineNr,yyFileName); + //printf("error: FuncPtr '%c' unexpected at line %d of %s\n",*yytext,g_yyLineNr,g_yyFileName); } "("{BN}*")"{BN}*/"(" { - current->name += yytext; - current->name = current->name.simplifyWhiteSpace(); + g_current->name += yytext; + g_current->name = g_current->name.simplifyWhiteSpace(); lineCount(); } \n { lineCount(); - current->name += *yytext; + g_current->name += *yytext; } "(" { unput(*yytext); BEGIN( EndFuncPtr ); } . { - current->name += *yytext; + g_current->name += *yytext; } ")"{BN}*/";" { // a variable with extra braces lineCount(); - current->type+=funcPtrType.data()+1; + g_current->type+=g_funcPtrType.data()+1; BEGIN(FindMembers); } ")"{BN}*/"(" { // a function pointer lineCount(); - current->type+=funcPtrType+")"; + g_current->type+=g_funcPtrType+")"; BEGIN(FindMembers); } ")"{BN}*/"[" { // an array of variables lineCount(); - current->type+=funcPtrType.data(); - current->args += ")"; + g_current->type+=g_funcPtrType.data(); + g_current->args += ")"; BEGIN(FindMembers); } "(" { // a function returning a function or // a function returning a pointer to an array - current->args += *yytext ; - //roundCount=0; + g_current->args += *yytext ; + //g_roundCount=0; //BEGIN( FuncFunc ); - current->bodyLine = yyLineNr; - currentArgumentContext = FuncFuncEnd; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = FuncFuncEnd; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; } "["[^\n\]]*"]" { - funcPtrType+=yytext; + g_funcPtrType+=yytext; } ")" { BEGIN(FindMembers); } "(" { - current->args += *yytext ; - ++roundCount; + g_current->args += *yytext ; + ++g_roundCount; } ")" { - current->args += *yytext ; - if ( roundCount ) - --roundCount; + g_current->args += *yytext ; + if ( g_roundCount ) + --g_roundCount; else { BEGIN(FuncFuncEnd); @@ -4359,53 +4338,53 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } ")"{BN}*"(" { lineCount(); - current->type+=funcPtrType+")("; + g_current->type+=g_funcPtrType+")("; BEGIN(FuncFuncType); } ")"{BN}*/[;{] { lineCount(); - current->type+=funcPtrType.data()+1; + g_current->type+=g_funcPtrType.data()+1; BEGIN(Function); } ")"{BN}*/"[" { // function returning a pointer to an array lineCount(); - current->type+=funcPtrType; - current->args+=")"; + g_current->type+=g_funcPtrType; + g_current->args+=")"; BEGIN(FuncFuncArray); } . { - current->args += *yytext; + g_current->args += *yytext; } "(" { - current->type += *yytext; - roundCount++; + g_current->type += *yytext; + g_roundCount++; } ")" { - current->type += *yytext; - if (roundCount) - --roundCount; + g_current->type += *yytext; + if (g_roundCount) + --g_roundCount; else BEGIN(Function); } -{BN}*","{BN}* { lineCount() ; current->type += ", " ; } -{BN}+ { lineCount() ; current->type += ' ' ; } +{BN}*","{BN}* { lineCount() ; g_current->type += ", " ; } +{BN}+ { lineCount() ; g_current->type += ' ' ; } . { - current->type += *yytext; + g_current->type += *yytext; } "("/{BN}*{ID}{BN}*"*"{BN}*{ID}*")"{BN}*"(" { // for catching typedef void (__stdcall *f)() like definitions - if (current->type.left(7)=="typedef" && current->bodyLine==-1) + if (g_current->type.left(7)=="typedef" && g_current->bodyLine==-1) // the bodyLine check is to prevent this guard to be true more than once { - current->bodyLine = yyLineNr; + g_current->bodyLine = g_yyLineNr; BEGIN( GetCallType ); } - else if (!current->name.isEmpty()) // normal function + else if (!g_current->name.isEmpty()) // normal function { - current->args = yytext; - current->bodyLine = yyLineNr; - currentArgumentContext = FuncQual; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->args = yytext; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = FuncQual; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; //printf(">>> Read function arguments!\n"); } @@ -4413,93 +4392,93 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) {BN}*{ID}{BN}*"*" { lineCount(); addType(); - funcPtrType="("; - funcPtrType+=yytext; - roundCount=0; + g_funcPtrType="("; + g_funcPtrType+=yytext; + g_roundCount=0; BEGIN( FuncPtr ); } "(" { - if (!current->name.isEmpty()) + if (!g_current->name.isEmpty()) { - current->args = yytext; - current->bodyLine = yyLineNr; - currentArgumentContext = FuncQual; - fullArgString=current->args.copy(); - copyArgString=¤t->args; + g_current->args = yytext; + g_current->bodyLine = g_yyLineNr; + g_currentArgumentContext = FuncQual; + g_fullArgString=g_current->args.copy(); + g_copyArgString=&g_current->args; BEGIN( ReadFuncArgType ) ; - //printf(">>> Read function arguments current->argList.size()=%d\n",current->argList.size()); + //printf(">>> Read function arguments g_current->argList.size()=%d\n",g_current->argList.size()); } } /* "("{BN}*("void"{BN}*)?")" { lineCount(); - current->args = "()"; + g_current->args = "()"; BEGIN( FuncQual ); } */ /*- Function argument reading rules ---------------------------------------*/ -[^ \/\r\t\n\)\(\"\'#]+ { *copyArgString+=yytext; - fullArgString+=yytext; +[^ \/\r\t\n\)\(\"\'#]+ { *g_copyArgString+=yytext; + g_fullArgString+=yytext; } -[^\n\\\"\']+ { *copyArgString+=yytext; - fullArgString+=yytext; +[^\n\\\"\']+ { *g_copyArgString+=yytext; + g_fullArgString+=yytext; } [^\/\n\)\(\"\']+ { - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } {BN}* { - *copyArgString+=" "; - fullArgString+=" "; + *g_copyArgString+=" "; + g_fullArgString+=" "; lineCount(); } {RAWBEGIN} { g_delimiter = yytext+2; g_delimiter=g_delimiter.left(g_delimiter.length()-1); - lastRawStringContext = YY_START; - pCopyRawString = copyArgString; - *pCopyRawString+=yytext; - fullArgString+=yytext; + g_lastRawStringContext = YY_START; + g_pCopyRawString = g_copyArgString; + *g_pCopyRawString+=yytext; + g_fullArgString+=yytext; BEGIN(RawString); } \" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - lastCopyArgStringContext = YY_START; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_lastCopyArgStringContext = YY_START; BEGIN( CopyArgString ); } "(" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argRoundCount=0; - lastCopyArgContext = YY_START; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argRoundCount=0; + g_lastCopyArgContext = YY_START; BEGIN( CopyArgRound ); } ")" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - stringToArgumentList(fullArgString,current->argList); - if (insideJS) + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + stringToArgumentList(g_fullArgString,g_current->argList); + if (g_insideJS) { - fixArgumentListForJavaScript(current->argList); + fixArgumentListForJavaScript(g_current->argList); } - handleParametersCommentBlocks(current->argList); + handleParametersCommentBlocks(g_current->argList); - /* remember the current documentation block, since + /* remember the g_current documentation block, since we could overwrite it with the documentation of a function argument, which we then have to correct later on */ - docBackup = current->doc; - briefBackup = current->brief; + g_docBackup = g_current->doc; + g_briefBackup = g_current->brief; - BEGIN( currentArgumentContext ); + BEGIN( g_currentArgumentContext ); } /* a special comment */ ("/*"[*!]|"//"[/!])("<"?) { - if (currentArgumentContext==DefineEnd) + if (g_currentArgumentContext==DefineEnd) { // for defines we interpret a comment // as documentation for the define @@ -4507,17 +4486,17 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { unput(yytext[i]); } - stringToArgumentList(fullArgString,current->argList); - handleParametersCommentBlocks(current->argList); - BEGIN( currentArgumentContext ); + stringToArgumentList(g_fullArgString,g_current->argList); + handleParametersCommentBlocks(g_current->argList); + BEGIN( g_currentArgumentContext ); } else // not a define { // for functions we interpret a comment // as documentation for the argument - fullArgString+=yytext; - lastCopyArgChar=0; - lastCommentInArgContext=YY_START; + g_fullArgString+=yytext; + g_lastCopyArgChar=0; + g_lastCommentInArgContext=YY_START; if (yytext[1]=='/') BEGIN( CopyArgCommentLine ); else @@ -4527,30 +4506,30 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /* a non-special comment */ "/**/" { /* empty comment */ } "/*" { - lastCContext = YY_START; + g_lastCContext = YY_START; BEGIN( SkipComment ); } "//" { - lastCContext = YY_START; + g_lastCContext = YY_START; BEGIN( SkipCxxComment ); } /* -"'#" { if (insidePHP) +"'#" { if (g_insidePHP) REJECT; - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } "#" { - if (!insidePHP) + if (!g_insidePHP) REJECT; - lastCContext = YY_START; + g_lastCContext = YY_START; BEGIN( SkipCxxComment ); } */ /* ')' followed by a special comment */ ")"{BN}*("/*"[*!]|"//"[/!])"<" { lineCount(); - if (currentArgumentContext==DefineEnd) + if (g_currentArgumentContext==DefineEnd) { // for defines we interpret a comment // as documentation for the define @@ -4558,21 +4537,21 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { unput(yytext[i]); } - *copyArgString+=*yytext; - fullArgString+=*yytext; - stringToArgumentList(fullArgString,current->argList); - handleParametersCommentBlocks(current->argList); - BEGIN( currentArgumentContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + stringToArgumentList(g_fullArgString,g_current->argList); + handleParametersCommentBlocks(g_current->argList); + BEGIN( g_currentArgumentContext ); } else { // for functions we interpret a comment - // as documentation for the last argument - lastCopyArgChar=*yytext; + // as documentation for the g_last argument + g_lastCopyArgChar=*yytext; QCString text=&yytext[1]; text=text.stripWhiteSpace(); - lastCommentInArgContext=YY_START; - fullArgString+=text; + g_lastCommentInArgContext=YY_START; + g_fullArgString+=text; if (text.find("//")!=-1) BEGIN( CopyArgCommentLine ); else @@ -4580,152 +4559,152 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } ^{B}*"*"+/{BN}+ -[^\n\\\@\*]+ { fullArgString+=yytext; } -"*/" { fullArgString+=yytext; - if (lastCopyArgChar!=0) - unput(lastCopyArgChar); - BEGIN( lastCommentInArgContext ); +[^\n\\\@\*]+ { g_fullArgString+=yytext; } +"*/" { g_fullArgString+=yytext; + if (g_lastCopyArgChar!=0) + unput(g_lastCopyArgChar); + BEGIN( g_lastCommentInArgContext ); } -\n { fullArgString+=yytext; +\n { g_fullArgString+=yytext; lineCount(); - if (lastCopyArgChar!=0) - unput(lastCopyArgChar); - BEGIN( lastCommentInArgContext ); + if (g_lastCopyArgChar!=0) + unput(g_lastCopyArgChar); + BEGIN( g_lastCommentInArgContext ); } {CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9\-] { // verbatim command (which could contain nested comments!) - docBlockName=&yytext[1]; - fullArgString+=yytext; + g_docBlockName=&yytext[1]; + g_fullArgString+=yytext; BEGIN(CopyArgVerbatim); } {CMD}("f$"|"f["|"f{") { - docBlockName=&yytext[1]; - if (docBlockName.at(1)=='[') + g_docBlockName=&yytext[1]; + if (g_docBlockName.at(1)=='[') { - docBlockName.at(1)='}'; + g_docBlockName.at(1)='}'; } - if (docBlockName.at(1)=='{') + if (g_docBlockName.at(1)=='{') { - docBlockName.at(1)='}'; + g_docBlockName.at(1)='}'; } - fullArgString+=yytext; + g_fullArgString+=yytext; BEGIN(CopyArgVerbatim); } [\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endmanonly"|"enddot"|"endcode"|"f$"|"f]"|"f}")/[^a-z_A-Z0-9\-] { // end of verbatim block - fullArgString+=yytext; + g_fullArgString+=yytext; if (yytext[1]=='f') // end of formula { BEGIN(CopyArgCommentLine); } - if (&yytext[4]==docBlockName) + if (&yytext[4]==g_docBlockName) { BEGIN(CopyArgCommentLine); } } -[^\\\@\n]+ { fullArgString+=yytext; } -. { fullArgString+=*yytext; } -\n { fullArgString+=*yytext; lineCount(); } -. { fullArgString+=*yytext; } +[^\\\@\n]+ { g_fullArgString+=yytext; } +. { g_fullArgString+=*yytext; } +\n { g_fullArgString+=*yytext; lineCount(); } +. { g_fullArgString+=*yytext; } {CMD}("brief"|"short"){B}+ { - warn(yyFileName,yyLineNr, - "Ignoring %cbrief command inside argument documentation",*yytext + warn(g_yyFileName,g_yyLineNr, + "Ignoring %cbrief command g_inside argument documentation",*yytext ); - fullArgString+=' '; + g_fullArgString+=' '; } "<" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argSharpCount=1; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argSharpCount=1; BEGIN( CopyArgSharp ); } ">" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - //printf("end template list '%s'\n",copyArgString->data()); - stringToArgumentList(fullArgString,*currentArgumentList); - BEGIN( currentArgumentContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + //printf("end template list '%s'\n",g_copyArgString->data()); + stringToArgumentList(g_fullArgString,*g_currentArgumentList); + BEGIN( g_currentArgumentContext ); } "(" { - argRoundCount++; - *copyArgString+=*yytext; - fullArgString+=*yytext; + g_argRoundCount++; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } ")" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - if (argRoundCount>0) - argRoundCount--; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + if (g_argRoundCount>0) + g_argRoundCount--; else - BEGIN( lastCopyArgContext ); + BEGIN( g_lastCopyArgContext ); } "(" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argRoundCount=0; - lastCopyArgContext = YY_START; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argRoundCount=0; + g_lastCopyArgContext = YY_START; BEGIN( CopyArgRound ); } "<" { - argSharpCount++; - //printf("argSharpCount++=%d copy\n",argSharpCount); - *copyArgString+=*yytext; - fullArgString+=*yytext; + g_argSharpCount++; + //printf("g_argSharpCount++=%d copy\n",g_argSharpCount); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } ">" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - argSharpCount--; - if (argSharpCount>0) + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + g_argSharpCount--; + if (g_argSharpCount>0) { - //printf("argSharpCount--=%d copy\n",argSharpCount); + //printf("g_argSharpCount--=%d copy\n",g_argSharpCount); } else { BEGIN( ReadTempArgs ); - //printf("end of argSharpCount\n"); + //printf("end of g_argSharpCount\n"); } } \\. { - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } \" { - *copyArgString+=*yytext; - fullArgString+=*yytext; - BEGIN( lastCopyArgStringContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + BEGIN( g_lastCopyArgStringContext ); } \' { - *copyArgString+=*yytext; - fullArgString+=*yytext; - BEGIN( lastCopyArgStringContext ); + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; + BEGIN( g_lastCopyArgStringContext ); } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - *copyArgString+=yytext; - fullArgString+=yytext; + *g_copyArgString+=yytext; + g_fullArgString+=yytext; } } \' { - *copyArgString+=yytext; - fullArgString+=yytext; - if (insidePHP) + *g_copyArgString+=yytext; + g_fullArgString+=yytext; + if (g_insidePHP) { - lastCopyArgStringContext=YY_START; + g_lastCopyArgStringContext=YY_START; BEGIN(CopyArgPHPString); } } \n { lineCount(); - *copyArgString+=*yytext; - fullArgString+=*yytext; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } . { - *copyArgString+=*yytext; - fullArgString+=*yytext; + *g_copyArgString+=*yytext; + g_fullArgString+=*yytext; } @@ -4733,28 +4712,28 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /*------------------------------------------------------------------------*/ -"(" { current->args += *yytext ; - ++roundCount ; +"(" { g_current->args += *yytext ; + ++g_roundCount ; } -")" { current->args += *yytext ; - if ( roundCount ) - --roundCount ; +")" { g_current->args += *yytext ; + if ( g_roundCount ) + --g_roundCount ; else BEGIN( FuncQual ) ; } /* -"#" { if (insidePHP) +"#" { if (g_insidePHP) REJECT; - lastCPPContext = YY_START; + g_lastCPPContext = YY_START; BEGIN(SkipCPP); } */ [{:;,] { if ( qstrcmp(yytext,";")==0 && - insidePHP && - !containsWord(current->type,"function") ) + g_insidePHP && + !containsWord(g_current->type,"function") ) { - current->reset(); + g_current->reset(); initEntry(); BEGIN( FindMembers ); } @@ -4765,88 +4744,88 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } {BN}*"abstract"{BN}* { // pure virtual member function lineCount() ; - current->virt = Pure; - current->args += " override "; + g_current->virt = Pure; + g_current->args += " override "; } {BN}*"override"{BN}* { // C++11 overridden virtual member function lineCount() ; - current->spec |= Entry::Override; - current->args += " override "; + g_current->spec |= Entry::Override; + g_current->args += " override "; BEGIN(FuncQual); } {BN}*"final"{BN}* { // C++11 final method lineCount() ; - current->spec |= Entry::Final; - current->args += " final "; + g_current->spec |= Entry::Final; + g_current->args += " final "; BEGIN(FuncQual); } {BN}*"sealed"{BN}* { // sealed member function lineCount() ; - current->spec |= Entry::Sealed; - current->args += " sealed "; + g_current->spec |= Entry::Sealed; + g_current->args += " sealed "; } {BN}*"new"{BN}* { // new member function lineCount() ; - current->spec |= Entry::New; - current->args += " new "; + g_current->spec |= Entry::New; + g_current->args += " new "; } {BN}*"const"{BN}* { // const member function lineCount() ; - current->args += " const "; - current->argList.constSpecifier=TRUE; + g_current->args += " const "; + g_current->argList.constSpecifier=TRUE; } {BN}*"volatile"{BN}* { // volatile member function lineCount() ; - current->args += " volatile "; - current->argList.volatileSpecifier=TRUE; + g_current->args += " volatile "; + g_current->argList.volatileSpecifier=TRUE; } {BN}*"noexcept"{BN}* { // noexcept qualifier lineCount() ; - current->args += " noexcept "; - current->spec |= Entry::NoExcept; + g_current->args += " noexcept "; + g_current->spec |= Entry::NoExcept; } {BN}*"noexcept"{BN}*"(" { // noexcept expression lineCount() ; - current->args += " noexcept("; - current->spec |= Entry::NoExcept; - lastRoundContext=FuncQual; - pCopyRoundString=¤t->args; - roundCount=0; + g_current->args += " noexcept("; + g_current->spec |= Entry::NoExcept; + g_lastRoundContext=FuncQual; + g_pCopyRoundString=&g_current->args; + g_roundCount=0; BEGIN(CopyRound); } {BN}*"&" { - current->args += " &"; - current->argList.refQualifier=RefQualifierLValue; + g_current->args += " &"; + g_current->argList.refQualifier=RefQualifierLValue; } {BN}*"&&" { - current->args += " &&"; - current->argList.refQualifier=RefQualifierRValue; + g_current->args += " &&"; + g_current->argList.refQualifier=RefQualifierRValue; } {BN}*"="{BN}*"0"{BN}* { // pure virtual member function lineCount() ; - current->args += " = 0"; - current->virt = Pure; - current->argList.pureSpecifier=TRUE; + g_current->args += " = 0"; + g_current->virt = Pure; + g_current->argList.pureSpecifier=TRUE; BEGIN(FuncQual); } {BN}*"="{BN}*"delete"{BN}* { // C++11 explicitly delete member lineCount(); - current->args += " = delete"; - current->spec |= Entry::Delete; - current->argList.isDeleted=TRUE; + g_current->args += " = delete"; + g_current->spec |= Entry::Delete; + g_current->argList.isDeleted=TRUE; BEGIN(FuncQual); } {BN}*"="{BN}*"default"{BN}* { // C++11 explicitly defaulted constructor/assignment operator lineCount(); - current->args += " = default"; - current->spec |= Entry::Default; + g_current->args += " = default"; + g_current->spec |= Entry::Default; BEGIN(FuncQual); } {BN}*"->"{BN}* { lineCount(); - current->argList.trailingReturnType = " -> "; - current->args += " -> "; + g_current->argList.trailingReturnType = " -> "; + g_current->args += " -> "; BEGIN(TrailingReturn); } [{;] { @@ -4854,30 +4833,30 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } . { - current->argList.trailingReturnType+=yytext; - current->args+=yytext; + g_current->argList.trailingReturnType+=yytext; + g_current->args+=yytext; } \n { lineCount(); - current->argList.trailingReturnType+=yytext; - current->args+=' '; + g_current->argList.trailingReturnType+=yytext; + g_current->args+=' '; } {BN}*","{BN}* { lineCount() ; - current->args += ", " ; + g_current->args += ", " ; } {BN}+ { lineCount() ; - current->args += ' ' ; + g_current->args += ' ' ; } -"#" { if (insidePHP) +"#" { if (g_insidePHP) REJECT; - lastCPPContext = YY_START; + g_lastCPPContext = YY_START; BEGIN(SkipCPP); } "=" { - if (insideCli && - (current_root->section&Entry::COMPOUND_MASK) + if (g_insideCli && + (g_current_root->section&Entry::COMPOUND_MASK) ) { BEGIN(CliOverride); @@ -4885,9 +4864,9 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { // typically an initialized function pointer - lastInitializerContext=YY_START; - initBracketCount=0; - current->initializer = yytext; + g_lastInitializerContext=YY_START; + g_initBracketCount=0; + g_current->initializer = yytext; BEGIN(ReadInitializer); } } @@ -4907,58 +4886,58 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN(FuncQual); } \" { - current->args += *yytext; - pCopyQuotedString=¤t->args; - lastStringContext=FuncPtrInit; + g_current->args += *yytext; + g_pCopyQuotedString=&g_current->args; + g_lastStringContext=FuncPtrInit; BEGIN(CopyString); } \' { - current->args += *yytext; - if (insidePHP) + g_current->args += *yytext; + if (g_insidePHP) { - pCopyQuotedString=¤t->args; - lastStringContext=FuncPtrInit; + g_pCopyQuotedString=&g_current->args; + g_lastStringContext=FuncPtrInit; BEGIN(CopyPHPString); } } {CHARLIT} { - if (insidePHP) + if (g_insidePHP) { REJECT; } else { - current->args += yytext; + g_current->args += yytext; } } {ID} { - current->args += yytext; + g_current->args += yytext; } . { - current->args += *yytext; + g_current->args += *yytext; } \n { - current->args += *yytext; + g_current->args += *yytext; lineCount(); } {ID} { // typically a K&R style C function - if (insideCS && qstrcmp(yytext,"where")==0) + if (g_insideCS && qstrcmp(yytext,"where")==0) { // type constraint for a method - current->typeConstr.clear(); - current->typeConstr.push_back(Argument()); - lastCSConstraint = YY_START; + g_current->typeConstr.clear(); + g_current->typeConstr.push_back(Argument()); + g_lastCSConstraint = YY_START; BEGIN( CSConstraintName ); } else if (checkForKnRstyleC()) { - current->args = yytext; - oldStyleArgType.resize(0); + g_current->args = yytext; + g_oldStyleArgType.resize(0); BEGIN(OldStyleArgs); } else { - current->args += yytext; + g_current->args += yytext; } } [,;] { @@ -4966,36 +4945,36 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) QCString oldStyleArgName; splitKnRArg(oldStyleArgPtr,oldStyleArgName); QCString doc,brief; - if (current->doc!=docBackup) + if (g_current->doc!=g_docBackup) { - doc=current->doc.copy(); - current->doc=docBackup; + doc=g_current->doc.copy(); + g_current->doc=g_docBackup; } - if (current->brief!=briefBackup) + if (g_current->brief!=g_briefBackup) { - brief=current->brief.copy(); - current->brief=briefBackup; + brief=g_current->brief.copy(); + g_current->brief=g_briefBackup; } - addKnRArgInfo(oldStyleArgType+oldStyleArgPtr, + addKnRArgInfo(g_oldStyleArgType+oldStyleArgPtr, oldStyleArgName,brief,doc); - current->args.resize(0); - if (*yytext==';') oldStyleArgType.resize(0); + g_current->args.resize(0); + if (*yytext==';') g_oldStyleArgType.resize(0); } -{ID} { current->args += yytext; } +{ID} { g_current->args += yytext; } "{" { - if (current->argList.empty()) + if (g_current->argList.empty()) { - current->argList.noParameters=TRUE; + g_current->argList.noParameters=TRUE; } - current->args = argListToString(current->argList); + g_current->args = argListToString(g_current->argList); unput('{'); BEGIN(FuncQual); } -. { current->args += *yytext; } -. { current->args += *yytext; } +. { g_current->args += *yytext; } +. { g_current->args += *yytext; } {BN}*"try:" | {BN}*"try"{BN}+ { /* try-function-block */ - insideTryBlock=TRUE; + g_insideTryBlock=TRUE; lineCount(); if (yytext[yyleng-1]==':') { @@ -5004,33 +4983,33 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } {BN}*"throw"{BN}*"(" { // C++ style throw clause - current->exception = " throw (" ; - roundCount=0; + g_current->exception = " throw (" ; + g_roundCount=0; lineCount() ; BEGIN( ExcpRound ) ; } {BN}*"raises"{BN}*"(" { - current->exception = " raises (" ; + g_current->exception = " raises (" ; lineCount() ; - roundCount=0; + g_roundCount=0; BEGIN( ExcpRound ) ; } {BN}*"throws"{BN}+ { // Java style throw clause - current->exception = " throws " ; + g_current->exception = " throws " ; lineCount() ; BEGIN( ExcpList ); } -"(" { current->exception += *yytext ; - ++roundCount ; +"(" { g_current->exception += *yytext ; + ++g_roundCount ; } -")" { current->exception += *yytext ; - if ( roundCount ) - --roundCount ; +")" { g_current->exception += *yytext ; + if ( g_roundCount ) + --g_roundCount ; else BEGIN( FuncQual ) ; } . { - current->exception += *yytext; + g_current->exception += *yytext; } "{" { unput('{'); BEGIN( FuncQual ); @@ -5039,101 +5018,101 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput(';'); BEGIN( FuncQual ); } "\n" { - current->exception += ' '; + g_current->exception += ' '; lineCount(); } . { - current->exception += *yytext; + g_current->exception += *yytext; } -"(" { current->type += current->name ; - current->name = current->args ; - current->args = yytext ; - roundCount=0; +"(" { g_current->type += g_current->name ; + g_current->name = g_current->args ; + g_current->args = yytext ; + g_roundCount=0; BEGIN( FuncRound ) ; } ":" { - if (!insidePHP) BEGIN(SkipInits); + if (!g_insidePHP) BEGIN(SkipInits); } [;{,] { - current->name=current->name.simplifyWhiteSpace(); - current->type=current->type.simplifyWhiteSpace(); - current->args=removeRedundantWhiteSpace(current->args); - // was: current->args.simplifyWhiteSpace(); - current->fileName = yyFileName; - current->startLine = yyBegLineNr; - current->startColumn = yyBegColNr; + g_current->name=g_current->name.simplifyWhiteSpace(); + g_current->type=g_current->type.simplifyWhiteSpace(); + g_current->args=removeRedundantWhiteSpace(g_current->args); + // was: g_current->args.simplifyWhiteSpace(); + g_current->fileName = g_yyFileName; + g_current->startLine = g_yyBegLineNr; + g_current->startColumn = g_yyBegColNr; static QRegExp re("([^)]*[*&][^)]*)"); // (...*...) - if (*yytext!=';' || (current_root->section&Entry::COMPOUND_MASK) ) + if (*yytext!=';' || (g_current_root->section&Entry::COMPOUND_MASK) ) { - int tempArg=current->name.find('<'); - int ts=current->type.find('<'); - int te=current->type.findRev('>'); - int ti=current->type.find(re,0); + int tempArg=g_current->name.find('<'); + int ts=g_current->type.find('<'); + int te=g_current->type.findRev('>'); + int ti=g_current->type.find(re,0); // bug677315: A get(); is not a function pointer bool isFunction = ti==-1 || // not a (...*...) pattern (ts!=-1 && tstype.data(),ts,te,ti,isFunction); + // g_current->type.data(),ts,te,ti,isFunction); QCString tempName; - if (tempArg==-1) tempName=current->name; else tempName=current->name.left(tempArg); - if (!current->type.isEmpty() && - (!isFunction || current->type.left(8)=="typedef ")) + if (tempArg==-1) tempName=g_current->name; else tempName=g_current->name.left(tempArg); + if (!g_current->type.isEmpty() && + (!isFunction || g_current->type.left(8)=="typedef ")) { - //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", current->type.data(),current->name.data(),current->args.data()); - if (isTypedef && current->type.left(8)!="typedef ") + //printf("Scanner.l: found in class variable: '%s' '%s' '%s'\n", g_current->type.data(),g_current->name.data(),g_current->args.data()); + if (g_isTypedef && g_current->type.left(8)!="typedef ") { - current->type.prepend("typedef "); + g_current->type.prepend("typedef "); } - current->section = Entry::VARIABLE_SEC ; + g_current->section = Entry::VARIABLE_SEC ; } else { - //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", current->type.data(),current->name.data(),current->args.data()); - current->section = Entry::FUNCTION_SEC ; - current->proto = *yytext==';'; + //printf("Scanner.l: found in class function: '%s' '%s' '%s'\n", g_current->type.data(),g_current->name.data(),g_current->args.data()); + g_current->section = Entry::FUNCTION_SEC ; + g_current->proto = *yytext==';'; } } else // a global function prototype or function variable { - //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",current->type.data(),current->name.data(),current->args.data()); - if (!current->type.isEmpty() && - (current->type.find(re,0)!=-1 || current->type.left(8)=="typedef ")) + //printf("Scanner.l: prototype? type='%s' name='%s' args='%s'\n",g_current->type.data(),g_current->name.data(),g_current->args.data()); + if (!g_current->type.isEmpty() && + (g_current->type.find(re,0)!=-1 || g_current->type.left(8)=="typedef ")) { - if (isTypedef && current->type.left(8)!="typedef ") + if (g_isTypedef && g_current->type.left(8)!="typedef ") { - current->type.prepend("typedef "); + g_current->type.prepend("typedef "); } //printf("Scanner.l: found function variable!\n"); - current->section = Entry::VARIABLE_SEC; + g_current->section = Entry::VARIABLE_SEC; } else { //printf("Scanner.l: found prototype\n"); - current->section = Entry::FUNCTION_SEC; - current->proto = TRUE; + g_current->section = Entry::FUNCTION_SEC; + g_current->proto = TRUE; } } - //printf("Adding entry '%s'\n",current->name.data()); - if ( insidePHP) + //printf("Adding entry '%s'\n",g_current->name.data()); + if ( g_insidePHP) { - if (findAndRemoveWord(current->type,"final")) + if (findAndRemoveWord(g_current->type,"final")) { - current->spec |= Entry::Final; + g_current->spec |= Entry::Final; } - if (findAndRemoveWord(current->type,"abstract")) + if (findAndRemoveWord(g_current->type,"abstract")) { - current->spec |= Entry::Abstract; + g_current->spec |= Entry::Abstract; } } - if ( insidePHP && !containsWord(current->type,"function")) + if ( g_insidePHP && !containsWord(g_current->type,"function")) { initEntry(); if ( *yytext == '{' ) { - lastCurlyContext = FindMembers; - curlyCount=0; + g_lastCurlyContext = FindMembers; + g_curlyCount=0; BEGIN( SkipCurly ); } else @@ -5143,66 +5122,66 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } else { - if ( insidePHP) + if ( g_insidePHP) { - findAndRemoveWord(current->type,"function"); + findAndRemoveWord(g_current->type,"function"); } - previous = current.get(); - current_root->moveToSubEntryAndRefresh(current); + g_previous = g_current.get(); + g_current_root->moveToSubEntryAndRefresh(g_current); initEntry(); // Objective C 2.0: Required/Optional section - if (previous->spec & (Entry::Optional | Entry::Required)) + if (g_previous->spec & (Entry::Optional | Entry::Required)) { - current->spec |= previous->spec & (Entry::Optional|Entry::Required); + g_current->spec |= g_previous->spec & (Entry::Optional|Entry::Required); } - lastCurlyContext = FindMembers; + g_lastCurlyContext = FindMembers; if ( *yytext == ',' ) { - current->type = previous->type; + g_current->type = g_previous->type; // we need to strip any trailing * and & (see bugs 623023 and 649103 for test cases) - int i=current->type.length(); - while (i>0 && (current->type[i-1]=='*' || current->type[i-1]=='&' || current->type[i-1]==' ')) i--; - current->type = current->type.left(i); + int i=g_current->type.length(); + while (i>0 && (g_current->type[i-1]=='*' || g_current->type[i-1]=='&' || g_current->type[i-1]==' ')) i--; + g_current->type = g_current->type.left(i); } if ( *yytext == '{' ) { - if ( !insidePHP && (current_root->section & Entry::COMPOUND_MASK) ) + if ( !g_insidePHP && (g_current_root->section & Entry::COMPOUND_MASK) ) { - previous->spec |= Entry::Inline; + g_previous->spec |= Entry::Inline; } //addToBody(yytext); - curlyCount=0; + g_curlyCount=0; BEGIN( SkipCurly ) ; } else { - if (previous->section!=Entry::VARIABLE_SEC) - previous->bodyLine=-1; // a function/member declaration + if (g_previous->section!=Entry::VARIABLE_SEC) + g_previous->bodyLine=-1; // a function/member declaration BEGIN( FindMembers ) ; } } } ">"{BN}*"{" { // C++11 style initializer (see bug 790788) lineCount(); - curlyCount=1; + g_curlyCount=1; BEGIN(SkipC11Inits); } {ID}{BN}*"{" { // C++11 style initializer (see bug 688647) lineCount(); - curlyCount=1; + g_curlyCount=1; BEGIN(SkipC11Inits); } "{" { - ++curlyCount; + ++g_curlyCount; } "}" { - if ( --curlyCount<=0 ) + if ( --g_curlyCount<=0 ) { BEGIN(SkipInits); } } "]]" { - BEGIN(lastC11AttributeContext); + BEGIN(g_lastC11AttributeContext); } "{" { // C++11 style initializer unput('{'); @@ -5210,47 +5189,47 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } "{" { //addToBody(yytext); - ++curlyCount ; + ++g_curlyCount ; } "}"/{BN}*("/*!"|"/**"|"//!"|"///")" Inner block starts at line %d objC=%d\n",yyLineNr,insideObjC); - current = std::make_unique(); - gstat = FALSE; + g_yyLineNr = ce->startLine ; + g_yyColNr = ce->startColumn ; + g_insideObjC = ce->lang==SrcLangExt_ObjC; + //printf("---> Inner block starts at line %d objC=%d\n",g_yyLineNr,g_insideObjC); + g_current = std::make_unique(); + g_stat = FALSE; initEntry(); // deep copy group list from parent (see bug 727732) @@ -7094,68 +7068,68 @@ static void parseCompounds(const std::unique_ptr &rt) // set default protection based on the compound type if( ce->section==Entry::CLASS_SEC ) // class { - if (insidePHP || insideD || insideJS || insideIDL || insideSlice) + if (g_insidePHP || g_insideD || g_insideJS || g_insideIDL || g_insideSlice) { - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; } - else if (insideJava) + else if (g_insideJava) { - current->protection = protection = (ce->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; + g_current->protection = g_protection = (ce->spec & (Entry::Interface|Entry::Enum)) ? Public : Package; } else if (ce->spec&(Entry::Interface | Entry::Ref | Entry::Value | Entry::Struct | Entry::Union)) { if (ce->lang==SrcLangExt_ObjC) { - current->protection = protection = Protected ; + g_current->protection = g_protection = Protected ; } else { - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; } } else { - current->protection = protection = Private ; + g_current->protection = g_protection = Private ; } } else if (ce->section == Entry::ENUM_SEC ) // enum { - current->protection = protection = ce->protection; + g_current->protection = g_protection = ce->protection; } else if (!ce->name.isEmpty() && ce->name.at(ni)=='@') // unnamed union or namespace { if (ce->section == Entry::NAMESPACE_SEC ) // unnamed namespace { - current->stat = gstat = TRUE; + g_current->stat = g_stat = TRUE; } - current->protection = protection = ce->protection; + g_current->protection = g_protection = ce->protection; } else // named struct, union, protocol, category { - current->protection = protection = Public ; + g_current->protection = g_protection = Public ; } - mtype = Method; - virt = Normal; - //printf("name=%s current->stat=%d gstat=%d\n",ce->name.data(),current->stat,gstat); + g_mtype = Method; + g_virt = Normal; + //printf("name=%s g_current->stat=%d g_stat=%d\n",ce->name.data(),g_current->stat,g_stat); //memberGroupId = DOX_NOGROUP; //memberGroupRelates.resize(0); //memberGroupInside.resize(0); QCString name = ce->name; - Doxygen::docGroup.enterCompound(yyFileName,yyLineNr,name); + Doxygen::docGroup.enterCompound(g_yyFileName,g_yyLineNr,name); scannerYYlex() ; g_lexInit=TRUE; //forceEndGroup(); - Doxygen::docGroup.leaveCompound(yyFileName,yyLineNr,name); + Doxygen::docGroup.leaveCompound(g_yyFileName,g_yyLineNr,name); ce->program.resize(0); //if (depthIf>0) //{ - // warn(yyFileName,yyLineNr,"Documentation block ended in the middle of a conditional section!"); + // warn(g_yyFileName,g_yyLineNr,"Documentation block ended in the middle of a conditional section!"); //} } parseCompounds(ce); @@ -7172,91 +7146,84 @@ static void parseMain(const char *fileName, { initParser(); - inputString = fileBuf; - inputPosition = 0; + g_inputString = fileBuf; + g_inputPosition = 0; g_column = 0; - //anonCount = 0; // don't reset per file + //g_anonCount = 0; // don't reset per file //depthIf = 0; - protection = Public; - mtype = Method; - gstat = FALSE; - virt = Normal; - current_root = rt.get(); - global_root = rt.get(); - inputFile.setName(fileName); - if (inputFile.open(IO_ReadOnly)) + g_protection = Public; + g_mtype = Method; + g_stat = FALSE; + g_virt = Normal; + g_current_root = rt.get(); + g_yyLineNr= 1 ; + g_yyFileName = fileName; + setContext(); + bool processWithClang = g_insideCpp || g_insideObjC; + if (processWithClang) { - yyLineNr= 1 ; - yyFileName = fileName; - setContext(); - bool processWithClang = insideCpp || insideObjC; - if (processWithClang) + if (!sameTranslationUnit) // new file { - if (!sameTranslationUnit) // new file - { - ClangParser::instance()->start(fileName,filesInSameTranslationUnit); - } - else - { - ClangParser::instance()->switchToFile(fileName); - } - } - rt->lang = language; - msg("Parsing file %s...\n",yyFileName.data()); - - current_root = rt.get() ; - initParser(); - Doxygen::docGroup.enterFile(yyFileName,yyLineNr); - current = std::make_unique(); - //printf("current=%p current_root=%p\n",current,current_root); - int sec=guessSection(yyFileName); - if (sec) - { - current->name = yyFileName; - current->section = sec; - current_root->moveToSubEntryAndRefresh(current); - } - current->reset(); - initEntry(); - scannerYYrestart( scannerYYin ); - if ( insidePHP ) - { - BEGIN( FindMembersPHP ); + ClangParser::instance()->start(fileName,filesInSameTranslationUnit); } else { - BEGIN( FindMembers ); + ClangParser::instance()->switchToFile(fileName); } + } + rt->lang = g_language; + msg("Parsing file %s...\n",g_yyFileName.data()); - scannerYYlex(); - g_lexInit=TRUE; - - if (YY_START==Comment) - { - warn(yyFileName,yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); - } + g_current_root = rt.get() ; + initParser(); + Doxygen::docGroup.enterFile(g_yyFileName,g_yyLineNr); + g_current = std::make_unique(); + //printf("g_current=%p g_current_root=%p\n",g_current,g_current_root); + int sec=guessSection(g_yyFileName); + if (sec) + { + g_current->name = g_yyFileName; + g_current->section = sec; + g_current_root->moveToSubEntryAndRefresh(g_current); + } + g_current->reset(); + initEntry(); + scannerYYrestart( scannerYYin ); + if ( g_insidePHP ) + { + BEGIN( FindMembersPHP ); + } + else + { + BEGIN( FindMembers ); + } - //forceEndGroup(); - Doxygen::docGroup.leaveFile(yyFileName,yyLineNr); + scannerYYlex(); + g_lexInit=TRUE; - rt->program.resize(0); + if (YY_START==Comment) + { + warn(g_yyFileName,g_yyLineNr,"File ended in the middle of a comment block! Perhaps a missing \\endcode?"); + } - parseCompounds(rt); + //forceEndGroup(); + Doxygen::docGroup.leaveFile(g_yyFileName,g_yyLineNr); - inputFile.close(); + rt->program.resize(0); - anonNSCount++; + parseCompounds(rt); - // add additional entries that were created during processing - for (auto &kv: g_outerScopeEntries) - { - //printf(">>> adding '%s' to scope '%s'\n",kv.second->name.data(),kv.first->name.data()); - kv.first->moveToSubEntryAndKeep(kv.second); - } - g_outerScopeEntries.clear(); + g_anonNSCount++; + // add additional entries that were created during processing + for (auto &kv: g_outerScopeEntries) + { + //printf(">>> adding '%s' to scope '%s'\n",kv.second->name.data(),kv.first->name.data()); + kv.first->moveToSubEntryAndKeep(kv.second); } + g_outerScopeEntries.clear(); + } //---------------------------------------------------------------------------- @@ -7266,10 +7233,10 @@ static void parsePrototype(const QCString &text) //printf("**** parsePrototype(%s) begin\n",text.data()); if (text.isEmpty()) { - warn(yyFileName,yyLineNr,"Empty prototype found!"); + warn(g_yyFileName,g_yyLineNr,"Empty prototype found!"); return; } - if (!current) // nothing to store (see bug683516) + if (!g_current) // nothing to store (see bug683516) { return; } @@ -7281,28 +7248,28 @@ static void parsePrototype(const QCString &text) // save scanner state orgState = YY_CURRENT_BUFFER; yy_switch_to_buffer(yy_create_buffer(scannerYYin, YY_BUF_SIZE)); - orgInputString = inputString; - orgInputPosition = inputPosition; + orgInputString = g_inputString; + orgInputPosition = g_inputPosition; // set new string - inputString = text; - inputPosition = 0; + g_inputString = text; + g_inputPosition = 0; g_column = 0; scannerYYrestart( scannerYYin ); BEGIN(Prototype); scannerYYlex(); g_lexInit=TRUE; - current->name = current->name.stripWhiteSpace(); - if (current->section == Entry::MEMBERDOC_SEC && current->args.isEmpty()) - current->section = Entry::VARIABLEDOC_SEC; + g_current->name = g_current->name.stripWhiteSpace(); + if (g_current->section == Entry::MEMBERDOC_SEC && g_current->args.isEmpty()) + g_current->section = Entry::VARIABLEDOC_SEC; // restore original scanner state YY_BUFFER_STATE tmpState = YY_CURRENT_BUFFER; yy_switch_to_buffer(orgState); yy_delete_buffer(tmpState); - inputString = orgInputString; - inputPosition = orgInputPosition; + g_inputString = orgInputString; + g_inputPosition = orgInputPosition; //printf("**** parsePrototype end\n"); @@ -7327,7 +7294,7 @@ void scanFreeScanner() //static void handleGroupEndCommand() //{ // endGroup(); -// previous=0; +// g_previous=0; //} //---------------------------------------------------------------------------- @@ -7338,7 +7305,7 @@ void CLanguageScanner::startTranslationUnit(const char *) void CLanguageScanner::finishTranslationUnit() { - bool processWithClang = insideCpp || insideObjC; + bool processWithClang = g_insideCpp || g_insideObjC; if (processWithClang) { ClangParser::instance()->finish(); -- cgit v0.12 From 26a634f60f53987d4d8b1f94259cc0a94e2414c3 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 24 Nov 2019 13:41:37 +0100 Subject: Fixed line count misaligned introduced with JAVADOC_BANNER --- src/scanner.l | 74 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/src/scanner.l b/src/scanner.l index e0095ba..3e48916 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -246,7 +246,7 @@ static void initEntry() static void lineCount() { - static int tabSize = Config_getInt(TAB_SIZE); + int tabSize = Config_getInt(TAB_SIZE); const char *p; for (p = yytext ; *p ; ++p ) { @@ -269,7 +269,7 @@ static void lineCount() static inline int computeIndent(const char *s,int startIndent) { int col=startIndent; - static int tabSize=Config_getInt(TAB_SIZE); + int tabSize=Config_getInt(TAB_SIZE); const char *p=s; char c; while ((c=*p++)) @@ -4120,7 +4120,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (!g_msName.isEmpty() /*&& g_msName!=g_current->name*/) // skip typedef T {} T;, removed due to bug608493 { - static bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT); + bool typedefHidesStruct = Config_getBool(TYPEDEF_HIDES_STRUCT); // case 1: typedef struct _S { ... } S_t; // -> omit typedef and use S_t as the struct name if (typedefHidesStruct && @@ -6207,41 +6207,43 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN( DocBlock ); } "/**"[*]+{BL} { + bool javadocBanner = Config_getBool(JAVADOC_BANNER); + lineCount(); - static bool javadocBanner = Config_getBool(JAVADOC_BANNER); - - if( javadocBanner ) { - g_lastDocContext = YY_START; + if( javadocBanner ) + { + g_lastDocContext = YY_START; - //printf("Found comment banner at %s:%d\n",g_yyFileName,g_yyLineNr); - if (g_current_root->section & Entry::SCOPE_MASK) - { - g_current->inside = g_current_root->name+"::"; - } - g_current->docLine = g_yyLineNr; - g_current->docFile = g_yyFileName; - g_docBlockContext = YY_START; - g_docBlockInBody = YY_START==SkipCurly; - static bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); - g_docBlockAutoBrief = javadocAutoBrief; + //printf("Found comment banner at %s:%d\n",g_yyFileName,g_yyLineNr); + if (g_current_root->section & Entry::SCOPE_MASK) + { + g_current->inside = g_current_root->name+"::"; + } + g_current->docLine = g_yyLineNr; + g_current->docFile = g_yyFileName; + g_docBlockContext = YY_START; + g_docBlockInBody = YY_START==SkipCurly; + bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); + g_docBlockAutoBrief = javadocAutoBrief; - QCString indent; - indent.fill(' ',computeIndent(yytext,g_column)); - g_docBlock=indent; + QCString indent; + indent.fill(' ',computeIndent(yytext,g_column)); + g_docBlock=indent; - if (g_docBlockAutoBrief) - { - g_current->briefLine = g_yyLineNr; - g_current->briefFile = g_yyFileName; - } - startCommentBlock(FALSE); - BEGIN( DocBlock ); - } else { - g_current->program += yytext ; - g_lastContext = YY_START ; - BEGIN( Comment ) ; + if (g_docBlockAutoBrief) + { + g_current->briefLine = g_yyLineNr; + g_current->briefFile = g_yyFileName; + } + startCommentBlock(FALSE); + BEGIN( DocBlock ); + } + else + { + g_current->program += yytext ; + g_lastContext = YY_START ; + BEGIN( Comment ) ; } - } ("//"{B}*)?"/**"/[^/*] { g_lastDocContext = YY_START; @@ -6255,7 +6257,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) g_current->docFile = g_yyFileName; g_docBlockContext = YY_START; g_docBlockInBody = YY_START==SkipCurly; - static bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); + bool javadocAutoBrief = Config_getBool(JAVADOC_AUTOBRIEF); g_docBlockAutoBrief = javadocAutoBrief; QCString indent; @@ -6916,7 +6918,7 @@ static void newEntry() static void handleCommentBlock(const QCString &doc,bool brief) { - static bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS); + bool hideInBodyDocs = Config_getBool(HIDE_IN_BODY_DOCS); if (g_docBlockInBody && hideInBodyDocs) return; //printf("parseCommentBlock [%s] brief=%d\n",doc.data(),brief); int lineNr = brief ? g_current->briefLine : g_current->docLine; // line of block start @@ -7058,7 +7060,7 @@ static void parseCompounds(const std::unique_ptr &rt) initEntry(); // deep copy group list from parent (see bug 727732) - static bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS); + bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS); if (autoGroupNested && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum)) { ce->groups = rt->groups; -- cgit v0.12 From 73a410a00efb17ab7bc673bf2e3ecdc45eb876f4 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 24 Nov 2019 19:10:02 +0100 Subject: Fixed endless loop during preprocessing --- src/pre.l | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pre.l b/src/pre.l index cf13764..abc9df9 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2391,10 +2391,13 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); if (expr.isEmpty()) { + //printf("expansionDict.find(expr)!=0) // check for recursive expansions { + expr=expr.left(pos)+"@-"+expr.right(expr.length()-pos); + //printf(" Date: Mon, 25 Nov 2019 10:59:05 +0100 Subject: Adding some links in search documentation The search chapter was missing some links --- doc/extsearch.doc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/extsearch.doc b/doc/extsearch.doc index ead7ea8..e139408 100644 --- a/doc/extsearch.doc +++ b/doc/extsearch.doc @@ -77,7 +77,7 @@ Since we didn't create or install a doxysearch.db it is OK for the test to fail for this reason. How to correct this is discussed in the next section. Before continuing with the next section add the above -URL (without the `?test` part) to the `SEARCHENGINE_URL` tag in +URL (without the `?test` part) to the \ref cfg_searchengine_url "SEARCHENGINE_URL" tag in doxygen's configuration file: SEARCHENGINE_URL = http://yoursite.com/path/to/cgi/doxysearch.cgi @@ -135,7 +135,8 @@ and then copy the resulting `doxysearch.db` to the directory where also The `searchdata.xml` file doesn't contain any absolute paths or links, so how can the search results from multiple projects be linked back to the right documentation set? -This is where the `EXTERNAL_SEARCH_ID` and `EXTRA_SEARCH_MAPPINGS` options come into play. +This is where the \ref cfg_external_search_id "EXTERNAL_SEARCH_ID" and +\ref cfg_extra_search_mappings "EXTRA_SEARCH_MAPPINGS" options come into play. To be able to identify the different projects, one needs to set a unique ID using \ref cfg_external_search_id "EXTERNAL_SEARCH_ID" @@ -168,8 +169,8 @@ and the search results will link to the right documentation set. When you modify the source code, you should re-run doxygen to get up to date documentation again. When using external searching you also need to update the -search index by re-running `doxyindexer`. You could wrap the call to doxygen -and doxyindexer together in a script to make this process easier. +search index by re-running `doxyindexer`. You could wrap the call to `doxygen` +and `doxyindexer` together in a script to make this process easier. \section extsearch_api Programming interface -- cgit v0.12 From b007be7c1671661f31f056b7b7b5f480279ddbd6 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 25 Nov 2019 11:28:45 +0100 Subject: Checking of right usage of configuration list items In case of a configuration list item has an equal sign in it ('=') some extra restriction are imposed / made more understandable. --- src/configimpl.l | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/doxygen.cpp | 21 +++++-- src/pre.l | 5 +- 3 files changed, 203 insertions(+), 9 deletions(-) diff --git a/src/configimpl.l b/src/configimpl.l index 0cc5c88..351337e 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -1484,23 +1484,203 @@ void Config::checkAndCorrect() s=includePath.next(); } - // check aliases + // check EXTENSION_MAPPING + QStrList &extmapList = Config_getList(EXTENSION_MAPPING); + s=extmapList.first(); + while (s) + { + QCString extmap=s; + extmap=extmap.stripWhiteSpace(); + int i_equals=extmap.find('='); + if (i_equals==-1) + { + err("Illegal EXTENSION_MAPPING format '%s', no equal sign specified use 'ext=language'\n",extmap.data()); + } + else + { + QCString ext = extmap.left(i_equals); + QCString lang = extmap.mid(i_equals+1); + if (ext.isEmpty()) + { + err("Illegal EXTENSION_MAPPING format '%s', no extension to replace specified use 'ext=language'\n",extmap.data()); + } + else if (lang.isEmpty()) + { + err("Illegal EXTENSION_MAPPING format '%s', no replacement language specified use 'ext=language'\n",extmap.data()); + } + } + s=extmapList.next(); + } + + // check PREDEFINED + if (Config_getBool(ENABLE_PREPROCESSING)) + { + QStrList &predefList = Config_getList(PREDEFINED); + s=predefList.first(); + while (s) + { + QCString predef=s; + predef=predef.stripWhiteSpace(); + int i_equals=predef.find('='); + int i_obrace=predef.find('('); + if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && predef.at(i_equals-1)==':')) + { + err("Illegal PREDEFINED format '%s', no define name specified\n",predef.data()); + } + s=predefList.next(); + } + } + + // check ALIASES QStrList &aliasList = Config_getList(ALIASES); s=aliasList.first(); while (s) { QRegExp re1("[a-z_A-Z][a-z_A-Z0-9]*[ \t]*="); // alias without argument - QRegExp re2("[a-z_A-Z][a-z_A-Z0-9]*{[0-9]*}[ \t]*="); // alias with argument + QRegExp re2("[a-z_A-Z][a-z_A-Z0-9]*{[0-9]+}[ \t]*="); // alias with argument QCString alias=s; alias=alias.stripWhiteSpace(); if (alias.find(re1)!=0 && alias.find(re2)!=0) { - err("Illegal alias format '%s'. Use \"name=value\" or \"name{n}=value\", where n is the number of arguments\n", + err("Illegal ALIASES format '%s'. Use \"name=value\" or \"name{n}=value\", where n is the number of arguments\n", alias.data()); } s=aliasList.next(); } + // check FILTER_PATTERNS + QStrList& filterList = Config_getList(FILTER_PATTERNS); + s=filterList.first(); + while (s) + { + QCString filter=s; + filter=filter.stripWhiteSpace(); + int i=filter.find('='); + if (i==-1) + { + err("Illegal FILTER_PATTERNS format, no equal sign specified in '%s'\n",filter.data()); + } + else + { + QCString myName=filter.left(i).stripWhiteSpace(); + QCString myValue=filter.right(filter.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal FILTER_PATTERNS format '%s', no name specified\n",filter.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal FILTER_PATTERNS format '%s', no filter specified\n",filter.data()); + } + } + s=filterList.next(); + } + + // check FILTER_SOURCE_PATTERNS + QStrList& filterSrcList = Config_getList(FILTER_SOURCE_PATTERNS); + s=filterSrcList.first(); + while (s) + { + QCString filterSrc=s; + filterSrc=filterSrc.stripWhiteSpace(); + int i=filterSrc.find('='); + if (i==-1) + { + err("Illegal FILTER_SOURCE_PATTERNS format, no name specified in '%s'\n",filterSrc.data()); + } + else + { + QCString myName=filterSrc.left(i).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal FILTER_SOURCE_PATTERNS format '%s', no name specified\n",filterSrc.data()); + } + } + s=filterSrcList.next(); + } + + // check TAGFILES + QStrList& tagfilesList = Config_getList(TAGFILES); + s=tagfilesList.first(); + while (s) + { + QCString tagfiles=s; + tagfiles=tagfiles.stripWhiteSpace(); + int i=tagfiles.find('='); + if (i!=-1) + { + QCString myName=tagfiles.left(i).stripWhiteSpace(); + QCString myValue=tagfiles.right(tagfiles.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal TAGFILES format '%s', no name specified\n",tagfiles.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal TAGFILES format '%s', no tagfiles specified\n",tagfiles.data()); + } + } + s=tagfilesList.next(); + } + + // check EXTRA_SEARCH_MAPPINGS + if (Config_getBool(SEARCHENGINE) && Config_getBool(GENERATE_HTML)) + { + QStrList& searchList = Config_getList(EXTRA_SEARCH_MAPPINGS); + s=searchList.first(); + while (s) + { + QCString search=s; + search=search.stripWhiteSpace(); + int i=search.find('='); + if (i==-1) + { + err("Illegal EXTRA_SEARCH_MAPPINGS format, no equal sign specified in '%s'\n",search.data()); + } + else + { + QCString myName=search.left(i).stripWhiteSpace(); + QCString myValue=search.right(search.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal EXTRA_SEARCH_MAPPINGS format '%s', no tagname specified\n",search.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal EXTRA_SEARCH_MAPPINGS format '%s', no location specified\n",search.data()); + } + } + s=searchList.next(); + } + } + + // check TCL_SUBST + QStrList tclsubstList = Config_getList(TCL_SUBST); + s=tclsubstList.first(); + while (s) + { + QCString tclsubst=s; + int i=tclsubst.find('='); + if (i==-1) + { + err("Illegal TCL_SUBST format, no equal sign specified in '%s'\n",tclsubst.data()); + } + else + { + QCString myName=tclsubst.left(i).stripWhiteSpace(); + QCString myValue=tclsubst.right(tclsubst.length()-i-1).stripWhiteSpace(); + if (myName.isEmpty()) + { + err("Illegal TCL_SUBST format '%s', no name to replace specified\n",tclsubst.data()); + } + else if (myValue.isEmpty()) + { + err("Illegal TCL_SUBST format '%s', no replacement value specified\n",tclsubst.data()); + } + } + s = tclsubstList.next(); + } + // check if GENERATE_TREEVIEW and GENERATE_HTMLHELP are both enabled if (Config_getBool(GENERATE_TREEVIEW) && Config_getBool(GENERATE_HTMLHELP)) { diff --git a/src/doxygen.cpp b/src/doxygen.cpp index d4d55e7..3b37567 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -9209,6 +9209,7 @@ static void readTagFile(const std::unique_ptr &root,const char *tl) { fileName = tagLine.left(eqPos).stripWhiteSpace(); destName = tagLine.right(tagLine.length()-eqPos-1).stripWhiteSpace(); + if (fileName.isEmpty() || destName.isEmpty()) return; QFileInfo fi(fileName); Doxygen::tagDestinationDict.insert(fi.absFilePath().utf8(),new QCString(destName)); //printf("insert tagDestination %s->%s\n",fi.fileName().data(),destName.data()); @@ -10689,11 +10690,22 @@ void adjustConfiguration() while (mapping) { QCString mapStr = mapping; - int i; - if ((i=mapStr.find('='))!=-1) + int i=mapStr.find('='); + if (i==-1) + { + mapping = extMaps.next(); + continue; + } + else { - QCString ext=mapStr.left(i).stripWhiteSpace().lower(); - QCString language=mapStr.mid(i+1).stripWhiteSpace().lower(); + QCString ext = mapStr.left(i).stripWhiteSpace().lower(); + QCString language = mapStr.mid(i+1).stripWhiteSpace().lower(); + if (ext.isEmpty() || language.isEmpty()) + { + mapping = extMaps.next(); + continue; + } + if (!updateLanguageMapping(ext,language)) { err("Failed to map file extension '%s' to unsupported language '%s'.\n" @@ -10709,7 +10721,6 @@ void adjustConfiguration() mapping = extMaps.next(); } - // add predefined macro name to a dictionary QStrList &expandAsDefinedList =Config_getList(EXPAND_AS_DEFINED); s=expandAsDefinedList.first(); diff --git a/src/pre.l b/src/pre.l index abc9df9..9d27e6f 100644 --- a/src/pre.l +++ b/src/pre.l @@ -3250,7 +3250,10 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output int i_cbrace=ds.find(')'); bool nonRecursive = i_equals>0 && ds.at(i_equals-1)==':'; - if (i_obrace==0) continue; // no define name + if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && ds.at(i_equals-1)==':')) + { + continue; // no define name + } if (i_obrace Date: Mon, 25 Nov 2019 21:02:53 +0100 Subject: Fixed preprocessor issue that resulted in "More #endif's than #if's found." warning. --- src/pre.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pre.l b/src/pre.l index abc9df9..85a5728 100644 --- a/src/pre.l +++ b/src/pre.l @@ -2084,7 +2084,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (cc!='(') { - unputChar(yyscanner,expr,rest,j,' '); + unputChar(yyscanner,expr,rest,j,cc); return FALSE; } getNextChar(yyscanner,expr,rest,j); // eat the '(' character -- cgit v0.12 From dbd8ceb8efa2e7b413780a43e74b30f039670a72 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 25 Nov 2019 21:29:51 +0100 Subject: Fixed preprocessor hangup regression --- src/pre.l | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/pre.l b/src/pre.l index 85a5728..fe06b6c 100644 --- a/src/pre.l +++ b/src/pre.l @@ -1934,7 +1934,7 @@ static QCString extractTrailingComment(const char *s) static int getNextChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos); static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint pos); static void unputChar(yyscan_t yyscanner,const QCString &expr,QCString *rest,uint &pos,char c); -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level); +static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level); static QCString stringize(const QCString &s) { @@ -2385,20 +2385,19 @@ static int getNextId(const QCString &expr,int p,int *l) * starting at position \a pos. * May read additional characters from the input while re-scanning! */ -static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) +static bool expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,int pos,int level) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : 0, pos, level); + //printf(">expandExpression(expr='%s',rest='%s',pos=%d,level=%d)\n",expr.data(),rest ? rest->data() : "", pos, level); if (expr.isEmpty()) { //printf("expansionDict.find(expr)!=0) // check for recursive expansions { - expr=expr.left(pos)+"@-"+expr.right(expr.length()-pos); //printf("nonRecursive=%d\n",macroName.data(),def->nonRecursive); + //printf(" macroName=%s restExpr='%s' def->nonRecursive=%d\n",macroName.data(),restExpr.data(),def->nonRecursive); + bool expanded=false; if (def && !def->nonRecursive) { state->expandedDict->insert(macroName,def); - expandExpression(yyscanner,resultExpr,&restExpr,0,level+1); + expanded = expandExpression(yyscanner,resultExpr,&restExpr,0,level+1); state->expandedDict->remove(macroName); } - expr=expr.left(p)+resultExpr+restExpr; - //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p); - i=p; + if (expanded) + { + expr=expr.left(p)+resultExpr+restExpr; + //printf(" new expression: '%s' old i=%d new i=%d\n",expr.data(),i,p); + i=p; + } + else + { + expr=expr.left(p)+"@-"+expr.right(expr.length()-p); + i=p+l+2; + } } else // move to the next macro name { @@ -2494,6 +2502,7 @@ static void expandExpression(yyscan_t yyscanner,QCString &expr,QCString *rest,in } } //printf("data() : 0, pos,level); + return TRUE; } /*! @brief Process string or character literal. -- cgit v0.12 From 6382986b77d302be187d95aaa850eff132ec1d7d Mon Sep 17 00:00:00 2001 From: Tobias Off Date: Tue, 19 Nov 2019 13:01:27 +0100 Subject: Refactoring of portable.h and portable.cpp functions to be contained in a namespace Fixing some memory issues caused by not correctly freed pointers --- src/cite.cpp | 6 +- src/config.xml | 2 +- src/configimpl.l | 16 +-- src/context.cpp | 34 +++--- src/definition.cpp | 16 +-- src/dia.cpp | 18 ++-- src/diagram.cpp | 8 +- src/docparser.cpp | 10 +- src/doctokenizer.l | 2 +- src/dot.cpp | 18 ++-- src/dotgroupcollaboration.cpp | 10 ++ src/dotrunner.cpp | 14 +-- src/doxygen.cpp | 34 +++--- src/filedef.cpp | 4 +- src/formula.cpp | 32 +++--- src/htags.cpp | 6 +- src/message.cpp | 2 +- src/msc.cpp | 8 +- src/plantuml.cpp | 16 +-- src/portable.cpp | 234 +++++++++++++++++++----------------------- src/portable.h | 57 +++++----- src/pre.l | 2 +- src/util.cpp | 20 ++-- src/vhdldocgen.cpp | 4 +- 24 files changed, 288 insertions(+), 285 deletions(-) diff --git a/src/cite.cpp b/src/cite.cpp index f15f595..40084b6 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -235,14 +235,14 @@ void CiteDict::generatePage() const // 5. run bib2xhtml perl script on the generated file which will insert the // bibliography in citelist.doc int exitCode; - portable_sysTimerStop(); - if ((exitCode=portable_system("perl","\""+bib2xhtmlFile+"\" "+bibOutputFiles+" \""+ + Portables::sysTimerStop(); + if ((exitCode=Portables::system("perl","\""+bib2xhtmlFile+"\" "+bibOutputFiles+" \""+ citeListFile+"\"")) != 0) { err("Problems running bibtex. Verify that the command 'perl --version' works from the command line. Exit code: %d\n", exitCode); } - portable_sysTimerStop(); + Portables::sysTimerStop(); QDir::setCurrent(oldDir); diff --git a/src/config.xml b/src/config.xml index d206203..fb0e01a 100644 --- a/src/config.xml +++ b/src/config.xml @@ -953,7 +953,7 @@ Go to the next section or return to the ]]> -