diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2005-10-10 19:22:31 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2005-10-10 19:22:31 (GMT) |
commit | b7ae07dc2e3b4b635cc59a49d326a88d45f9206b (patch) | |
tree | 30215767ee72661b15eae6b66e51b409feff64cf /src | |
parent | 22eb9881c15ad001246cfcde1c727a2f98f472df (diff) | |
download | Doxygen-b7ae07dc2e3b4b635cc59a49d326a88d45f9206b.zip Doxygen-b7ae07dc2e3b4b635cc59a49d326a88d45f9206b.tar.gz Doxygen-b7ae07dc2e3b4b635cc59a49d326a88d45f9206b.tar.bz2 |
Release-1.4.5-20051010
Diffstat (limited to 'src')
-rw-r--r-- | src/commentcnv.l | 2 | ||||
-rw-r--r-- | src/commentscan.l | 16 | ||||
-rw-r--r-- | src/dirdef.cpp | 52 | ||||
-rw-r--r-- | src/dot.cpp | 4 | ||||
-rw-r--r-- | src/doxygen.cpp | 98 | ||||
-rw-r--r-- | src/htmlgen.cpp | 2 | ||||
-rw-r--r-- | src/scanner.l | 30 | ||||
-rw-r--r-- | src/xmlgen.cpp | 6 |
8 files changed, 159 insertions, 51 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l index a3d62a4..cb065ec 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -320,7 +320,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^' \\\n]{1,4}"'")) copyToOutput(yytext,yyleng); BEGIN(CComment); } -<CComment>[\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"rtfonly"|"manonly"|"dot"|"code"|"f$"|"f["|"f{")/[^a-z_A-Z0-9] { /* start of a verbatim block */ +<CComment,ReadLine>[\\@]("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"rtfonly"|"manonly"|"dot"|"code"|"f$"|"f["|"f{")/[^a-z_A-Z0-9] { /* start of a verbatim block */ copyToOutput(yytext,yyleng); if (yytext[2]=='[') { diff --git a/src/commentscan.l b/src/commentscan.l index 161b766..fe7f171 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -293,7 +293,7 @@ static void groupAddDocs(Entry *e,const char *fileName); */ static ParserInterface *langParser; // the language parser that is calling us -static const char * inputString; // input string +static QCString inputString; // input string static int inputPosition; // read pointer static QCString yyFileName; // file name that is read from static int yyLineNr; // line number in the input @@ -2215,8 +2215,9 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, guards.clear(); langParser = parser; current = curEntry; + if (comment.isEmpty()) return FALSE; // avoid empty strings inputString = comment; - if (inputString==0) return FALSE; // avoid empty strings + inputString.append(" "); inputPosition = position; yyLineNr = lineNr; yyFileName = fileName; @@ -2229,6 +2230,12 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, outputXRef.resize(0); setOutput( isBrief || isJavaDocStyle ? OutputBrief : OutputDoc ); briefEndsAtDot = isJavaDocStyle; + + + Debug::print(Debug::CommentScan,0,"-----------\nCommentScanner: %s:%d\n" + "input=[%s]\n",fileName.data(),lineNr,comment.data() + ); + commentScanYYrestart( commentScanYYin ); BEGIN( Comment ); commentScanYYlex(); @@ -2253,9 +2260,8 @@ bool parseCommentBlock(/* in */ ParserInterface *parser, openGroup(current,yyFileName,yyLineNr); } - Debug::print(Debug::CommentScan,0,"CommentScanner\n%s:%d\n" - "input=[%s]\nbrief=[%s]\ndocs=[%s]\n------------\n", - fileName.data(),lineNr,comment.data(), + Debug::print(Debug::CommentScan,0, + "brief=[%s]\ndocs=[%s]\n===========\n", current->brief.data(),current->doc.data() ); diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 0e9a898..8452f0b 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -1,3 +1,5 @@ +#include <md5.h> + #include "dirdef.h" #include "filename.h" #include "doxygen.h" @@ -66,32 +68,42 @@ void DirDef::addFile(FileDef *fd) fd->setDirDef(this); } -static QCString escapeDirName(const QCString &anchor) +static QCString encodeDirName(const QCString &anchor) { QCString result; - int l = anchor.length(),i; - for (i=0;i<l;i++) - { - char c = anchor.at(i); - if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) - { - result+=c; - } - else - { - static char hexStr[]="0123456789ABCDEF"; - char escChar[]={ '_', 0, 0, 0 }; - escChar[1]=hexStr[c>>4]; - escChar[2]=hexStr[c&0xf]; - result+=escChar; - } - } - return result; + + // convert to md5 hash + uchar md5_sig[16]; + QCString sigStr(33); + MD5Buffer((const unsigned char *)anchor.data(),anchor.length(),md5_sig); + MD5SigToString(md5_sig,sigStr.data(),33); + return sigStr; + + // old algorithm + +// int l = anchor.length(),i; +// for (i=0;i<l;i++) +// { +// char c = anchor.at(i); +// if ((c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9')) +// { +// result+=c; +// } +// else +// { +// static char hexStr[]="0123456789ABCDEF"; +// char escChar[]={ '_', 0, 0, 0 }; +// escChar[1]=hexStr[c>>4]; +// escChar[2]=hexStr[c&0xf]; +// result+=escChar; +// } +// } +// return result; } QCString DirDef::getOutputFileBase() const { - return "dir_"+escapeDirName(name()); + return "dir_"+encodeDirName(name()); //return QCString().sprintf("dir_%06d",m_dirCount); } diff --git a/src/dot.cpp b/src/dot.cpp index a304788..3cc7e2f 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -1958,7 +1958,7 @@ void DotInclDepGraph::buildGraph(DotNode *n,FileDef *fd,int distance) if (bfd) { in = bfd->absFilePath(); - doc = bfd->isLinkable() && bfd->isHidden(); + doc = bfd->isLinkable() && !bfd->isHidden(); src = bfd->generateSourceFile(); } if (doc || src || !Config_getBool("HIDE_UNDOC_RELATIONS")) @@ -1967,7 +1967,7 @@ void DotInclDepGraph::buildGraph(DotNode *n,FileDef *fd,int distance) if (bfd) url=bfd->getOutputFileBase().copy(); if (!doc && src) { - url+="-source"; + url=bfd->getSourceFileBase(); } DotNode *bn = m_usedNodes->find(in); if (bn) // file is already a node in the graph diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 95cce31..ff2606a 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -3511,6 +3511,85 @@ static bool isRecursiveBaseClass(const QCString &scope,const QCString &name) return result; } +/*! Searches for the end of a template in prototype \a s starting from + * character position \a startPos. If the end was found the position + * of the closing \> is returned, otherwise -1 is returned. + * + * Handles exotic cases such as + * \code + * Class<(id<0)> + * Class<bits<<2> + * Class<"<"> + * Class<'<'> + * Class<(")<")> + * \endcode + */ +static int findEndOfTemplate(const QCString &s,int startPos) +{ + // locate end of template + int e=startPos; + int brCount=1; + int roundCount=0; + int len = s.length(); + bool insideString=FALSE; + bool insideChar=FALSE; + char pc = 0; + while (e<len && brCount!=0) + { + char c=s.at(e); + switch(c) + { + case '<': + if (!insideString && !insideChar) + { + if (e<len-1 && s.at(e+1)=='<') + e++; + else if (roundCount==0) + brCount++; + } + break; + case '>': + if (!insideString && !insideChar) + { + if (e<len-1 && s.at(e+1)=='>') + e++; + else if (roundCount==0) + brCount--; + } + break; + case '(': + if (!insideString && !insideChar) + roundCount++; + break; + case ')': + if (!insideString && !insideChar) + roundCount--; + break; + case '"': + if (!insideChar) + { + if (insideString && pc!='\\') + insideString=FALSE; + else + insideString=TRUE; + } + break; + case '\'': + if (!insideString) + { + if (insideChar && pc!='\\') + insideChar=FALSE; + else + insideChar=TRUE; + } + break; + } + pc = c; + e++; + } + return brCount==0 ? e : -1; +} + static bool findClassRelation( Entry *root, Definition *context, @@ -3603,23 +3682,8 @@ static bool findClassRelation( { // TODO: here we should try to find the correct template specialization // but for now, we only look for the unspecializated base class. - // locate end of template - int e=i+1; - int brCount=1; - int typeLen = baseClassName.length(); - while (e<typeLen && brCount!=0) - { - if (baseClassName.at(e)=='<') - { - if (e<typeLen-1 && baseClassName.at(e+1)=='<') e++; else brCount++; - } - if (baseClassName.at(e)=='>') - { - if (e<typeLen-1 && baseClassName.at(e+1)=='>') e++; else brCount--; - } - e++; - } - if (brCount==0) // end of template was found at e + int e=findEndOfTemplate(baseClassName,i+1); + if (e!=-1) // end of template was found at e { templSpec=baseClassName.mid(i,e-i); baseClassName=baseClassName.left(i)+baseClassName.right(baseClassName.length()-e); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 8391e3c..64166e0 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -569,7 +569,7 @@ static void writeDefaultHeaderFile(QTextStream &t, const char *title, } t << "\" rel=\"stylesheet\" type=\"text/css\">\n"; - t << "<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">\n"; + t << "<link href=\"" << relPathStr << "tabs.css\" rel=\"stylesheet\" type=\"text/css\">\n"; t << "</head><body>\n"; } diff --git a/src/scanner.l b/src/scanner.l index 4e510d9..d037938 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -655,6 +655,7 @@ IDLATTR ("["[^\]]*"]"){BN}* %x CopyArgSharp %x CopyArgComment %x CopyArgCommentLine +%x CopyArgVerbatim /** Prototype scanner states */ @@ -2855,10 +2856,35 @@ IDLATTR ("["[^\]]*"]"){BN}* unput(lastCopyArgChar); BEGIN( lastCommentInArgContext ); } +<CopyArgCommentLine>{CMD}("verbatim"|"latexonly"|"htmlonly"|"xmlonly"|"manonly"|"dot"|"code")/[^a-z_A-Z0-9] { // verbatim command (which could contain nested comments!) + docBlockName=&yytext[1]; + fullArgString+=yytext; + BEGIN(CopyArgVerbatim); + } +<CopyArgCommentLine>{CMD}("f$"|"f["|"f{") { + docBlockName=&yytext[1]; + if (docBlockName.at(1)=='{') + { + docBlockName.at(1)='}'; + } + fullArgString+=yytext; + BEGIN(CopyArgVerbatim); + } +<CopyArgVerbatim>[\\@]("endverbatim"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddot"|"endcode"|"f$"|"f]"|"f}")/[^a-z_A-Z0-9] { // end of verbatim block + fullArgString+=yytext; + if (yytext[1]=='f') // end of formula + { + BEGIN(CopyArgCommentLine); + } + if (&yytext[4]==docBlockName) + { + BEGIN(CopyArgCommentLine); + } + } <CopyArgCommentLine>[^\\\@\n]+ { fullArgString+=yytext; } <CopyArgCommentLine>. { fullArgString+=*yytext; } -<CopyArgComment>\n { fullArgString+=*yytext; yyLineNr++; } -<CopyArgComment>. { fullArgString+=*yytext; } +<CopyArgComment,CopyArgVerbatim>\n { fullArgString+=*yytext; yyLineNr++; } +<CopyArgComment,CopyArgVerbatim>. { fullArgString+=*yytext; } <CopyArgComment>{CMD}("brief"|"short"){B}+ { warn(yyFileName,yyLineNr, "Warning: Ignoring %cbrief command inside argument documentation",*yytext diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 0126cc6..3126adc 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1112,14 +1112,14 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) t << "\">"; if (!bcd->templSpecifiers.isEmpty()) { - convertToXML( - insertTemplateSpecifierInScope( + t << convertToXML( + insertTemplateSpecifierInScope( bcd->classDef->displayName(),bcd->templSpecifiers) ); } else { - convertToXML(bcd->classDef->displayName()); + t << convertToXML(bcd->classDef->displayName()); } t << "</basecompoundref>" << endl; } |