summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/bufstr.h24
-rw-r--r--src/code.l200
-rw-r--r--src/config.xml17
-rw-r--r--src/constexp.h13
-rw-r--r--src/constexp.l6
-rw-r--r--src/constexp.y43
-rw-r--r--src/constexp_p.h18
-rw-r--r--src/context.cpp6
-rw-r--r--src/cppvalue.cpp33
-rw-r--r--src/cppvalue.h30
-rw-r--r--src/debug.cpp3
-rw-r--r--src/debug.h3
-rw-r--r--src/docparser.cpp17
-rw-r--r--src/dotgroupcollaboration.cpp1
-rw-r--r--src/doxygen.cpp59
-rw-r--r--src/doxygen.h2
-rw-r--r--src/groupdef.cpp11
-rw-r--r--src/index.cpp7
-rw-r--r--src/layout.cpp5
-rw-r--r--src/message.cpp8
-rw-r--r--src/message.h1
-rw-r--r--src/pre.l7
-rw-r--r--src/rtfgen.cpp12
-rw-r--r--src/scanner.l2
-rw-r--r--src/tagreader.cpp3
-rw-r--r--src/util.cpp58
-rw-r--r--src/vhdldocgen.cpp5
-rw-r--r--src/xml.h74
-rw-r--r--src/xml.l484
30 files changed, 331 insertions, 826 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5004a95..c6af813 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories(
${PROJECT_SOURCE_DIR}/liblodepng
${PROJECT_SOURCE_DIR}/libmscgen
${PROJECT_SOURCE_DIR}/libversion
+ ${PROJECT_SOURCE_DIR}/libxml
${PROJECT_SOURCE_DIR}/vhdlparser
${PROJECT_SOURCE_DIR}/src
${CLANG_INCLUDEDIR}
@@ -114,7 +115,6 @@ set(LEX_FILES scanner
commentcnv
commentscan
constexp
- xml
xmlcode
sqlcode
configimpl)
@@ -190,7 +190,6 @@ add_library(doxymain STATIC
${GENERATED_SRC}/scanner.l.h
${GENERATED_SRC}/sqlcode.l.h
${GENERATED_SRC}/vhdlcode.l.h
- ${GENERATED_SRC}/xml.l.h
${GENERATED_SRC}/xmlcode.l.h
${GENERATED_SRC}/code.cpp
${GENERATED_SRC}/commentcnv.cpp
@@ -206,7 +205,6 @@ add_library(doxymain STATIC
${GENERATED_SRC}/scanner.cpp
${GENERATED_SRC}/sqlcode.cpp
${GENERATED_SRC}/vhdlcode.cpp
- ${GENERATED_SRC}/xml.cpp
${GENERATED_SRC}/xmlcode.cpp
#
${GENERATED_SRC}/ce_parse.cpp
@@ -348,6 +346,7 @@ target_link_libraries(doxygen PRIVATE
md5
lodepng
mscgen
+ xml
doxygen_version
vhdlparser
${SQLITE3_LIBRARIES}
diff --git a/src/bufstr.h b/src/bufstr.h
index e64a049..ca733ad 100644
--- a/src/bufstr.h
+++ b/src/bufstr.h
@@ -1,13 +1,13 @@
/******************************************************************************
*
- *
+ *
*
*
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -18,20 +18,18 @@
#ifndef _BUFSTR_H
#define _BUFSTR_H
-#include <qglobal.h>
-#include <qcstring.h>
-#include <stdlib.h>
+#include <cstdlib>
/*! @brief Buffer used to store strings
- *
+ *
* This buffer is used append characters and strings. It will automatically
* resize itself, yet provide efficient random access to the content.
*/
-class BufStr
+class BufStr
{
public:
- BufStr(uint size)
- : m_size(size), m_writeOffset(0), m_spareRoom(10240), m_buf(0)
+ BufStr(uint size)
+ : m_size(size), m_writeOffset(0), m_spareRoom(10240), m_buf(0)
{
m_buf = (char *)calloc(size,1);
}
@@ -95,8 +93,8 @@ class BufStr
return m_buf;
}
uint curPos() const
- {
- return m_writeOffset;
+ {
+ return m_writeOffset;
}
void dropFromStart(uint bytes)
{
@@ -108,7 +106,7 @@ class BufStr
private:
void makeRoomFor(uint size)
{
- if (m_writeOffset+size>=m_size)
+ if (m_writeOffset+size>=m_size)
{
resize(m_size+size+m_spareRoom);
}
diff --git a/src/code.l b/src/code.l
index 233a4f0..f7e1775 100644
--- a/src/code.l
+++ b/src/code.l
@@ -400,7 +400,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
}
else // Start of Objective-C method
{
- //printf("Method!\n");
+ DBG_CTX((stderr,"Start of Objective-C method!\n"));
yyextra->code->codify(yytext);
BEGIN(ObjCMethod);
}
@@ -477,7 +477,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
{
if (ambig) // multiple input files match the name
{
- //printf("===== yes %s is ambiguous\n",yytext);
+ DBG_CTX((stderr,"===== yes %s is ambiguous\n",yytext));
QCString name = QDir::cleanDirPath(yytext).utf8();
if (!name.isEmpty() && yyextra->sourceFileDef)
{
@@ -499,7 +499,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
found = TRUE;
}
}
- //printf(" include file %s found=%d\n",fd ? fd->absFilePath().data() : "<none>",found);
+ DBG_CTX((stderr," include file %s found=%d\n",fd ? fd->absFilePath().data() : "<none>",found));
if (found)
{
writeMultiLineCodeLink(yyscanner,*yyextra->code,fd,yytext);
@@ -587,13 +587,13 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
BEGIN(Body);
}
<Body,ClassVar>"@end" {
- //printf("End of objc scope fd=%s\n",yyextra->sourceFileDef->name().data());
+ DBG_CTX((stderr,"End of objc scope fd=%s\n",yyextra->sourceFileDef->name().data()));
if (yyextra->sourceFileDef)
{
const FileDef *fd=yyextra->sourceFileDef;
yyextra->insideObjC = fd->name().lower().right(2)==".m" ||
fd->name().lower().right(3)==".mm";
- //printf("insideObjC=%d\n",yyextra->insideObjC);
+ DBG_CTX((stderr,"insideObjC=%d\n",yyextra->insideObjC));
}
else
{
@@ -702,7 +702,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
}
<PackageName>{ID}("."{ID})* {
yyextra->curClassName=substitute(yytext,".","::");
- //printf("found package: %s\n",yyextra->curClassName.data());
+ DBG_CTX((stderr,"found package: %s\n",yyextra->curClassName.data()));
addType(yyscanner);
codifyLines(yyscanner,yytext);
}
@@ -896,11 +896,9 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
endFontClass(yyscanner);
BEGIN(UsingName);
}
-<UsingName>{ID}("::"{ID})* { addUsingDirective(yyscanner,yytext);
+<UsingName>{ID}("::"{ID})* {
+ addUsingDirective(yyscanner,yytext);
generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext);
- DBG_CTX((stderr,"** scope stack push CLASSBLOCK\n"));
- yyextra->scopeStack.push(CLASSBLOCK);
- pushScope(yyscanner,yytext);
BEGIN(Body);
}
<UsingName>\n { codifyLines(yyscanner,yytext); BEGIN(Body); }
@@ -1300,7 +1298,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
<Body>[,=;\[] {
if (yyextra->insideObjC && *yytext=='[')
{
- //printf("Found start of ObjC call!\n");
+ DBG_CTX((stderr,"Found start of ObjC call!\n"));
// start of a method call
yyextra->contextMap.clear();
yyextra->nameMap.clear();
@@ -1370,7 +1368,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
yyextra->name+=yytext;
if (yyextra->theCallContext.getClass())
{
- //printf("Calling method %s\n",yyextra->name.data());
+ DBG_CTX((stderr,"Calling method %s\n",yyextra->name.data()));
if (!generateClassMemberLink(yyscanner,*yyextra->code,yyextra->theCallContext.getClass(),yyextra->name))
{
yyextra->code->codify(yytext);
@@ -1395,7 +1393,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
saveObjCContext(yyscanner);
yyextra->currentCtx->format+=*yytext;
BEGIN(ObjCCall);
- //printf("open\n");
+ DBG_CTX((stderr,"open\n"));
}
<ObjCCall,ObjCMName>"]"|"}" {
yyextra->currentCtx->format+=*yytext;
@@ -1413,7 +1411,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
writeObjCMethodCall(yyscanner,ctx);
BEGIN(Body);
}
- //printf("close\n");
+ DBG_CTX((stderr,"close\n"));
}
<ObjCCall,ObjCMName>"//".* {
yyextra->currentCtx->format+=escapeComment(yyscanner,yytext);
@@ -1437,7 +1435,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
if (yyextra->braceCount==0)
{
yyextra->currentCtx->objectTypeOrName=yytext;
- //printf("new type=%s\n",yyextra->currentCtx->objectTypeOrName.data());
+ DBG_CTX((stderr,"new type=%s\n",yyextra->currentCtx->objectTypeOrName.data()));
BEGIN(ObjCMName);
}
}
@@ -1610,7 +1608,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
<MemberCall,MemberCall2,FuncCall>("*"{B}*)?")" {
if (yytext[0]==')') // no a pointer cast
{
- //printf("addVariable(%s,%s)\n",yyextra->parmType.data(),yyextra->parmName.data());
+ DBG_CTX((stderr,"addVariable(%s,%s)\n",yyextra->parmType.data(),yyextra->parmName.data()));
if (yyextra->parmType.isEmpty())
{
yyextra->parmType=yyextra->parmName;
@@ -2179,7 +2177,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
static void addVariable(yyscan_t yyscanner,QCString type,QCString name)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- //printf("VariableContext::addVariable(%s,%s)\n",type.data(),name.data());
+ DBG_CTX((stderr,"VariableContext::addVariable(%s,%s)\n",type.data(),name.data()));
QCString ltype = type.simplifyWhiteSpace();
QCString lname = name.simplifyWhiteSpace();
if (ltype.left(7)=="struct ")
@@ -2247,7 +2245,7 @@ static void pushScope(yyscan_t yyscanner,const char *s)
yyextra->classScope += "::";
yyextra->classScope += s;
}
- //printf("pushScope(%s) result: '%s'\n",s,yyextra->classScope.data());
+ DBG_CTX((stderr,"pushScope(%s) result: '%s'\n",s,yyextra->classScope.data()));
}
@@ -2265,7 +2263,7 @@ static void popScope(yyscan_t yyscanner)
{
//err("Too many end of scopes found!\n");
}
- //printf("popScope() result: '%s'\n",yyextra->classScope.data());
+ DBG_CTX((stderr,"popScope() result: '%s'\n",yyextra->classScope.data()));
}
static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor)
@@ -2298,12 +2296,12 @@ static void addToSearchIndex(yyscan_t yyscanner,const char *text)
static void setClassScope(yyscan_t yyscanner,const QCString &name)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- //printf("setClassScope(%s)\n",name.data());
+ DBG_CTX((stderr,"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);
+ DBG_CTX((stderr,"ts=%d te=%d\n",ts,te));
if (ts!=-1 && te!=-1 && te>ts)
{
// remove template from scope
@@ -2321,7 +2319,7 @@ static void setClassScope(yyscan_t yyscanner,const QCString &name)
n = n.mid(i+2);
}
pushScope(yyscanner,n);
- //printf("--->New class scope '%s'\n",yyextra->classScope.data());
+ DBG_CTX((stderr,"--->New class scope '%s'\n",yyextra->classScope.data()));
}
/*! start a new line of code, inserting a line number if yyextra->sourceFileDef
@@ -2339,7 +2337,7 @@ static void startCodeLine(yyscan_t yyscanner)
//lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
const Definition *d = yyextra->sourceFileDef->getSourceDefinition(yyextra->yyLineNr);
- //printf("%s:startCodeLine(%d)=%p\n",yyextra->sourceFileDef->name().data(),yyextra->yyLineNr,d);
+ DBG_CTX((stderr,"%s:startCodeLine(%d)=%p\n",yyextra->sourceFileDef->name().data(),yyextra->yyLineNr,d));
if (!yyextra->includeCodeFragment && d)
{
yyextra->currentDefinition = d;
@@ -2353,7 +2351,7 @@ static void startCodeLine(yyscan_t yyscanner)
yyextra->args.resize(0);
yyextra->parmType.resize(0);
yyextra->parmName.resize(0);
- //printf("Real scope: '%s'\n",yyextra->realScope.data());
+ DBG_CTX((stderr,"Real scope: '%s'\n",yyextra->realScope.data()));
yyextra->bodyCurlyCount = 0;
QCString lineAnchor;
lineAnchor.sprintf("l%05d",yyextra->yyLineNr);
@@ -2413,7 +2411,7 @@ static void nextCodeLine(yyscan_t yyscanner)
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);
+ DBG_CTX((stderr,"codifyLines(%d,\"%s\")\n",yyextra->yyLineNr,text));
const char *p=text,*sp=p;
char c;
bool done=FALSE;
@@ -2485,13 +2483,13 @@ static void writeMultiLineCodeLink(yyscan_t yyscanner,CodeOutputInterface &ol,
{
yyextra->yyLineNr++;
*(p-1)='\0';
- //printf("writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp);
+ DBG_CTX((stderr,"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);
+ DBG_CTX((stderr,"writeCodeLink(%s,%s,%s,%s)\n",ref,file,anchor,sp));
ol.writeCodeLink(ref,file,anchor,sp,tooltip);
done=TRUE;
}
@@ -2569,7 +2567,7 @@ static const ClassDef *stripClassName(yyscan_t yyscanner,const char *s,const Def
{
cd=yyextra->symbolResolver.resolveClass(d,clName);
}
- //printf("stripClass trying '%s' = %p\n",clName.data(),cd);
+ DBG_CTX((stderr,"stripClass trying '%s' = %p\n",clName.data(),cd));
if (cd)
{
return cd;
@@ -2590,14 +2588,14 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &
{
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());
+ DBG_CTX((stderr,"explicit scope: name=%s scope=%s\n",locName.data(),scope.data()));
const ClassDef *mcd = getClass(scope);
if (mcd && !locName.isEmpty())
{
const MemberDef *md=mcd->getMemberByName(locName);
if (md)
{
- //printf("name=%s scope=%s\n",locName.data(),scope.data());
+ DBG_CTX((stderr,"name=%s scope=%s\n",locName.data(),scope.data()));
yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope())));
return md;
}
@@ -2610,7 +2608,7 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &
const MemberDef *md=mnd->getMemberByName(locName);
if (md)
{
- //printf("name=%s scope=%s\n",locName.data(),scope.data());
+ DBG_CTX((stderr,"name=%s scope=%s\n",locName.data(),scope.data()));
yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope())));
return md;
}
@@ -2654,7 +2652,7 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &
// look for a global member
if ((mn=Doxygen::functionNameLinkedMap->find(name)))
{
- //printf("global var '%s'\n",name.data());
+ DBG_CTX((stderr,"global var '%s'\n",name.data()));
if (mn->size()==1) // global defined only once
{
const std::unique_ptr<MemberDef> &md=mn->front();
@@ -2679,7 +2677,7 @@ static const MemberDef *setCallContextForVar(yyscan_t yyscanner,const QCString &
if (!md->isStatic() || md->getBodyDef()==yyextra->sourceFileDef)
{
yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope())));
- //printf("returning member %s in source file %s\n",md->name().data(),yyextra->sourceFileDef->name().data());
+ DBG_CTX((stderr,"returning member %s in source file %s\n",md->name().data(),yyextra->sourceFileDef->name().data()));
return md.get();
}
}
@@ -2727,14 +2725,14 @@ static bool getLinkInScope(yyscan_t yyscanner,
{
if (md->isLinkable())
{
- //printf("found it %s!\n",md->qualifiedName().data());
+ DBG_CTX((stderr,"found it %s!\n",md->qualifiedName().data()));
if (yyextra->exampleBlock)
{
std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("a%d",yyextra->anchorCount);
- //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
- // yyextra->exampleFile.data());
+ DBG_CTX((stderr,"addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
+ yyextra->exampleFile.data()));
MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm && mdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
{
@@ -2749,8 +2747,8 @@ static bool getLinkInScope(yyscan_t yyscanner,
if (d && d->isLinkable())
{
yyextra->theCallContext.setScope(ScopedTypeVariant(stripClassName(yyscanner,md->typeString(),md->getOuterScope())));
- //printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p yyextra->insideBody=%d\n",
- // yyextra->currentDefinition,yyextra->currentMemberDef,yyextra->insideBody);
+ DBG_CTX((stderr,"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)
@@ -2758,7 +2756,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
- //printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
+ DBG_CTX((stderr,"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);
@@ -2783,7 +2781,7 @@ static bool getLink(yyscan_t yyscanner,
bool varOnly)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- //printf("getLink(%s,%s) yyextra->curClassName=%s\n",className,memberName,yyextra->curClassName.data());
+ DBG_CTX((stderr,"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))
@@ -2831,11 +2829,11 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
const MemberDef *md=0;
bool isLocal=FALSE;
- //printf("generateClassOrGlobalLink(className=%s)\n",className.data());
+ DBG_CTX((stderr,"generateClassOrGlobalLink(className=%s)\n",className.data()));
if (!yyextra->isPrefixedWithThis || (lcd=yyextra->theVarContext.findVariable(className))==0) // not a local variable
{
const Definition *d = yyextra->currentDefinition;
- //printf("d=%s yyextra->sourceFileDef=%s\n",d?d->name().data():"<none>",yyextra->sourceFileDef?yyextra->sourceFileDef->name().data():"<none>");
+ DBG_CTX((stderr,"d=%s yyextra->sourceFileDef=%s\n",d?d->name().data():"<none>",yyextra->sourceFileDef?yyextra->sourceFileDef->name().data():"<none>"));
cd = yyextra->symbolResolver.resolveClass(d,className);
md = yyextra->symbolResolver.getTypedef();
DBG_CTX((stderr,"non-local variable name=%s cd=%s md=%s!\n",
@@ -2859,7 +2857,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
writeMultiLineCodeLink(yyscanner,*yyextra->code,nd,clName);
return;
}
- //printf("md=%s\n",md?md->name().data():"<none>");
+ DBG_CTX((stderr,"md=%s\n",md?md->name().data():"<none>"));
DBG_CTX((stderr,"is found as a type cd=%s nd=%s\n",
cd?cd->name().data():"<null>",
nd?nd->name().data():"<null>"));
@@ -2873,10 +2871,10 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
}
else
{
- //printf("local variable!\n");
+ DBG_CTX((stderr,"local variable!\n"));
if (lcd->type()!=ScopedTypeVariant::Dummy)
{
- //printf("non-dummy context lcd=%s!\n",lcd->name().data());
+ DBG_CTX((stderr,"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
@@ -2900,8 +2898,8 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("_a%d",yyextra->anchorCount);
- //printf("addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
- // yyextra->exampleFile.data());
+ DBG_CTX((stderr,"addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
+ yyextra->exampleFile.data()));
ClassDefMutable *cdm = toClassDefMutable(const_cast<ClassDef*>(cd));
if (cdm && cdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
{
@@ -2933,7 +2931,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
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);
+ DBG_CTX((stderr,"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",
@@ -2982,17 +2980,17 @@ static bool generateClassMemberLink(yyscan_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());
+ DBG_CTX((stderr,"type='%s' args='%s' class=%s\n",
+ xmd->typeString(),xmd->argsString(),
+ xmd->getClassDef()->name().data()));
if (yyextra->exampleBlock)
{
std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("a%d",yyextra->anchorCount);
- //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
- // yyextra->exampleFile.data());
+ DBG_CTX((stderr,"addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
+ yyextra->exampleFile.data()));
MemberDefMutable *mdm = toMemberDefMutable(xmd);
if (mdm && mdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
{
@@ -3011,7 +3009,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
if (xd && xd->isLinkable())
{
- //printf("yyextra->currentDefinition=%p yyextra->currentMemberDef=%p xmd=%p yyextra->insideBody=%d\n",yyextra->currentDefinition,yyextra->currentMemberDef,xmd,yyextra->insideBody);
+ DBG_CTX((stderr,"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();
@@ -3045,7 +3043,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
{
const ClassDef *cd = toClassDef(def);
const MemberDef *xmd = cd->getMemberByName(memName);
- //printf("generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd);
+ DBG_CTX((stderr,"generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd));
if (xmd)
{
return generateClassMemberLink(yyscanner,ol,xmd,memName);
@@ -3065,7 +3063,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
else if (def && def->definitionType()==Definition::TypeNamespace)
{
const NamespaceDef *nd = toNamespaceDef(def);
- //printf("Looking for %s inside namespace %s\n",memName,nd->name().data());
+ DBG_CTX((stderr,"Looking for %s inside namespace %s\n",memName,nd->name().data()));
const Definition *innerDef = nd->findInnerCompound(memName);
if (innerDef)
{
@@ -3084,8 +3082,8 @@ static void generateMemberLink(yyscan_t yyscanner,
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());
+ DBG_CTX((stderr,"generateMemberLink(object=%s,mem=%s) classScope=%s\n",
+ varName.data(),memName,yyextra->classScope.data()));
if (varName.isEmpty()) return;
@@ -3095,10 +3093,10 @@ static void generateMemberLink(yyscan_t yyscanner,
{
if (stv->type()!=ScopedTypeVariant::Dummy)
{
- //printf("Class found!\n");
+ DBG_CTX((stderr,"Class found!\n"));
if (getLink(yyscanner,stv->name(),memName,ol))
{
- //printf("Found result!\n");
+ DBG_CTX((stderr,"Found result!\n"));
return;
}
if (stv->localDef() && !stv->localDef()->baseClasses().empty())
@@ -3107,7 +3105,7 @@ static void generateMemberLink(yyscan_t yyscanner,
{
if (getLink(yyscanner,bcName,memName,ol))
{
- //printf("Found result!\n");
+ DBG_CTX((stderr,"Found result!\n"));
return;
}
}
@@ -3119,7 +3117,7 @@ static void generateMemberLink(yyscan_t yyscanner,
const ClassDef *vcd = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,yyextra->classScope);
if (vcd && vcd->isLinkable())
{
- //printf("Found class %s for variable '%s'\n",yyextra->classScope.data(),varName.data());
+ DBG_CTX((stderr,"Found class %s for variable '%s'\n",yyextra->classScope.data(),varName.data()));
MemberName *vmn=Doxygen::memberNameLinkedMap->find(varName);
if (vmn==0)
{
@@ -3137,7 +3135,7 @@ static void generateMemberLink(yyscan_t yyscanner,
{
if (vmd->getClassDef()==jcd)
{
- //printf("Found variable type=%s\n",vmd->typeString());
+ DBG_CTX((stderr,"Found variable type=%s\n",vmd->typeString()));
const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope());
if (mcd && mcd->isLinkable())
{
@@ -3150,12 +3148,12 @@ static void generateMemberLink(yyscan_t yyscanner,
}
if (vmn)
{
- //printf("There is a variable with name '%s'\n",varName);
+ DBG_CTX((stderr,"There is a variable with name '%s'\n",varName));
for (const auto &vmd : *vmn)
{
if (vmd->getClassDef()==vcd)
{
- //printf("Found variable type=%s\n",vmd->typeString());
+ DBG_CTX((stderr,"Found variable type=%s\n",vmd->typeString()));
const ClassDef *mcd=stripClassName(yyscanner,vmd->typeString(),vmd->getOuterScope());
if (mcd && mcd->isLinkable())
{
@@ -3177,7 +3175,7 @@ static void generatePHPVariableLink(yyscan_t yyscanner,CodeOutputInterface &ol,c
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());
+ DBG_CTX((stderr,"generatePHPVariableLink(%s) name=%s scope=%s\n",varName,name.data(),yyextra->classScope.data()));
if (!getLink(yyscanner,yyextra->classScope,name,ol,varName))
{
codifyLines(yyscanner,varName);
@@ -3220,7 +3218,7 @@ static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,cons
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);
+ DBG_CTX((stderr,"ts=%d te=%d\n",ts,te));
if (ts!=-1 && te!=-1 && te>ts)
{
// remove template from scope
@@ -3228,7 +3226,7 @@ static void generateFunctionLink(yyscan_t yyscanner,CodeOutputInterface &ol,cons
}
ts=funcScope.find('<'); // start of template
te=funcScope.findRev('>'); // end of template
- //printf("ts=%d te=%d\n",ts,te);
+ DBG_CTX((stderr,"ts=%d te=%d\n",ts,te));
if (ts!=-1 && te!=-1 && te>ts)
{
// remove template from scope
@@ -3343,12 +3341,12 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
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());
+ DBG_CTX((stderr,"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());
+ DBG_CTX((stderr,"Looking for object=%s method=%s\n",ctx->objectTypeOrName.data(),
+ ctx->methodName.data()));
const ScopedTypeVariant *stv = yyextra->theVarContext.findVariable(ctx->objectTypeOrName);
if (stv==0) // not a local variable
{
@@ -3365,29 +3363,29 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
ctx->objectType = yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,ctx->objectTypeOrName);
ctx->method = yyextra->symbolResolver.getTypedef();
}
- //printf(" object is class? %p\n",ctx->objectType);
+ DBG_CTX((stderr," 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():"<none>");
+ DBG_CTX((stderr," yes->method=%s\n",ctx->method?ctx->method->name().data():"<none>"));
}
else if (ctx->method==0) // search for class variable with the same name
{
- //printf(" no\n");
- //printf("yyextra->currentDefinition=%p\n",yyextra->currentDefinition);
+ DBG_CTX((stderr," no\n"));
+ DBG_CTX((stderr,"yyextra->currentDefinition=%p\n",yyextra->currentDefinition));
if (yyextra->currentDefinition &&
yyextra->currentDefinition->definitionType()==Definition::TypeClass)
{
ctx->objectVar = (toClassDef(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName);
- //printf(" ctx->objectVar=%p\n",ctx->objectVar);
+ DBG_CTX((stderr," 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);
+ DBG_CTX((stderr," 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);
+ DBG_CTX((stderr," ctx->method=%p\n",ctx->method));
}
}
}
@@ -3395,7 +3393,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
}
else // local variable
{
- //printf(" object is local variable\n");
+ DBG_CTX((stderr," object is local variable\n"));
if (stv->globalDef() && !ctx->methodName.isEmpty())
{
const ClassDef *cd = toClassDef(stv->globalDef());
@@ -3403,13 +3401,13 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
{
ctx->method = cd->getMemberByName(ctx->methodName);
}
- //printf(" class=%p method=%p\n",cd,ctx->method);
+ DBG_CTX((stderr," class=%p method=%p\n",cd,ctx->method));
}
}
}
}
- //printf("[");
+ DBG_CTX((stderr,"["));
while ((c=*p++)) // for each character in ctx->format
{
if (c=='$')
@@ -3448,7 +3446,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
}
else
{
- //printf("Invalid name: id=%d\n",refId);
+ DBG_CTX((stderr,"Invalid name: id=%d\n",refId));
}
}
else if (nc=='o') // reference to potential object name
@@ -3539,7 +3537,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
}
else
{
- //printf("Invalid object: id=%d\n",refId);
+ DBG_CTX((stderr,"Invalid object: id=%d\n",refId));
}
}
else if (nc=='c') // reference to nested call
@@ -3578,12 +3576,12 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
ctx->method = ctx->objectType->getMemberByName(ctx->methodName);
}
}
- //printf(" ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType);
+ DBG_CTX((stderr," ***** method=%s -> object=%p\n",ictx->method->name().data(),ctx->objectType));
}
}
else
{
- //printf("Invalid context: id=%d\n",refId);
+ DBG_CTX((stderr,"Invalid context: id=%d\n",refId));
}
}
else if (nc=='w') // some word
@@ -3629,10 +3627,10 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
codifyLines(yyscanner,s);
}
}
- //printf("%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data());
- //printf("}=(type='%s',name='%s')",
- // ctx->objectTypeOrName.data(),
- // ctx->methodName.data());
+ DBG_CTX((stderr,"%s %s]\n",ctx->objectTypeOrName.data(),ctx->methodName.data()));
+ DBG_CTX((stderr,"}=(type='%s',name='%s')",
+ ctx->objectTypeOrName.data(),
+ ctx->methodName.data()));
}
// Replaces an Objective-C method name fragment s by a marker of the form
@@ -3717,13 +3715,13 @@ static void saveObjCContext(yyscan_t yyscanner)
if (yyextra->braceCount==0 && YY_START==ObjCCall)
{
yyextra->currentCtx->objectTypeOrName=yyextra->currentCtx->format.mid(1);
- //printf("new type=%s\n",yyextra->currentCtx->objectTypeOrName.data());
+ DBG_CTX((stderr,"new type=%s\n",yyextra->currentCtx->objectTypeOrName.data()));
}
yyextra->contextStack.push(yyextra->currentCtx);
}
else
{
- //printf("Trying to save NULL context!\n");
+ DBG_CTX((stderr,"Trying to save NULL context!\n"));
}
auto newCtx = std::make_unique<ObjCCallCtx>();
newCtx->id = yyextra->currentCtxId;
@@ -3732,7 +3730,7 @@ static void saveObjCContext(yyscan_t yyscanner)
newCtx->objectType = 0;
newCtx->objectVar = 0;
newCtx->method = 0;
- //printf("save state=%d\n",YY_START);
+ DBG_CTX((stderr,"save state=%d\n",YY_START));
yyextra->currentCtx = newCtx.get();
yyextra->contextMap.emplace(std::make_pair(yyextra->currentCtxId,std::move(newCtx)));
yyextra->braceCount = 0;
@@ -3742,7 +3740,7 @@ static void saveObjCContext(yyscan_t yyscanner)
static void restoreObjCContext(yyscan_t yyscanner)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- //printf("restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState);
+ DBG_CTX((stderr,"restore state=%d->%d\n",YY_START,yyextra->currentCtx->lexState));
BEGIN(yyextra->currentCtx->lexState);
yyextra->braceCount = yyextra->currentCtx->braceCount;
if (!yyextra->contextStack.empty())
@@ -3753,7 +3751,7 @@ static void restoreObjCContext(yyscan_t yyscanner)
else
{
yyextra->currentCtx = 0;
- //printf("Trying to pop context while yyextra->contextStack is empty!\n");
+ DBG_CTX((stderr,"Trying to pop context while yyextra->contextStack is empty!\n"));
}
}
@@ -3780,7 +3778,7 @@ CCodeParser::~CCodeParser()
void CCodeParser::resetCodeParserState()
{
struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
- //printf("***CodeParser::reset()\n");
+ DBG_CTX((stderr,"***CodeParser::reset()\n"));
yyextra->theVarContext.clear();
while (!yyextra->classScopeLengthStack.empty()) yyextra->classScopeLengthStack.pop();
yyextra->codeClassMap.clear();
@@ -3796,8 +3794,8 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const
{
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():"<none>");
+ DBG_CTX((stderr,"***parseCode() exBlock=%d exName=%s fd=%p className=%s searchCtx=%s\n",
+ exBlock,exName,fd,className,searchCtx?searchCtx->name().data():"<none>"));
if (s.isEmpty()) return;
@@ -3832,7 +3830,7 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const
yyextra->theCallContext.clear();
while (!yyextra->scopeStack.empty()) yyextra->scopeStack.pop();
yyextra->classScope = className;
- //printf("parseCCode %s\n",className);
+ DBG_CTX((stderr,"parseCCode %s\n",className));
yyextra->exampleBlock = exBlock;
yyextra->exampleName = exName;
yyextra->sourceFileDef = fd;
@@ -3858,10 +3856,10 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const
if (!yyextra->exampleName.isEmpty())
{
yyextra->exampleFile = convertNameToFile(yyextra->exampleName+"-example",FALSE,TRUE);
- //printf("yyextra->exampleFile=%s\n",yyextra->exampleFile.data());
+ DBG_CTX((stderr,"yyextra->exampleFile=%s\n",yyextra->exampleFile.data()));
}
yyextra->includeCodeFragment = inlineFragment;
- //printf("** exBlock=%d exName=%s include=%d\n",exBlock,exName,inlineFragment);
+ DBG_CTX((stderr,"** exBlock=%d exName=%s include=%d\n",exBlock,exName,inlineFragment));
startCodeLine(yyscanner);
yyextra->type.resize(0);
yyextra->name.resize(0);
diff --git a/src/config.xml b/src/config.xml
index d9b29aa..7d5808a 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -1316,22 +1316,33 @@ FILE_VERSION_FILTER = "cleartool desc -fmt \%Vn"
<docs>
<![CDATA[
If the \c WARN_IF_DOC_ERROR tag is set to \c YES, doxygen will generate warnings for
- potential errors in the documentation, such as not documenting some
- parameters in a documented function, or documenting parameters that
+ potential errors in the documentation, such as documenting some
+ parameters in a documented function twice, or documenting parameters that
don't exist or using markup commands wrongly.
]]>
</docs>
</option>
+ <option type='bool' id='WARN_IF_INCOMPLETE_DOC' defval='1'>
+ <docs>
+<![CDATA[
+ If \c WARN_IF_INCOMPLETE_DOC is set to \c YES, doxygen will warn about
+ incomplete function parameter documentation.
+ If set to \c NO, doxygen will accept that some parameters have no
+ documentation without warning.
+]]>
+ </docs>
+ </option>
<option type='bool' id='WARN_NO_PARAMDOC' defval='0'>
<docs>
<![CDATA[
This \c WARN_NO_PARAMDOC option can be enabled to get warnings for
functions that are documented, but have no documentation for their parameters
or return value. If set to \c NO, doxygen will only warn about
- wrong or incomplete parameter documentation, but not about the absence of
+ wrong parameter documentation, but not about the absence of
documentation.
If \ref cfg_extract_all "EXTRACT_ALL" is set to \c YES then this flag will
automatically be disabled.
+ See also \ref cfg_warn_if_incomplete_doc "WARN_IF_INCOMPLETE_DOC"
]]>
</docs>
</option>
diff --git a/src/constexp.h b/src/constexp.h
index 0b52e14..212387b 100644
--- a/src/constexp.h
+++ b/src/constexp.h
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2021 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -19,14 +16,14 @@
#ifndef _CONSTEXP_H
#define _CONSTEXP_H
-#include <qcstring.h>
+#include <string>
class ConstExpressionParser
{
public:
ConstExpressionParser();
~ConstExpressionParser();
- bool parse(const char *fileName,int line,const QCString &expression);
+ bool parse(const char *fileName,int line,const std::string &expression);
private:
struct Private;
Private *p;
diff --git a/src/constexp.l b/src/constexp.l
index 0f053bd..acff1eb 100644
--- a/src/constexp.l
+++ b/src/constexp.l
@@ -132,7 +132,7 @@ ConstExpressionParser::~ConstExpressionParser()
delete p;
}
-bool ConstExpressionParser::parse(const char *fileName,int lineNr,const QCString &s)
+bool ConstExpressionParser::parse(const char *fileName,int lineNr,const std::string &s)
{
struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
@@ -146,13 +146,13 @@ bool ConstExpressionParser::parse(const char *fileName,int lineNr,const QCString
yyextra->inputPosition = 0;
constexpYYrestart( yyin, p->yyscanner );
- printlex(yy_flex_debug, TRUE, __FILE__, fileName);
+ printlex(yy_flex_debug, true, __FILE__, fileName);
//printf("Expression: '%s'\n",s.data());
constexpYYparse(p->yyscanner);
//printf("Result: %ld\n",(long)g_resultValue);
- printlex(yy_flex_debug, FALSE, __FILE__, fileName);
+ printlex(yy_flex_debug, false, __FILE__, fileName);
bool result = (long)yyextra->resultValue!=0;
return result;
diff --git a/src/constexp.y b/src/constexp.y
index c4110f9..560b3c3 100644
--- a/src/constexp.y
+++ b/src/constexp.y
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2021 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -28,8 +25,8 @@
int constexpYYerror(yyscan_t yyscanner, const char *s)
{
struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
- warn(yyextra->constExpFileName, yyextra->constExpLineNr,
- "preprocessing issue while doing constant expression evaluation: %s: input='%s'",s,yyextra->inputString);
+ warn(yyextra->constExpFileName.c_str(), yyextra->constExpLineNr,
+ "preprocessing issue while doing constant expression evaluation: %s: input='%s'",s,yyextra->inputString.c_str());
return 0;
}
@@ -81,8 +78,8 @@ start: constant_expression
constant_expression: logical_or_expression
{ $$ = $1; }
- | logical_or_expression
- TOK_QUESTIONMARK logical_or_expression
+ | logical_or_expression
+ TOK_QUESTIONMARK logical_or_expression
TOK_COLON logical_or_expression
{
bool c = ($1.isInt() ? ((long)$1 != 0) : ((double)$1 != 0.0));
@@ -108,9 +105,9 @@ logical_and_expression: inclusive_or_expression
inclusive_or_expression: exclusive_or_expression
{ $$ = $1; }
- | inclusive_or_expression TOK_BITWISEOR
+ | inclusive_or_expression TOK_BITWISEOR
exclusive_or_expression
- {
+ {
$$ = CPPValue( (long)$1 | (long)$3 );
}
;
@@ -126,7 +123,7 @@ exclusive_or_expression: and_expression
and_expression: equality_expression
{ $$ = $1; }
| and_expression TOK_AMPERSAND equality_expression
- {
+ {
$$ = CPPValue( (long)$1 & (long)$3 );
}
;
@@ -134,7 +131,7 @@ and_expression: equality_expression
equality_expression: relational_expression
{ $$ = $1; }
| equality_expression TOK_EQUAL relational_expression
- {
+ {
$$ = CPPValue( (long)((double)$1 == (double)$3) );
}
| equality_expression TOK_NOTEQUAL relational_expression
@@ -146,7 +143,7 @@ equality_expression: relational_expression
relational_expression: shift_expression
{ $$ = $1; }
| relational_expression TOK_LESSTHAN shift_expression
- {
+ {
$$ = CPPValue( (long)((double)$1 < (double)$3) );
}
| relational_expression TOK_GREATERTHAN shift_expression
@@ -169,7 +166,7 @@ shift_expression: additive_expression
{ $$ = $1; }
| shift_expression TOK_SHIFTLEFT additive_expression
{
- $$ = CPPValue( (long)$1 << (long)$3 );
+ $$ = CPPValue( (long)$1 << (long)$3 );
}
| shift_expression TOK_SHIFTRIGHT additive_expression
{
@@ -185,7 +182,7 @@ additive_expression: multiplicative_expression
{
$$ = CPPValue( (double)$1 + (double)$3 );
}
- else
+ else
{
$$ = CPPValue( (long)$1 + (long)$3 );
}
@@ -196,7 +193,7 @@ additive_expression: multiplicative_expression
{
$$ = CPPValue( (double)$1 - (double)$3 );
}
- else
+ else
{
$$ = CPPValue( (long)$1 - (long)$3 );
}
@@ -206,7 +203,7 @@ additive_expression: multiplicative_expression
multiplicative_expression: unary_expression
{ $$ = $1; }
| multiplicative_expression TOK_STAR unary_expression
- {
+ {
if (!$1.isInt() || !$3.isInt())
{
$$ = CPPValue( (double)$1 * (double)$3 );
@@ -217,7 +214,7 @@ multiplicative_expression: unary_expression
}
}
| multiplicative_expression TOK_DIVIDE unary_expression
- {
+ {
if (!$1.isInt() || !$3.isInt())
{
$$ = CPPValue( (double)$1 / (double)$3 );
@@ -230,7 +227,7 @@ multiplicative_expression: unary_expression
}
}
| multiplicative_expression TOK_MOD unary_expression
- {
+ {
long value = $3;
if (value==0) value=1;
$$ = CPPValue( (long)$1 % value );
@@ -242,8 +239,8 @@ unary_expression: primary_expression
| TOK_PLUS unary_expression
{ $$ = $1; }
| TOK_MINUS unary_expression
- {
- if ($2.isInt())
+ {
+ if ($2.isInt())
$$ = CPPValue(-(long)$2);
else
$$ = CPPValue(-(double)$2);
diff --git a/src/constexp_p.h b/src/constexp_p.h
index ad09b2d..1f3408b 100644
--- a/src/constexp_p.h
+++ b/src/constexp_p.h
@@ -1,10 +1,10 @@
/******************************************************************************
*
- * Copyright (C) 1997-2019 by Dimitri van Heesch.
+ * Copyright (C) 1997-2021 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -16,7 +16,7 @@
#ifndef _CONSTEXP_P_H
#define _CONSTEXP_P_H
-#include <qcstring.h>
+#include <string>
//! @file
//! @brief Private interface between Parser (constexp.y) and Lexer (constexp.l)
@@ -27,12 +27,12 @@
typedef void* yyscan_t;
struct constexpYY_state
{
- QCString strToken;
- CPPValue resultValue;
- int constExpLineNr;
- QCString constExpFileName;
+ std::string strToken;
+ CPPValue resultValue;
+ int constExpLineNr;
+ std::string constExpFileName;
- const char *inputString;
+ std::string inputString;
int inputPosition;
};
constexpYY_state* constexpYYget_extra(yyscan_t yyscanner );
diff --git a/src/context.cpp b/src/context.cpp
index 572e0d3..d2cfa9e 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -4046,11 +4046,11 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
s_inst.addProperty("nameWithContextFor", &Private::nameWithContextFor);
init=TRUE;
}
- if (md && !md->cookie()) { md->setCookie(new MemberContext::Private::Cachable(md)); }
+ if (!md->cookie()) { md->setCookie(new MemberContext::Private::Cachable(md)); }
Cachable &cache = getCache();
cache.propertyAttrs.reset(TemplateList::alloc());
- if (md && md->isProperty())
+ if (md->isProperty())
{
if (md->isGettable()) cache.propertyAttrs->append("get");
if (md->isPrivateGettable()) cache.propertyAttrs->append("private get");
@@ -4060,7 +4060,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
if (md->isProtectedSettable()) cache.propertyAttrs->append("protected set");
}
cache.eventAttrs.reset(TemplateList::alloc());
- if (md && md->isEvent())
+ if (md->isEvent())
{
if (md->isAddable()) cache.eventAttrs->append("add");
if (md->isRemovable()) cache.eventAttrs->append("remove");
diff --git a/src/cppvalue.cpp b/src/cppvalue.cpp
index 1543498..31f0ab5 100644
--- a/src/cppvalue.cpp
+++ b/src/cppvalue.cpp
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2021 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -21,30 +18,30 @@
#include "cppvalue.h"
#include "constexp.h"
-CPPValue parseOctal(const QCString& token)
+CPPValue parseOctal(const std::string& token)
{
long val = 0;
- for (const char *p = token.data(); *p != 0; p++)
+ for (const char *p = token.c_str(); *p != 0; p++)
{
if (*p >= '0' && *p <= '7') val = val * 8 + *p - '0';
}
return CPPValue(val);
}
-CPPValue parseDecimal(const QCString& token)
+CPPValue parseDecimal(const std::string& token)
{
long val = 0;
- for (const char *p = token.data(); *p != 0; p++)
+ for (const char *p = token.c_str(); *p != 0; p++)
{
if (*p >= '0' && *p <= '9') val = val * 10 + *p - '0';
}
return CPPValue(val);
}
-CPPValue parseHexadecimal(const QCString& token)
+CPPValue parseHexadecimal(const std::string& token)
{
long val = 0;
- for (const char *p = token.data(); *p != 0; p++)
+ for (const char *p = token.c_str(); *p != 0; p++)
{
if (*p >= '0' && *p <= '9') val = val * 16 + *p - '0';
else if (*p >= 'a' && *p <= 'f') val = val * 16 + *p - 'a' + 10;
@@ -54,7 +51,7 @@ CPPValue parseHexadecimal(const QCString& token)
return CPPValue(val);
}
-CPPValue parseCharacter(const QCString& token) // does not work for '\n' and the alike
+CPPValue parseCharacter(const std::string& token) // does not work for '\n' and the alike
{
if (token[1]=='\\')
{
@@ -80,16 +77,16 @@ CPPValue parseCharacter(const QCString& token) // does not work for '\n' and the
case '6': // fall through
case '7': // fall through
return parseOctal(token);
- case 'x':
+ case 'x':
case 'X': return parseHexadecimal(token);
- default: printf("Invalid escape sequence %s found!\n",token.data());
- return CPPValue(0L);
+ default: printf("Invalid escape sequence %s found!\n",token.data());
+ return CPPValue(0L);
}
}
return CPPValue((long)token[1]);
}
-CPPValue parseFloat(const QCString& token)
+CPPValue parseFloat(const std::string& token)
{
- return CPPValue(atof(token));
+ return CPPValue(std::stod(token));
}
diff --git a/src/cppvalue.h b/src/cppvalue.h
index cde033d..7732068 100644
--- a/src/cppvalue.h
+++ b/src/cppvalue.h
@@ -1,13 +1,10 @@
/******************************************************************************
*
- *
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2021 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -19,16 +16,15 @@
#ifndef _CPPVALUE_H
#define _CPPVALUE_H
-#include <stdio.h>
-#include <qglobal.h>
-#include <qcstring.h>
+#include <cstdio>
+#include <string>
/** A class representing a C-preprocessor value. */
class CPPValue
{
public:
enum Type { Int, Float };
-
+
CPPValue(long val=0) : type(Int) { v.l = val; }
CPPValue(double val) : type(Float) { v.d = val; }
@@ -36,10 +32,10 @@ class CPPValue
operator long () const { return type==Int ? v.l : (long)v.d; }
bool isInt() const { return type == Int; }
-
+
void print() const
{
- if (type==Int)
+ if (type==Int)
printf("(%ld)\n",v.l);
else
printf("(%f)\n",v.d);
@@ -53,10 +49,10 @@ class CPPValue
} v;
};
-extern CPPValue parseOctal(const QCString& token);
-extern CPPValue parseDecimal(const QCString& token);
-extern CPPValue parseHexadecimal(const QCString& token);
-extern CPPValue parseCharacter(const QCString& token);
-extern CPPValue parseFloat(const QCString& token);
+extern CPPValue parseOctal(const std::string& token);
+extern CPPValue parseDecimal(const std::string& token);
+extern CPPValue parseHexadecimal(const std::string& token);
+extern CPPValue parseCharacter(const std::string& token);
+extern CPPValue parseFloat(const std::string& token);
#endif
diff --git a/src/debug.cpp b/src/debug.cpp
index c270b47..bc5abb2 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -31,6 +31,7 @@ static std::map< std::string, Debug::DebugMask > s_labels =
{ "functions", Debug::Functions },
{ "variables", Debug::Variables },
{ "preprocessor", Debug::Preprocessor },
+ { "nolineno", Debug::NoLineNo },
{ "classes", Debug::Classes },
{ "commentcnv", Debug::CommentCnv },
{ "commentscan", Debug::CommentScan },
@@ -79,7 +80,7 @@ static int labelToEnumValue(const char *l)
int Debug::setFlag(const char *lab)
{
int retVal = labelToEnumValue(lab);
- curMask = (DebugMask)(curMask | labelToEnumValue(lab));
+ curMask = (DebugMask)(curMask | retVal);
return retVal;
}
diff --git a/src/debug.h b/src/debug.h
index e71595f..5d4717a 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -37,7 +37,8 @@ class Debug
Lex = 0x00002000,
Plantuml = 0x00004000,
FortranFixed2Free = 0x00008000,
- Cite = 0x00010000
+ Cite = 0x00010000,
+ NoLineNo = 0x00020000
};
static void print(DebugMask mask,int prio,const char *fmt,...);
diff --git a/src/docparser.cpp b/src/docparser.cpp
index a179904..b63674a 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -512,7 +512,7 @@ static void checkRetvalName(const QCString &name)
*/
static void checkUnOrMultipleDocumentedParams()
{
- if (g_memberDef && g_hasParamCommand && Config_getBool(WARN_IF_DOC_ERROR))
+ if (g_memberDef && g_hasParamCommand)
{
const ArgumentList &al=g_memberDef->isDocsForDefinition() ?
g_memberDef->argumentList() :
@@ -544,7 +544,7 @@ static void checkUnOrMultipleDocumentedParams()
if (argName == par) count++;
}
}
- if (count > 1)
+ if ((count > 1) && Config_getBool(WARN_IF_DOC_ERROR))
{
warn_doc_error(g_memberDef->getDefFileName(),
g_memberDef->getDefLine(),
@@ -555,7 +555,7 @@ static void checkUnOrMultipleDocumentedParams()
" has multiple @param documentation sections").data());
}
}
- if (notArgCnt>0)
+ if ((notArgCnt>0) && Config_getBool(WARN_IF_INCOMPLETE_DOC))
{
bool first=TRUE;
QCString errMsg=
@@ -587,10 +587,10 @@ static void checkUnOrMultipleDocumentedParams()
errMsg+=" parameter '"+argName+"'";
}
}
- warn_doc_error(g_memberDef->getDefFileName(),
- g_memberDef->getDefLine(),
- "%s",
- substitute(errMsg,"%","%%").data());
+ warn_incomplete_doc(g_memberDef->getDefFileName(),
+ g_memberDef->getDefLine(),
+ "%s",
+ substitute(errMsg,"%","%%").data());
}
}
}
@@ -829,6 +829,7 @@ inline void errorHandleDefaultToken(DocNode *parent,int tok,
{
case TK_COMMAND_AT:
cmd_start = "@";
+ // fall through
case TK_COMMAND_BS:
children.push_back(std::make_unique<DocWord>(parent,TK_COMMAND_CHAR(tok) + g_token->name));
warn_doc_error(g_fileName,getDoctokinizerLineNr(),"Illegal command %s as part of a %s",
@@ -1519,7 +1520,7 @@ reparsetoken:
{
QCString scope;
doctokenizerYYsetStateSetScope();
- doctokenizerYYlex();
+ (void)doctokenizerYYlex();
scope = g_token->name;
g_context = scope;
//printf("Found scope='%s'\n",scope.data());
diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp
index 3a14577..1dc1380 100644
--- a/src/dotgroupcollaboration.cpp
+++ b/src/dotgroupcollaboration.cpp
@@ -288,6 +288,7 @@ void DotGroupCollaboration::Edge::write( FTextStream &t ) const
{
if (first) first=FALSE; else t << "\\n";
t << DotNode::convertLabel(link.label);
+ count++;
}
if (count==maxLabels) t << "\\n...";
t << "\"";
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index f5a280b..28bb49b 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -106,6 +106,14 @@
#include "clangparser.h"
#include "symbolresolver.h"
+#if USE_SQLITE3
+#include <sqlite3.h>
+#endif
+
+#if USE_LIBCLANG
+#include <clang/Basic/Version.h>
+#endif
+
// provided by the generated file resources.cpp
extern void initResources();
@@ -9959,6 +9967,39 @@ static void devUsage()
//----------------------------------------------------------------------------
+// print the version of doxygen
+
+static void version(const bool extended)
+{
+ QCString versionString = getFullVersion();
+ msg("%s\n",versionString.data());
+ if (extended)
+ {
+ QCString extVers;
+#if USE_SQLITE3
+ if (!extVers.isEmpty()) extVers+= ", ";
+ extVers += "sqlite3 ";
+ extVers += sqlite3_libversion();
+#endif
+#if USE_LIBCLANG
+ if (!extVers.isEmpty()) extVers+= ", ";
+ extVers += "clang support ";
+ extVers += CLANG_VERSION_STRING;
+#endif
+#if MULTITHREADED_SOURCE_GENERATOR
+ if (!extVers.isEmpty()) extVers+= ", ";
+ extVers += "multi-threaded support ";
+#endif
+ if (!extVers.isEmpty())
+ {
+ int lastComma = extVers.findRev(',');
+ if (lastComma != -1) extVers = extVers.replace(lastComma,1," and");
+ msg(" with %s.\n",extVers.data());
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
// print the usage of doxygen
static void usage(const char *name,const char *versionString)
@@ -9992,7 +10033,7 @@ static void usage(const char *name,const char *versionString)
msg("If -s is specified the comments of the configuration items in the config file will be omitted.\n");
msg("If configName is omitted 'Doxyfile' will be used as a default.\n");
msg("If - is used for configFile doxygen will write / read the configuration to /from standard output / input.\n\n");
- msg("-v print version string\n");
+ msg("-v print version string, -V print extended version information\n");
}
//----------------------------------------------------------------------------
@@ -10400,7 +10441,12 @@ void readConfiguration(int argc, char **argv)
g_dumpSymbolMap = TRUE;
break;
case 'v':
- msg("%s\n",versionString.data());
+ version(false);
+ cleanUpDoxygen();
+ exit(0);
+ break;
+ case 'V':
+ version(true);
cleanUpDoxygen();
exit(0);
break;
@@ -10412,7 +10458,14 @@ void readConfiguration(int argc, char **argv)
}
else if (qstrcmp(&argv[optind][2],"version")==0)
{
- msg("%s\n",versionString.data());
+ version(false);
+ cleanUpDoxygen();
+ exit(0);
+ }
+ else if ((qstrcmp(&argv[optind][2],"Version")==0) ||
+ (qstrcmp(&argv[optind][2],"VERSION")==0))
+ {
+ version(true);
cleanUpDoxygen();
exit(0);
}
diff --git a/src/doxygen.h b/src/doxygen.h
index 5c8ad1b..227efcc 100644
--- a/src/doxygen.h
+++ b/src/doxygen.h
@@ -16,8 +16,6 @@
#ifndef DOXYGEN_H
#define DOXYGEN_H
-#include <qdatetime.h>
-
#include "containers.h"
#include "ftextstream.h"
#include "membergroup.h"
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 4b2f623..b900148 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -258,8 +258,9 @@ bool GroupDefImpl::addClass(const ClassDef *cd)
bool GroupDefImpl::addNamespace(const NamespaceDef *def)
{
+ //printf("adding namespace hidden=%d\n",def->isHidden());
if (def->isHidden()) return false;
- if (m_namespaces.find(def->name())!=0)
+ if (m_namespaces.find(def->name())==0)
{
updateLanguage(def);
m_namespaces.add(def->name(),def);
@@ -1310,11 +1311,11 @@ void addClassToGroups(const Entry *root,ClassDef *cd)
void addNamespaceToGroups(const Entry *root,NamespaceDef *nd)
{
- //printf("root->groups.size()=%d\n",root->groups.size());
+ //printf("root->groups.size()=%zu\n",root->groups.size());
for (const Grouping &g : root->groups)
{
GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname);
- //printf("group '%s'\n",s->data());
+ //printf("group '%s' gd=%p\n",g.groupname.data(),(void*)gd);
if (gd && gd->addNamespace(nd))
{
NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
@@ -1373,8 +1374,8 @@ void addGroupToGroups(const Entry *root,GroupDef *subGroup)
/*! Add a member to the group with the highest priority */
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() );
+ //printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n",
+ // root, root->name.data(), md, md->name().data(), root->groups.size() );
// Search entry's group list for group with highest pri.
Grouping::GroupPri_t pri = Grouping::GROUPING_LOWEST;
diff --git a/src/index.cpp b/src/index.cpp
index 4791ed5..1f425d4 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -25,7 +25,6 @@
#include <assert.h>
#include <qtextstream.h>
-#include <qdatetime.h>
#include <qdir.h>
#include <qregexp.h>
@@ -1411,17 +1410,19 @@ static void writeFileIndex(OutputList &ol)
QCString path=fd->getPath();
if (path.isEmpty()) path="[external]";
auto it = pathMap.find(path.str());
- if (it!=pathMap.end())
+ if (it!=pathMap.end()) // existing path -> append
{
outputFiles.at(it->second).files.push_back(fd.get());
}
- else
+ else // new path -> create path entry + append
{
pathMap.insert(std::make_pair(path.str(),outputFiles.size()));
outputFiles.emplace_back(path);
+ outputFiles.back().files.push_back(fd.get());
}
}
}
+
// sort the files by path
std::sort(outputFiles.begin(),
outputFiles.end(),
diff --git a/src/layout.cpp b/src/layout.cpp
index 427747e..b8984e0 100644
--- a/src/layout.cpp
+++ b/src/layout.cpp
@@ -32,6 +32,7 @@
#include "config.h"
#include "xml.h"
#include "resourcemgr.h"
+#include "debug.h"
inline QCString compileOptions(const QCString &def)
{
@@ -1503,7 +1504,7 @@ void LayoutDocManager::init()
XMLParser parser(handlers);
layoutParser.setDocumentLocator(&parser);
QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml");
- parser.parse("layout_default.xml",layout_default);
+ parser.parse("layout_default.xml",layout_default,Debug::isFlagSet(Debug::Lex));
}
LayoutDocManager::~LayoutDocManager()
@@ -1546,7 +1547,7 @@ void LayoutDocManager::parse(const char *fileName)
handlers.error = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); };
XMLParser parser(handlers);
layoutParser.setDocumentLocator(&parser);
- parser.parse(fileName,fileToString(fileName));
+ parser.parse(fileName,fileToString(fileName),Debug::isFlagSet(Debug::Lex));
}
//---------------------------------------------------------------------------------
diff --git a/src/message.cpp b/src/message.cpp
index 95a7553..5f06984 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -240,6 +240,14 @@ void warn_undoc(const char *file,int line,const char *fmt, ...)
va_end(args);
}
+void warn_incomplete_doc(const char *file,int line,const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ do_warn(Config_getBool(WARN_IF_INCOMPLETE_DOC), file, line, warning_str, fmt, args);
+ va_end(args);
+}
+
void warn_doc_error(const char *file,int line,const char *fmt, ...)
{
va_list args;
diff --git a/src/message.h b/src/message.h
index af49632..aa63ecb 100644
--- a/src/message.h
+++ b/src/message.h
@@ -29,6 +29,7 @@ extern void warn(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4
extern void va_warn(const char* file, int line, const char* fmt, va_list args);
extern void warn_simple(const char *file,int line,const char *text);
extern void warn_undoc(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4);
+extern void warn_incomplete_doc(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4);
extern void warn_doc_error(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4);
extern void warn_uncond(const char *fmt, ...) PRINTFLIKE(1, 2);
extern void err(const char *fmt, ...) PRINTFLIKE(1, 2);
diff --git a/src/pre.l b/src/pre.l
index 4a86562..21746a0 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -2702,7 +2702,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 state->constExpParser.parse(state->yyFileName,state->yyLineNr,e);
+ return state->constExpParser.parse(state->yyFileName,state->yyLineNr,e.str());
}
/*! expands the macro definition in \a name
@@ -3390,11 +3390,12 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output
char *newPos=output.data()+output.curPos();
Debug::print(Debug::Preprocessor,0,"Preprocessor output of %s (size: %d bytes):\n",fileName,newPos-orgPos);
int line=1;
- Debug::print(Debug::Preprocessor,0,"---------\n00001 ");
+ Debug::print(Debug::Preprocessor,0,"---------\n");
+ if (!Debug::isFlagSet(Debug::NoLineNo)) Debug::print(Debug::Preprocessor,0,"00001 ");
while (orgPos<newPos)
{
putchar(*orgPos);
- if (*orgPos=='\n') Debug::print(Debug::Preprocessor,0,"%05d ",++line);
+ if (*orgPos=='\n' && !Debug::isFlagSet(Debug::NoLineNo)) Debug::print(Debug::Preprocessor,0,"%05d ",++line);
orgPos++;
}
Debug::print(Debug::Preprocessor,0,"\n---------\n");
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp
index f04fb38..65a5258 100644
--- a/src/rtfgen.cpp
+++ b/src/rtfgen.cpp
@@ -17,6 +17,8 @@
*
*/
+#include <chrono>
+#include <ctime>
#include <stdlib.h>
#include <qdir.h>
@@ -48,16 +50,20 @@
#include "filename.h"
#include "namespacedef.h"
+
//#define DBG_RTF(x) x;
#define DBG_RTF(x)
static QCString dateToRTFDateString()
{
- const QDateTime &d = QDateTime::currentDateTime();
+ auto now = std::chrono::system_clock::now();
+ auto time = std::chrono::system_clock::to_time_t(now);
+ auto tm = *localtime(&time);
+
QCString result;
result.sprintf("\\yr%d\\mo%d\\dy%d\\hr%d\\min%d\\sec%d",
- d.date().year(), d.date().month(), d.date().day(),
- d.time().hour(),d.time().minute(),d.time().second());
+ tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
return result;
}
diff --git a/src/scanner.l b/src/scanner.l
index 19381dd..6970d3e 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -7197,7 +7197,7 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt)
// deep copy group list from parent (see bug 727732)
bool autoGroupNested = Config_getBool(GROUP_NESTED_COMPOUNDS);
- if (autoGroupNested && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum))
+ if (autoGroupNested && !rt->groups.empty() && ce->section!=Entry::ENUM_SEC && !(ce->spec&Entry::Enum))
{
ce->groups = rt->groups;
}
diff --git a/src/tagreader.cpp b/src/tagreader.cpp
index d5f8d5f..0a7c8f1 100644
--- a/src/tagreader.cpp
+++ b/src/tagreader.cpp
@@ -38,6 +38,7 @@
#include "filename.h"
#include "section.h"
#include "containers.h"
+#include "debug.h"
/** Information about an linkable anchor */
class TagAnchorInfo
@@ -1499,7 +1500,7 @@ void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullName)
handlers.error = [&tagFileParser](const std::string &fileName,int lineNr,const std::string &msg) { tagFileParser.error(fileName,lineNr,msg); };
XMLParser parser(handlers);
tagFileParser.setDocumentLocator(&parser);
- parser.parse(fullName,inputStr);
+ parser.parse(fullName,inputStr,Debug::isFlagSet(Debug::Lex));
tagFileParser.buildLists(root);
tagFileParser.addIncludes();
//tagFileParser.dump();
diff --git a/src/util.cpp b/src/util.cpp
index d387b02..3bf349a 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -22,6 +22,7 @@
#include <cinttypes>
#include <string.h>
+#include <ctime>
#include <mutex>
#include <unordered_set>
@@ -30,7 +31,6 @@
#include <qregexp.h>
#include <qfileinfo.h>
#include <qdir.h>
-#include <qdatetime.h>
#include "util.h"
#include "message.h"
@@ -1418,11 +1418,10 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode)
return "";
}
-static QDateTime getCurrentDateTime()
+static std::tm getCurrentDateTime()
{
- QDateTime current = QDateTime::currentDateTime();
QCString sourceDateEpoch = Portable::getenv("SOURCE_DATE_EPOCH");
- if (!sourceDateEpoch.isEmpty())
+ if (!sourceDateEpoch.isEmpty()) // see https://reproducible-builds.org/specs/source-date-epoch/
{
bool ok;
uint64 epoch = sourceDateEpoch.toUInt64(&ok);
@@ -1436,42 +1435,39 @@ static QDateTime getCurrentDateTime()
warnedOnce=TRUE;
}
}
- else if (epoch>UINT_MAX)
+ else // use given epoch value as current 'built' time
{
- static bool warnedOnce=FALSE;
- if (!warnedOnce)
- {
- warn_uncond("Environment variable SOURCE_DATE_EPOCH must have a value smaller than or equal to %d; actual value %" PRIu64 "\n",UINT_MAX, (uint64_t)epoch);
- warnedOnce=TRUE;
- }
- }
- else // all ok, replace current time with epoch value
- {
- current.setTimeUtc_t((ulong)epoch); // TODO: add support for 64bit epoch value
+ auto epoch_start = std::chrono::time_point<std::chrono::system_clock>{};
+ auto epoch_seconds = std::chrono::seconds(epoch);
+ auto build_time = epoch_start + epoch_seconds;
+ std::time_t time = std::chrono::system_clock::to_time_t(build_time);
+ return *gmtime(&time);
}
}
- return current;
+
+ // return current local time
+ auto now = std::chrono::system_clock::now();
+ std::time_t time = std::chrono::system_clock::to_time_t(now);
+ return *localtime(&time);
}
QCString dateToString(bool includeTime)
{
- const QDateTime current = getCurrentDateTime();
- return theTranslator->trDateTime(current.date().year(),
- current.date().month(),
- current.date().day(),
- current.date().dayOfWeek(),
- current.time().hour(),
- current.time().minute(),
- current.time().second(),
+ auto current = getCurrentDateTime();
+ return theTranslator->trDateTime(current.tm_year + 1900,
+ current.tm_mon + 1,
+ current.tm_mday,
+ (current.tm_wday+6)%7+1, // map: Sun=0..Sat=6 to Mon=1..Sun=7
+ current.tm_hour,
+ current.tm_min,
+ current.tm_sec,
includeTime);
}
QCString yearToString()
{
- const QDateTime current = getCurrentDateTime();
- QCString result;
- result.sprintf("%d", current.date().year());
- return result;
+ auto current = getCurrentDateTime();
+ return QCString().setNum(current.tm_year+1900);
}
//----------------------------------------------------------------------
@@ -1933,12 +1929,10 @@ static bool matchArgument2(
dstA.canType=""; // invalidate cached type value
}
- if (srcA.canType.isEmpty())
+ if (srcA.canType.isEmpty() || dstA.canType.isEmpty())
{
+ // need to re-evaluate both see issue #8370
srcA.canType = extractCanonicalArgType(srcScope,srcFileScope,srcA);
- }
- if (dstA.canType.isEmpty())
- {
dstA.canType = extractCanonicalArgType(dstScope,dstFileScope,dstA);
}
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index ce1224f..299ae26 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -3046,8 +3046,9 @@ void FlowChart::colTextNodes()
const FlowChart &ftemp = flowList[j+1];
if (ftemp.type & EMPTY)
{
- flowList.insert(flowList.begin()+j+1,FlowChart(TEXT_NO,"empty ",0));
- flowList[j+1].stamp = flo.stamp;
+ FlowChart fc(TEXT_NO,"empty ",0);
+ fc.stamp = flo.stamp;
+ flowList.insert(flowList.begin()+j+1,fc);
}
}
}
diff --git a/src/xml.h b/src/xml.h
deleted file mode 100644
index add95f1..0000000
--- a/src/xml.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef XML_H
-#define XML_H
-
-#include <memory>
-#include <functional>
-#include <string>
-#include <unordered_map>
-
-/*! @brief Event handlers that can installed by the client and called while parsing a XML document.
- */
-class XMLHandlers
-{
- public:
- using Attributes = std::unordered_map<std::string,std::string>;
- using StartDocType = void();
- using EndDocType = void();
- using StartElementType = void(const std::string &,const Attributes &);
- using EndElementType = void(const std::string &);
- using ErrorType = void(const std::string,int,const std::string &);
- using CharsType = void(const std::string &);
-
- std::function<StartDocType> startDocument; /**< handler invoked at the start of the document */
- std::function<EndDocType> endDocument; /**< handler invoked at the end of the document */
- std::function<StartElementType> startElement; /**< handler invoked when an opening tag has been found */
- std::function<EndElementType> endElement; /**< handler invoked when a closing tag has been found */
- std::function<CharsType> characters; /**< handler invoked when content between tags has been found */
- std::function<ErrorType> error; /**< handler invoked when the parser encounters an error */
-
- static std::string value(const Attributes &attrib,const std::string &key)
- {
- auto it = attrib.find(key);
- if (it!=attrib.end())
- {
- return it->second;
- }
- return "";
- }
-};
-
-class XMLLocator
-{
- public:
- virtual ~XMLLocator() {}
- virtual int lineNr() const = 0;
- virtual std::string fileName() const = 0;
-};
-
-/*! Very basic SAX style parser to parse XML documents. */
-class XMLParser : public XMLLocator
-{
- public:
- /*! Creates an instance of the parser object. Different instances can run on different
- * threads without interference.
- *
- * @param handlers The event handlers passed by the client.
- */
- XMLParser(const XMLHandlers &handlers);
- /*! Destructor */
- ~XMLParser();
-
- /*! Parses a file gives the contents of the file as a string.
- * @param fileName the name of the file, used for error reporting.
- * @param inputString the contents of the file as a zero terminated UTF-8 string.
- */
- void parse(const char *fileName,const char *inputString);
-
- private:
- virtual int lineNr() const override;
- virtual std::string fileName() const override;
- struct Private;
- std::unique_ptr<Private> p;
-};
-
-#endif
diff --git a/src/xml.l b/src/xml.l
deleted file mode 100644
index ace35d5..0000000
--- a/src/xml.l
+++ /dev/null
@@ -1,484 +0,0 @@
-/******************************************************************************
- *
- * Copyright (C) 1997-2020 by Dimitri van Heesch.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * 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.
- *
- */
-/******************************************************************************
- * Minimal flex based parser for XML
- ******************************************************************************/
-
-%option never-interactive
-%option prefix="xmlYY"
-%option reentrant
-%option extra-type="struct xmlYY_state *"
-%option 8bit noyywrap
-%top{
-#include <stdint.h>
-}
-
-%{
-
-#include <ctype.h>
-#include <vector>
-#include <stdio.h>
-#include "xml.h"
-#include "message.h"
-
-#define YY_NEVER_INTERACTIVE 1
-#define YY_NO_INPUT 1
-#define YY_NO_UNISTD_H 1
-
-struct xmlYY_state
-{
- std::string fileName;
- int lineNr = 1;
- const char * inputString = 0; //!< the code fragment as text
- yy_size_t inputPosition = 0; //!< read offset during parsing
- std::string name;
- bool isEnd = false;
- bool selfClose = false;
- std::string data;
- std::string attrValue;
- std::string attrName;
- XMLHandlers::Attributes attrs;
- XMLHandlers handlers;
- int cdataContext;
- int commentContext;
- char stringChar;
- std::vector<std::string> xpath;
-};
-
-#if USE_STATE2STRING
-static const char *stateToString(int state);
-#endif
-
-static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
-static void initElement(yyscan_t yyscanner);
-static void addCharacters(yyscan_t yyscanner);
-static void addElement(yyscan_t yyscanner);
-static void addAttribute(yyscan_t yyscanner);
-static void countLines(yyscan_t yyscanner, const char *txt,yy_size_t len);
-static void reportError(yyscan_t yyscanner, const std::string &msg);
-static std::string processData(yyscan_t yyscanner,const char *txt,yy_size_t len);
-
-#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
-
-%}
-
-NL (\r\n|\r|\n)
-SP [ \t\r\n]+
-OPEN {SP}?"<"
-OPENSPECIAL {SP}?"<?"
-CLOSE ">"{NL}?
-CLOSESPECIAL "?>"{NL}?
-NAMESTART [:A-Za-z\200-\377_]
-NAMECHAR [:A-Za-z\200-\377_0-9.-]
-NAME {NAMESTART}{NAMECHAR}*
-ESC "&#"[0-9]+";"|"&#x"[0-9a-fA-F]+";"
-COLON ":"
-PCDATA [^<]+
-COMMENT {OPEN}"!--"
-COMMENTEND "--"{CLOSE}
-STRING \"([^"&]|{ESC})*\"|\'([^'&]|{ESC})*\'
-DOCTYPE {SP}?"<!DOCTYPE"{SP}
-CDATA {SP}?"<![CDATA["
-ENDCDATA "]]>"
-
-%option noyywrap
-
-%s Initial
-%s Content
-%s CDataSection
-%s Element
-%s Attributes
-%s AttributeValue
-%s AttrValueStr
-%s Prolog
-%s Comment
-
-%%
-
-<Initial>{
- {SP} { countLines(yyscanner,yytext,yyleng); }
- {DOCTYPE} { countLines(yyscanner,yytext,yyleng); }
- {OPENSPECIAL} { countLines(yyscanner,yytext,yyleng); BEGIN(Prolog); }
- {OPEN} { countLines(yyscanner,yytext,yyleng);
- initElement(yyscanner);
- BEGIN(Element); }
- {COMMENT} { yyextra->commentContext = YY_START;
- BEGIN(Comment);
- }
-}
-<Content>{
- {CDATA} { countLines(yyscanner,yytext,yyleng);
- yyextra->cdataContext = YY_START;
- BEGIN(CDataSection);
- }
- {PCDATA} { yyextra->data += processData(yyscanner,yytext,yyleng); }
- {OPEN} { countLines(yyscanner,yytext,yyleng);
- addCharacters(yyscanner);
- initElement(yyscanner);
- BEGIN(Element);
- }
- {COMMENT} { yyextra->commentContext = YY_START;
- countLines(yyscanner,yytext,yyleng);
- BEGIN(Comment);
- }
-}
-<Element>{
- "/" { yyextra->isEnd = true; }
- {NAME} { yyextra->name = yytext;
- BEGIN(Attributes); }
- {CLOSE} { addElement(yyscanner);
- countLines(yyscanner,yytext,yyleng);
- yyextra->data = "";
- BEGIN(Content);
- }
- {SP} { countLines(yyscanner,yytext,yyleng); }
-}
-<Attributes>{
- "/" { yyextra->selfClose = true; }
- {NAME} { yyextra->attrName = yytext; }
- "=" { BEGIN(AttributeValue); }
- {CLOSE} { addElement(yyscanner);
- countLines(yyscanner,yytext,yyleng);
- yyextra->data = "";
- BEGIN(Content);
- }
- {SP} { countLines(yyscanner,yytext,yyleng); }
-}
-<AttributeValue>{
- {SP} { countLines(yyscanner,yytext,yyleng); }
- ['"] { yyextra->stringChar = *yytext;
- yyextra->attrValue = "";
- BEGIN(AttrValueStr);
- }
- . { std::string msg = std::string("Missing attribute value. Unexpected character `")+yytext+"` found";
- reportError(yyscanner,msg);
- unput(*yytext);
- BEGIN(Attributes);
- }
-}
-<AttrValueStr>{
- [^'"\n]+ { yyextra->attrValue += processData(yyscanner,yytext,yyleng); }
- ['"] { if (*yytext==yyextra->stringChar)
- {
- addAttribute(yyscanner);
- BEGIN(Attributes);
- }
- else
- {
- yyextra->attrValue += processData(yyscanner,yytext,yyleng);
- }
- }
- \n { yyextra->lineNr++; yyextra->attrValue+=' '; }
-}
-<CDataSection>{
- {ENDCDATA} { BEGIN(yyextra->cdataContext); }
- [^]\n]+ { yyextra->data += yytext; }
- \n { yyextra->data += yytext;
- yyextra->lineNr++;
- }
- . { yyextra->data += yytext; }
-}
-<Prolog>{
- {CLOSESPECIAL} { countLines(yyscanner,yytext,yyleng);
- BEGIN(Initial);
- }
- [^?\n]+ { }
- \n { yyextra->lineNr++; }
- . { }
-}
-<Comment>{
- {COMMENTEND} { countLines(yyscanner,yytext,yyleng);
- BEGIN(yyextra->commentContext);
- }
- [^\n-]+ { }
- \n { yyextra->lineNr++; }
- . { }
-}
-\n { yyextra->lineNr++; }
-. { std::string msg = "Unexpected character `";
- msg+=yytext;
- msg+="` found";
- reportError(yyscanner,msg);
- }
-
-%%
-
-//----------------------------------------------------------------------------------------
-
-static yy_size_t yyread(yyscan_t yyscanner,char *buf,size_t max_size)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- yy_size_t inputPosition = yyextra->inputPosition;
- const char *s = yyextra->inputString + inputPosition;
- yy_size_t c=0;
- while( c < max_size && *s)
- {
- *buf++ = *s++;
- c++;
- }
- yyextra->inputPosition += c;
- return c;
-}
-
-static void countLines(yyscan_t yyscanner, const char *txt,yy_size_t len)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- for (yy_size_t i=0;i<len;i++)
- {
- if (txt[i]=='\n') yyextra->lineNr++;
- }
-}
-
-static void initElement(yyscan_t yyscanner)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- yyextra->isEnd = false; // true => </tag>
- yyextra->selfClose = false; // true => <tag/>
- yyextra->name = "";
- yyextra->attrs.clear();
-}
-
-static void checkAndUpdatePath(yyscan_t yyscanner)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yyextra->xpath.empty())
- {
- std::string msg = "found closing tag '"+yyextra->name+"' without matching opening tag";
- reportError(yyscanner,msg);
- }
- else
- {
- std::string expectedTagName = yyextra->xpath.back();
- if (expectedTagName!=yyextra->name)
- {
- std::string msg = "Found closing tag '"+yyextra->name+"' that does not match the opening tag '"+expectedTagName+"' at the same level";
- reportError(yyscanner,msg);
- }
- else // matching end tag
- {
- yyextra->xpath.pop_back();
- }
- }
-}
-
-static void addElement(yyscan_t yyscanner)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (!yyextra->isEnd)
- {
- yyextra->xpath.push_back(yyextra->name);
- if (yyextra->handlers.startElement)
- {
- yyextra->handlers.startElement(yyextra->name,yyextra->attrs);
- }
- if (yy_flex_debug)
- {
- fprintf(stderr,"%d: startElement(%s,attr=[",yyextra->lineNr,yyextra->name.data());
- for (auto attr : yyextra->attrs)
- {
- fprintf(stderr,"%s='%s' ",attr.first.c_str(),attr.second.c_str());
- }
- fprintf(stderr,"])\n");
- }
- }
- if (yyextra->isEnd || yyextra->selfClose)
- {
- if (yy_flex_debug)
- {
- fprintf(stderr,"%d: endElement(%s)\n",yyextra->lineNr,yyextra->name.data());
- }
- checkAndUpdatePath(yyscanner);
- if (yyextra->handlers.endElement)
- {
- yyextra->handlers.endElement(yyextra->name);
- }
- }
-}
-
-static std::string trimSpaces(const std::string &str)
-{
- const int l = static_cast<int>(str.length());
- int s=0, e=l-1;
- while (s<l && isspace(str.at(s))) s++;
- while (e>s && isspace(str.at(e))) e--;
- return str.substr(s,1+e-s);
-}
-
-static void addCharacters(yyscan_t yyscanner)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- std::string data = trimSpaces(yyextra->data);
- if (yyextra->handlers.characters)
- {
- yyextra->handlers.characters(data);
- }
- if (!data.empty())
- {
- if (yy_flex_debug)
- {
- fprintf(stderr,"characters(%s)\n",data.c_str());
- }
- }
-}
-
-static void addAttribute(yyscan_t yyscanner)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- yyextra->attrs.insert(std::make_pair(yyextra->attrName,yyextra->attrValue));
-}
-
-static void reportError(yyscan_t yyscanner,const std::string &msg)
-{
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
- if (yy_flex_debug)
- {
- fprintf(stderr,"%s:%d: Error '%s'\n",yyextra->fileName.c_str(),yyextra->lineNr,msg.c_str());
- }
- if (yyextra->handlers.error)
- {
- yyextra->handlers.error(yyextra->fileName,yyextra->lineNr,msg);
- }
-}
-
-static const char *entities_enc[] = { "amp", "quot", "gt", "lt", "apos" };
-static const char entities_dec[] = { '&', '"', '>', '<', '\'' };
-static const int num_entities = 5;
-
-// replace character entities such as &amp; in txt and return the string where entities
-// are replaced
-static std::string processData(yyscan_t yyscanner,const char *txt,yy_size_t len)
-{
- std::string result;
- result.reserve(len);
- for (yy_size_t i=0; i<len; i++)
- {
- char c = txt[i];
- if (c=='&')
- {
- const int maxEntityLen = 10;
- char entity[maxEntityLen+1];
- entity[maxEntityLen]='\0';
- for (yy_size_t j=0; j<maxEntityLen && i+j+1<len; j++)
- {
- if (txt[i+j+1]!=';')
- {
- entity[j]=txt[i+j+1];
- }
- else
- {
- entity[j]=0;
- break;
- }
- }
- bool found=false;
- for (int e=0; !found && e<num_entities; e++)
- {
- if (strcmp(entity,entities_enc[e])==0)
- {
- result+=entities_dec[e];
- i+=strlen(entities_enc[e])+1;
- found=true;
- }
- }
- if (!found)
- {
- std::string msg = std::string("Invalid character entity '&") + entity + ";' found\n";
- reportError(yyscanner,msg);
- }
- }
- else
- {
- result+=c;
- }
- }
- return result;
-}
-
-//--------------------------------------------------------------
-
-struct XMLParser::Private
-{
- yyscan_t yyscanner;
- struct xmlYY_state xmlYY_extra;
-};
-
-XMLParser::XMLParser(const XMLHandlers &handlers) : p(new Private)
-{
- xmlYYlex_init_extra(&p->xmlYY_extra,&p->yyscanner);
- p->xmlYY_extra.handlers = handlers;
-}
-
-XMLParser::~XMLParser()
-{
- xmlYYlex_destroy(p->yyscanner);
-}
-
-void XMLParser::parse(const char *fileName,const char *inputStr)
-{
- yyscan_t yyscanner = p->yyscanner;
- struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
-
-#ifdef FLEX_DEBUG
- xmlYYset_debug(1,p->yyscanner);
-#endif
-
- if (inputStr==nullptr || inputStr[0]=='\0') return; // empty input
-
- printlex(yy_flex_debug, true, __FILE__, fileName);
-
- BEGIN(Initial);
- yyextra->fileName = fileName;
- yyextra->lineNr = 1;
- yyextra->inputString = inputStr;
- yyextra->inputPosition = 0;
-
- xmlYYrestart( 0, yyscanner );
-
- if (yyextra->handlers.startDocument)
- {
- yyextra->handlers.startDocument();
- }
- xmlYYlex(yyscanner);
- if (yyextra->handlers.endDocument)
- {
- yyextra->handlers.endDocument();
- }
-
- if (!yyextra->xpath.empty())
- {
- std::string tagName = yyextra->xpath.back();
- std::string msg = "End of file reached while expecting closing tag '"+tagName+"'";
- reportError(yyscanner,msg);
- }
-
- printlex(yy_flex_debug, false, __FILE__, fileName);
-}
-
-int XMLParser::lineNr() const
-{
- struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
- return yyextra->lineNr;
-}
-
-std::string XMLParser::fileName() const
-{
- struct yyguts_t *yyg = (struct yyguts_t*)p->yyscanner;
- return yyextra->fileName;
-}
-
-#if USE_STATE2STRING
-#include "xml.l.h"
-#endif