diff options
-rw-r--r-- | qtools/qcstring.cpp | 5 | ||||
-rw-r--r-- | src/config.xml | 19 | ||||
-rwxr-xr-x | src/configgen.py | 5 | ||||
-rw-r--r-- | src/doctokenizer.l | 2 | ||||
-rw-r--r-- | src/doxygen.cpp | 20 | ||||
-rw-r--r-- | src/memberdef.cpp | 2 | ||||
-rw-r--r-- | src/pre.l | 4 | ||||
-rw-r--r-- | src/pyscanner.l | 73 | ||||
-rw-r--r-- | src/sqlite3gen.cpp | 20 | ||||
-rw-r--r-- | src/util.cpp | 22 | ||||
-rwxr-xr-x | templates/html/bib2xhtml.pl | 4 |
11 files changed, 125 insertions, 51 deletions
diff --git a/qtools/qcstring.cpp b/qtools/qcstring.cpp index 8169979..da7a46f 100644 --- a/qtools/qcstring.cpp +++ b/qtools/qcstring.cpp @@ -616,7 +616,10 @@ QCString substitute(const QCString &s,const QCString &src,const QCString &dst) if (dst) memcpy(r,dst,dstLen); r+=dstLen; } - qstrcpy(r,p); + if (r) + { + qstrcpy(r,p); + } //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data()); return result; } diff --git a/src/config.xml b/src/config.xml index f7d9a9e..81610c0 100644 --- a/src/config.xml +++ b/src/config.xml @@ -2156,7 +2156,7 @@ The \c DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. <![CDATA[ The \c GENERATE_CHI flag controls if a separate `.chi` index file is generated (\c YES) or that - it should be included in the master `.chm` file (\c NO). + it should be included in the main `.chm` file (\c NO). ]]> </docs> </option> @@ -3034,9 +3034,8 @@ front of it. </docs> </option> </group> -<!-- - <group name='Sqlite3' docs='Configuration options related to Sqlite3 output'> - <option type='bool' id='GENERATE_SQLITE3' defval='0'> + <group name='Sqlite3' setting='USE_SQLITE3' docs='Configuration options related to Sqlite3 output'> + <option type='bool' id='GENERATE_SQLITE3' setting='USE_SQLITE3' defval='0'> <docs> <![CDATA[ If the \c GENERATE_SQLITE3 tag is set to \c YES doxygen will generate a @@ -3044,7 +3043,7 @@ If the \c GENERATE_SQLITE3 tag is set to \c YES doxygen will generate a ]]> </docs> </option> - <option type='string' id='SQLITE3_OUTPUT' format='dir' defval='sqlite3' depends='GENERATE_SQLITE3'> + <option type='string' id='SQLITE3_OUTPUT' format='dir' defval='sqlite3' setting='USE_SQLITE3' depends='GENERATE_SQLITE3'> <docs> <![CDATA[ The \c SQLITE3_OUTPUT tag is used to specify where the \c Sqlite3 database will be put. @@ -3053,9 +3052,17 @@ put in front of it. ]]> </docs> </option> + <option type='bool' id='SQLITE3_RECREATE_DB' defval='1' setting='USE_SQLITE3' depends='GENERATE_SQLITE3'> + <docs> +<![CDATA[ +The \c SQLITE3_OVERWRITE_DB tag is set to \c YES, the existing doxygen_sqlite3.db +database file will be recreated with each doxygen run. +If set to \c NO, doxygen will warn if an a database file is already found and not modify it. +]]> + </docs> + </option> </group> ---> <group name='PerlMod' docs='Configuration options related to the Perl module output'> <option type='bool' id='GENERATE_PERLMOD' defval='0'> <docs> diff --git a/src/configgen.py b/src/configgen.py index 89eff6d..4ffa8f8 100755 --- a/src/configgen.py +++ b/src/configgen.py @@ -345,6 +345,9 @@ def parseOption(node): def parseGroups(node): name = node.getAttribute('name') doc = node.getAttribute('docs') + setting = node.getAttribute('setting') + if len(setting) > 0: + print("#if %s" % (setting)) print("%s%s" % (" //-----------------------------------------", "----------------------------------")) print(" cfg->addInfo(\"%s\",\"%s\");" % (name, doc)) @@ -354,6 +357,8 @@ def parseGroups(node): for n in node.childNodes: if n.nodeType == Node.ELEMENT_NODE: parseOption(n) + if len(setting) > 0: + print("#endif") def parseGroupMapGetter(node): diff --git a/src/doctokenizer.l b/src/doctokenizer.l index f232c3a..ac5b6d2 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -392,7 +392,7 @@ SPCMD2 {CMD}[\\@<>&$#%~".+=|-] SPCMD3 {CMD}_form#[0-9]+ SPCMD4 {CMD}"::" SPCMD5 {CMD}":" -INOUT "inout"|"in"|"out"|("in"{BLANK}*","{BLANK}*"out")|("out"{BLANK}*","{BLANK}*"in") +INOUT "in"|"out"|("in"{BLANK}*","?{BLANK}*"out")|("out"{BLANK}*","?{BLANK}*"in") PARAMIO {CMD}param{BLANK}*"["{BLANK}*{INOUT}{BLANK}*"]" VARARGS "..." TEMPCHAR [a-z_A-Z0-9.,: \t\*\&\(\)\[\]] diff --git a/src/doxygen.cpp b/src/doxygen.cpp index bc8eed7..dab7549 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -10920,13 +10920,15 @@ void parseInput() Config_updateString(MAN_OUTPUT,manOutput); } - //QCString sqlOutput; - //bool &generateSql = Config_getBool(GENERATE_SQLITE3); - //if (generateSql) - //{ - // sqlOutput = createOutputDirectory(outputDirectory,Config_getString(SQLITE3_OUTPUT),"/sqlite3"); - // Config_update(SQLITE3_OUTPUT,sqlOutput); - //} +#if USE_SQLITE3 + QCString sqlOutput; + bool generateSql = Config_getBool(GENERATE_SQLITE3); + if (generateSql) + { + sqlOutput = createOutputDirectory(outputDirectory,Config_getString(SQLITE3_OUTPUT),"/sqlite3"); + Config_updateString(SQLITE3_OUTPUT,sqlOutput); + } +#endif if (Config_getBool(HAVE_DOT)) { @@ -11543,12 +11545,14 @@ void generateOutput() Doxygen::generatingXmlOutput=FALSE; g_s.end(); } - if (USE_SQLITE3) +#if USE_SQLITE3 + if (Config_getBool(GENERATE_SQLITE3)) { g_s.begin("Generating SQLITE3 output...\n"); generateSqlite3(); g_s.end(); } +#endif if (Config_getBool(GENERATE_AUTOGEN_DEF)) { diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 7d6acb5..7645a01 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -3761,7 +3761,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, { QCString docsWithoutDir = a.docs; QCString direction = extractDirection(docsWithoutDir); - paramDocs+="@param"+direction+" "+a.name+" "+a.docs; + paramDocs+="@param"+direction+" "+a.name+" "+docsWithoutDir; } } // feed the result to the documentation parser @@ -3359,9 +3359,9 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output { inc->fromFileDef->addIncludeDependency(inc->toFileDef,inc->includeName,inc->local,inc->imported); } - if (inc->toFileDef) + if (inc->toFileDef && inc->fromFileDef) { - inc->toFileDef->addIncludedByDependency(inc->fromFileDef,inc->includeName,inc->local,inc->imported); + inc->toFileDef->addIncludedByDependency(inc->fromFileDef,inc->fromFileDef->docName(),inc->local,inc->imported); } } // add the macro definition for this file to the global map diff --git a/src/pyscanner.l b/src/pyscanner.l index 822ea77..773391b 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -97,6 +97,7 @@ struct pyscannerYY_state QGString * copyString = 0; int indent = 0; int curIndent = 0; + int commentIndent = 0; bool importTuple = FALSE; QDict<QCString> packageNameCache; char atomStart = 0; @@ -140,6 +141,7 @@ static void initSpecialBlock(yyscan_t yyscanner); static void searchFoundDef(yyscan_t yyscanner); static void searchFoundClass(yyscan_t yyscanner); static QCString findPackageScope(yyscan_t yyscanner,const char *fileName); +static void stripIndentation(QCString &doc,const int indentationLevel); static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); @@ -1251,7 +1253,8 @@ STARTDOCSYMS "##" QCString actualDoc=yyextra->docBlock; if (!yyextra->docBlockSpecial) // legacy unformatted docstring { - actualDoc.prepend("\\verbatim "); + stripIndentation(actualDoc,yyextra->commentIndent); + actualDoc.prepend("\\verbatim\n"); actualDoc.append("\\endverbatim "); } //printf("-------> yyextra->current=%p yyextra->bodyEntry=%p\n",yyextra->current,yyextra->bodyEntry); @@ -1262,7 +1265,8 @@ STARTDOCSYMS "##" QCString actualDoc=yyextra->docBlock; if (!yyextra->docBlockSpecial) // legacy unformatted docstring { - actualDoc.prepend("\\verbatim "); + stripIndentation(actualDoc,yyextra->commentIndent); + actualDoc.prepend("\\verbatim\n"); actualDoc.append("\\endverbatim "); } actualDoc.prepend("\\namespace "+yyextra->moduleScope+" "); @@ -1290,18 +1294,7 @@ STARTDOCSYMS "##" ^{BB} { // leading whitespace - int indent = computeIndent(yytext); - if (indent>=yyextra->curIndent) - { // strip yyextra->curIndent amount of whitespace - int i; - for (i=0;i<indent-yyextra->curIndent;i++) yyextra->docBlock+=' '; - DBG_CTX((stderr,"stripping indent %d\n",yyextra->curIndent)); - } - else - { - DBG_CTX((stderr,"not stripping: %d<%d\n",indent,yyextra->curIndent)); - yyextra->docBlock += yytext; - } + yyextra->docBlock += yytext; } [^"'\n \t\\]+ { yyextra->docBlock += yytext; @@ -1529,6 +1522,55 @@ static inline int computeIndent(const char *s) return col; } +// strip up to \a indentationLevel spaces from each line in \a doc (excluding the first line) +static void stripIndentation(QCString &doc,const int indentationLevel) +{ + if (indentationLevel <= 0) return; // nothing to strip + + // by stripping content the string will only become shorter so we write the results + // back into the input string and then resize it at the end. + char c; + const char *src = doc.data(); + char *dst = doc.rawData(); + bool insideIndent = false; // skip the initial line from stripping + int cnt = 0; + while ((c=*src++)!=0) + { + // invariant: dst<=src + switch(c) + { + case '\n': + *dst++ = c; + insideIndent = true; + cnt = indentationLevel; + break; + case ' ': + if (insideIndent) + { + if (cnt>0) // count down the spacing until the end of the indent + { + cnt--; + } + else // reached the end of the indent, start of the part of the line to keep + { + insideIndent = false; + *dst++ = c; + } + } + else // part after indent, copy to the output + { + *dst++ = c; + } + break; + default: + insideIndent = false; + *dst++ = c; + break; + } + } + doc.resize(dst-doc.data()+1); +} + static QCString findPackageScopeFromPath(yyscan_t yyscanner,const QCString &path) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; @@ -1686,6 +1728,7 @@ static void initTriDoubleQuoteBlock(yyscan_t yyscanner) yyextra->docBlockJavaStyle = TRUE; yyextra->docBlockSpecial = yytext[strlen(yytext) - 1]=='!'; yyextra->docBlock.resize(0); + yyextra->commentIndent = yyextra->curIndent; yyextra->doubleQuote = TRUE; startCommentBlock(yyscanner,FALSE); } @@ -1698,6 +1741,7 @@ static void initTriSingleQuoteBlock(yyscan_t yyscanner) yyextra->docBlockJavaStyle = TRUE; yyextra->docBlockSpecial = yytext[strlen(yytext) - 1]=='!'; yyextra->docBlock.resize(0); + yyextra->commentIndent = yyextra->curIndent; yyextra->doubleQuote = FALSE; startCommentBlock(yyscanner,FALSE); } @@ -1710,6 +1754,7 @@ static void initSpecialBlock(yyscan_t yyscanner) yyextra->docBlockJavaStyle = TRUE; yyextra->docBrief = TRUE; yyextra->docBlock.resize(0); + yyextra->commentIndent = yyextra->curIndent; startCommentBlock(yyscanner,TRUE); } diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index 77aab68..2f72221 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -2503,11 +2503,10 @@ static void generateSqlite3ForPage(const PageDef *pd,bool isExample) static sqlite3* openDbConnection() { - QCString outputDirectory = Config_getString(OUTPUT_DIRECTORY); + QCString outputDirectory = Config_getString(SQLITE3_OUTPUT); QDir sqlite3Dir(outputDirectory); sqlite3 *db; int rc; - struct stat buf; rc = sqlite3_initialize(); if (rc != SQLITE_OK) @@ -2516,15 +2515,24 @@ static sqlite3* openDbConnection() return NULL; } + QCString dbFileName = "doxygen_sqlite3.db"; + QFileInfo fi(outputDirectory+"/"+dbFileName); - if (stat (outputDirectory+"/doxygen_sqlite3.db", &buf) == 0) + if (fi.exists()) { - err("doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n"); - return NULL; + if (Config_getBool(SQLITE3_RECREATE_DB)) + { + QDir().remove(fi.absFilePath()); + } + else + { + err("doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n"); + return NULL; + } } rc = sqlite3_open_v2( - outputDirectory+"/doxygen_sqlite3.db", + fi.absFilePath().utf8(), &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0 diff --git a/src/util.cpp b/src/util.cpp index 13ae200..aa1acb4 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8137,20 +8137,22 @@ bool classVisibleInIndex(const ClassDef *cd) QCString extractDirection(QCString &docs) { - QRegExp re("\\[[^\\]]+\\]"); // [...] + QRegExp re("\\[[ inout,]+\\]"); // [...] int l=0; - if (re.match(docs,0,&l)==0) + if (re.match(docs,0,&l)==0 && l>2) { - int inPos = docs.find("in", 1,FALSE); - int outPos = docs.find("out",1,FALSE); - bool input = inPos!=-1 && inPos<l; - bool output = outPos!=-1 && outPos<l; - if (input || output) // in,out attributes + // make dir the part inside [...] without separators + QCString dir=substitute(substitute(docs.mid(1,l-2)," ",""),",",""); + int inIndex, outIndex; + unsigned char ioMask=0; + if (( inIndex=dir.find( "in"))!=-1) dir.remove (inIndex,2),ioMask|=(1<<0); + if ((outIndex=dir.find("out"))!=-1) dir.remove(outIndex,3),ioMask|=(1<<1); + if (dir.isEmpty() && ioMask!=0) // only in and/or out attributes found { docs = docs.mid(l); // strip attributes - if (input && output) return "[in,out]"; - else if (input) return "[in]"; - else if (output) return "[out]"; + if (ioMask==((1<<0)|(1<<1))) return "[in,out]"; + else if (ioMask==(1<<0)) return "[in]"; + else if (ioMask==(1<<1)) return "[out]"; } } return QCString(); diff --git a/templates/html/bib2xhtml.pl b/templates/html/bib2xhtml.pl index da6dc62..ca40b5f 100755 --- a/templates/html/bib2xhtml.pl +++ b/templates/html/bib2xhtml.pl @@ -198,7 +198,7 @@ while (<BBLFILE>) { next loop; } $nentry++; - ($bcite, $blabel) = m+<dt><a name=\"([^\"]*)\">\[([^\]]*)\]</a></dt><dd>+; + ($bcite, $blabel) = m:<dt><a\s+name=\"([^\"]*)\">\[([^\]]*)\]</a></dt><dd>:; $blabel = "$nentry"; $bibcite{$bcite} = $blabel; } @@ -222,7 +222,7 @@ while (<BBLFILE>) { } s/\%\n//g; s/(\.(<\/cite>|<\/a>|\')+)\./$1/g; - s:(<dt><a name=\"[^\"]*\">\[)[^\]]*(\]</a></dt><dd>):$1$nentry$2:; + s:(<dt><a\s+name=\"[^\"]*\">\[)[^\]]*(\]</a></dt><dd>):$1$nentry$2:; while (m/(\\(cite(label)?)(\001\d+)\{([^\001]+)\4\})/) { $old = $1; $cmd = $2; |