diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2002-05-20 14:35:05 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2002-05-20 14:35:05 (GMT) |
commit | 2999d2732d1471f144721808e52c04aa17dd63b6 (patch) | |
tree | 36be5408c1204bd5806673cb3fef2b25ed031174 /src | |
parent | bcf2f33d5be8c6de4de5bb7cbe8ea8b90f19cf88 (diff) | |
download | Doxygen-2999d2732d1471f144721808e52c04aa17dd63b6.zip Doxygen-2999d2732d1471f144721808e52c04aa17dd63b6.tar.gz Doxygen-2999d2732d1471f144721808e52c04aa17dd63b6.tar.bz2 |
Release-1.2.16
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 4 | ||||
-rw-r--r-- | src/code.l | 7 | ||||
-rw-r--r-- | src/commentcnv.l | 35 | ||||
-rw-r--r-- | src/debug.cpp | 2 | ||||
-rw-r--r-- | src/debug.h | 3 | ||||
-rw-r--r-- | src/doxygen.cpp | 54 | ||||
-rw-r--r-- | src/latexgen.cpp | 4 | ||||
-rw-r--r-- | src/pre.l | 17 | ||||
-rw-r--r-- | src/scanner.l | 25 | ||||
-rw-r--r-- | src/util.cpp | 38 | ||||
-rw-r--r-- | src/xmlgen.cpp | 14 |
11 files changed, 151 insertions, 52 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 31ea207..f82cbf0 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -2318,8 +2318,8 @@ void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) //printf("%s->setMemberClass(%p)\n",imd->name().data(),this); imd->setMemberClass(this); imd->setTemplateMaster(md); - //imd->setDocumentation(md->documentation()); - //imd->setBriefDescription(md->briefDescription()); + imd->setDocumentation(md->documentation(),md->docFile(),md->docLine()); + imd->setBriefDescription(md->briefDescription(),md->briefFile(),md->briefLine()); imd->setMemberSpecifiers(md->getMemberSpecifiers()); insertMember(imd); //printf("Adding member=%s %s%s to class %s templSpec %s\n", @@ -1701,7 +1701,12 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" g_memCallContext = YY_START; BEGIN( MemberCall ); } -<SkipComment>"//" { +<SkipComment>"/*"("!"?)"*/" { + g_code->codify(yytext); + endFontClass(); + BEGIN( g_lastCContext ) ; + } +<SkipComment>"//"|"/*" { g_code->codify(yytext); } <SkipComment>[^*/\n]+ { diff --git a/src/commentcnv.l b/src/commentcnv.l index d2da72c..de7e8a7 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -23,6 +23,8 @@ #include <stdlib.h> #include "bufstr.h" +#include "debug.h" +#include "message.h" static BufStr *g_inBuf; static BufStr *g_outBuf; @@ -97,12 +99,17 @@ static int yyread(char *buf,int max_size) <Scan>\n { /* new line */ copyToOutput(yytext,yyleng); } -<Scan>("//!"|"///").*\n/[ \t]*"//" { /* start C++ style special comment block */ - copyToOutput("/*!",3); - copyToOutput(yytext+3,yyleng-3); +<Scan>("//!"|"///").*\n/[ \t]*"//"[\/!][^\/] { /* start C++ style special comment block */ + int i=3; + if (yytext[2]=='/') + { + while (i<yyleng && yytext[i]=='/') i++; + } + copyToOutput("/**",3); + copyToOutput(yytext+i,yyleng-i); BEGIN(SComment); } -<Scan>"//".*\n { /* one line C++ comment */ +<Scan>"//"[\/!].*\n { /* one line C++ comment */ copyToOutput(yytext,yyleng); } <Scan>"/*" { /* start of a C comment */ @@ -155,10 +162,22 @@ static int yyread(char *buf,int max_size) copyToOutput(yytext,yyleng); BEGIN(Scan); } -<SComment>^[ \t]*"//".*/\n { /* second line of special comment */ +<SComment>^[ \t]*"///"[\/]*\n { + replaceCommentMarker(yytext,yyleng); + } +<SComment>^[ \t]*"///"[^\/\n].*/\n { + replaceCommentMarker(yytext,yyleng); + } +<SComment>^[ \t]*"//!".*/\n { /* second line of special comment */ replaceCommentMarker(yytext,yyleng); } -<SComment>\n[ \t]*"//".*/\n { /* other line of special comment */ +<SComment>\n[ \t]*"///"[\/]*\n { + replaceCommentMarker(yytext,yyleng); + } +<SComment>\n[ \t]*"///"[^\/\n].*/\n { + replaceCommentMarker(yytext,yyleng); + } +<SComment>\n[ \t]*"//!".*/\n { /* other line of special comment */ replaceCommentMarker(yytext,yyleng); } <SComment>\n { /* end of special comment */ @@ -176,6 +195,10 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf) g_inBufPos = 0; BEGIN(Scan); yylex(); + if (Debug::isFlagSet(Debug::CommentCnv)) + { + msg("-------------\n%s\n-------------\n",g_outBuf->data()); + } } //---------------------------------------------------------------------------- diff --git a/src/debug.cpp b/src/debug.cpp index 4afbfb1..8932622 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -48,6 +48,8 @@ static int labelToEnumValue(const char *l) return Debug::Preprocessor; else if (label=="Classes") return Debug::Classes; + else if (label=="CommentCnv") + return Debug::CommentCnv; else return 0; } diff --git a/src/debug.h b/src/debug.h index b78b98f..22c463b 100644 --- a/src/debug.h +++ b/src/debug.h @@ -27,7 +27,8 @@ class Debug Functions = 0x00000002, Variables = 0x00000004, Preprocessor = 0x00000008, - Classes = 0x00000010 + Classes = 0x00000010, + CommentCnv = 0x00000020 }; static void print(DebugMask mask,int prio,const char *fmt,...); static void setFlag(const char *label); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 6c1aff5..7f6b12e 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -2772,6 +2772,13 @@ static bool findClassRelation( //} //printf("\n"); + QCString biName=bi->name; + bool explicitGlobalScope=FALSE; + if (biName.left(2)=="::") // explicit global scope + { + biName=biName.right(biName.length()-2); + explicitGlobalScope=TRUE; + } Entry *parentNode=root->parent; bool lastParent=FALSE; @@ -2779,13 +2786,13 @@ static bool findClassRelation( // (in case of nested classes) { QCString scopeName= parentNode ? parentNode->name.data() : ""; - int scopeOffset=scopeName.length(); + int scopeOffset=explicitGlobalScope ? 0 : scopeName.length(); do // try all parent scope prefixes, starting with the largest scope { - //printf("scopePrefix=`%s' bi->name=`%s'\n", - // scopeName.left(scopeOffset).data(),bi->name.data()); + //printf("scopePrefix=`%s' biName=`%s'\n", + // scopeName.left(scopeOffset).data(),biName.data()); - QCString baseClassName=bi->name; + QCString baseClassName=biName; if (scopeOffset>0) { baseClassName.prepend(scopeName.left(scopeOffset)+"::"); @@ -2794,7 +2801,7 @@ static bool findClassRelation( (removeRedundantWhiteSpace(baseClassName)); bool baseClassIsTypeDef; QCString templSpec; - ClassDef *baseClass=getResolvedClass(cd,baseClassName,&baseClassIsTypeDef,&templSpec); + ClassDef *baseClass=getResolvedClass(explicitGlobalScope ? 0 : cd,baseClassName,&baseClassIsTypeDef,&templSpec); //printf("baseClassName=%s baseClass=%p cd=%p\n",baseClassName.data(),baseClass,cd); //printf(" root->name=`%s' baseClassName=`%s' baseClass=%s templSpec=%s\n", // root->name.data(), @@ -2807,7 +2814,7 @@ static bool findClassRelation( // ) // Check for base class with the same name. // // If found then look in the outer scope for a match // // and prevent recursion. - if (!isRecursiveBaseClass(root->name,baseClassName)) + if (!isRecursiveBaseClass(root->name,baseClassName) || explicitGlobalScope) { Debug::print( Debug::Classes,0," class relation %s inherited by %s found (%s and %s)\n", @@ -2849,6 +2856,7 @@ static bool findClassRelation( } } + //printf("cd=%p baseClass=%p\n",cd,baseClass); bool found=baseClass!=0 && (baseClass!=cd || mode==TemplateInstances); NamespaceDef *nd=cd->getNamespaceDef(); if (!found && (i=baseClassName.findRev("::"))!=-1) @@ -2887,7 +2895,7 @@ static bool findClassRelation( ClassDef *ucd; for (cli.toFirst(); (ucd=cli.current()) && !found; ++cli) { - if (rightScopeMatch(ucd->name(),bi->name)) + if (rightScopeMatch(ucd->name(),biName)) { baseClass = ucd; found = TRUE; @@ -2921,7 +2929,7 @@ static bool findClassRelation( ClassDef *ucd; for (cli.toFirst(); (ucd=cli.current()) && !found; ++cli) { - if (rightScopeMatch(ucd->name(),bi->name)) + if (rightScopeMatch(ucd->name(),biName)) { baseClass = ucd; found = TRUE; @@ -2939,7 +2947,7 @@ static bool findClassRelation( ClassDef *ucd; for (cli.toFirst(); (ucd=cli.current()) && !found; ++cli) { - if (rightScopeMatch(ucd->name(),bi->name)) + if (rightScopeMatch(ucd->name(),biName)) { baseClass = ucd; found = TRUE; @@ -2949,10 +2957,10 @@ static bool findClassRelation( } } } - bool isATemplateArgument = templateNames!=0 && templateNames->find(bi->name)!=0; - if (/*!isATemplateArgument &&*/ found) + bool isATemplateArgument = templateNames!=0 && templateNames->find(biName)!=0; + if (found) { - Debug::print(Debug::Classes,0," Documented class `%s' templSpec=%s\n",bi->name.data(),templSpec.data()); + Debug::print(Debug::Classes,0," Documented class `%s' templSpec=%s\n",biName.data(),templSpec.data()); // add base class to this class // if templSpec is not empty then we should "instantiate" @@ -2971,7 +2979,7 @@ static bool findClassRelation( else if (mode==DocumentedOnly) { QCString usedName; - if (baseClassIsTypeDef) usedName=bi->name; + if (baseClassIsTypeDef) usedName=biName; cd->insertBaseClass(baseClass,usedName,bi->prot,bi->virt,templSpec); // add this class as super class to the base class baseClass->insertSubClass(cd,bi->prot,bi->virt,templSpec); @@ -2982,7 +2990,7 @@ static bool findClassRelation( { Debug::print(Debug::Classes,0, " New undocumented base class `%s' baseClassName=%s\n", - bi->name.data(),baseClassName.data() + biName.data(),baseClassName.data() ); baseClass=0; if (isATemplateArgument) @@ -3004,7 +3012,7 @@ static bool findClassRelation( if (isArtificial) baseClass->setClassIsArtificial(); } // add base class to this class - cd->insertBaseClass(baseClass,bi->name,bi->prot,bi->virt,templSpec); + cd->insertBaseClass(baseClass,biName,bi->prot,bi->virt,templSpec); // add this class as super class to the base class baseClass->insertSubClass(cd,bi->prot,bi->virt,templSpec); // the undocumented base was found in this file @@ -3014,8 +3022,22 @@ static bool findClassRelation( } else { - Debug::print(Debug::Classes,0," Base class `%s' not found\n",bi->name.data()); + Debug::print(Debug::Classes,0," Base class `%s' not found\n",biName.data()); + } + } + else + { + if (mode!=TemplateInstances) + { + warn(root->fileName,root->startLine, + "Detected potential recursive class relation " + "between class %s and base class %s!\n", + root->name.data(),baseClassName.data() + ); } + // for mode==TemplateInstance this case is quite common and + // indicates a relation between a template class and a template + // instance with the same name. } if (scopeOffset==0) { diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 6665d1f..58e6044 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -1757,7 +1757,10 @@ void LatexGenerator::startDotFile(const char *name,bool hasCaption) +baseName; writeDotGraphFromFile(name,outName,EPS); if (hasCaption) + { t << "\\begin{figure}[H]" << endl; + t << "\\begin{center}" << endl; + } else t << "\\mbox{"; t << "\\includegraphics"; @@ -1781,6 +1784,7 @@ void LatexGenerator::endDotFile(bool hasCaption) if (hasCaption) { t << "}" << endl; + t << "\\end{center}" << endl; t << "\\end{figure}" << endl; } } @@ -1549,16 +1549,16 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) else // define is a guard => hide { //printf("Found a guard %s\n",yytext); - Define *def=0; - if (g_includeStack.isEmpty()) - { - addDefine(); - } - if ((def=g_fileDefineDict->find(g_defName))==0) + Define *def=g_fileDefineDict->find(g_defName); + //if (g_includeStack.isEmpty()) + //{ + // addDefine(); + //} + if (def==0) // new define name for this file { g_fileDefineDict->insert(g_defName,newDefine()); } - else if (def)// name already exists + else // name already exists { if (def->undef) // undefined name { @@ -1574,9 +1574,6 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) //printf("Error: define %s is defined more than once!\n",g_defName.data()); } } - QCString tmp=(QCString)"#define "+g_defName; - outputArray(tmp.data(),tmp.length()); - //outputChar('\n'); g_lastGuardName.resize(0); BEGIN(Start); } diff --git a/src/scanner.l b/src/scanner.l index 8bfa406..79fe0f1 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2652,18 +2652,20 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <BasesProt>{BN} { lineCount(); } <BasesProt>. { unput(*yytext); BEGIN(Bases); } <Bases>("::")?{BN}*({ID}{BN}*"::"{BN}*)*{ID} { - QCString bName = yytext; - bName = bName.stripWhiteSpace(); - bool globalScope = bName.at(0)==':' && baseName.isEmpty(); - if (!globalScope) - baseName += bName; - else - baseName += (bName.data()+2); + //QCString bName = yytext; + //bName = bName.stripWhiteSpace(); + //bool globalScope = bName.at(0)==':' && baseName.isEmpty(); + //if (!globalScope) + // baseName += bName; + //else + // baseName += (bName.data()+2); + baseName+=yytext; current->args += ' '; - if (!globalScope) - current->args += bName; - else - current->args += (bName.data()+2); + //if (!globalScope) + // current->args += bName; + //else + // current->args += (bName.data()+2); + current->args += yytext; } <Bases>{BN}*{ID}("."{ID})* { // Java style class QCString name = yytext; @@ -4149,6 +4151,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <JavaDoc,LineDoc,ClassDocBrief,AfterDocBrief,AfterDocLine>"\\"[a-z_A-Z][a-z_A-Z0-9]*[\\] { // directory type of text current->brief+=yytext; } +<LineDoc,AfterDocLine,CopyArgCommentLine>{CMD}("brief"|"short") {} <JavaDoc,LineDoc,ClassDocBrief,AfterDocBrief,AfterDocLine,CopyArgCommentLine>{CMD}[a-z_A-Z][a-z_A-Z0-9]* { QCString *pValue=Doxygen::aliasDict[yytext+1]; if (pValue) diff --git a/src/util.cpp b/src/util.cpp index 1b7b78c..83dd2a2 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2166,8 +2166,15 @@ bool getScopeDefs(const char *docScope,const char *scope, //printf("getScopeDefs: docScope=`%s' scope=`%s'\n",docScope,scope); if (scopeName.isEmpty()) return FALSE; + bool explicitGlobalScope=FALSE; + if (scopeName.at(0)==':' && scopeName.at(1)==':') + { + scopeName=scopeName.right(scopeName.length()-2); + explicitGlobalScope=TRUE; + } + QCString docScopeName=docScope; - int scopeOffset=docScopeName.length(); + int scopeOffset=explicitGlobalScope ? 0 : docScopeName.length(); do // for each possible docScope (from largest to and including empty) { @@ -2195,6 +2202,14 @@ bool getScopeDefs(const char *docScope,const char *scope, return FALSE; } +static bool isLowerCase(QCString &s) +{ + char *p=s.data(); + int c; + while ((c=*p++)) if (!islower(c)) return FALSE; + return TRUE; +} + /*! * generate a reference to a class, namespace or member. * `scName' is the name of the scope that contains the documentation @@ -2229,7 +2244,26 @@ bool generateRef(OutputDocInterface &od,const char *scName, { ClassDef *cd=0; NamespaceDef *nd=0; - if (linkText.isEmpty()) linkText=tmpName; + + if (linkText.isEmpty()) + { + linkText=tmpName; + // strip :: prefix if present + if (linkText.at(0)==':' && linkText.at(1)==':') + { + linkText=linkText.right(linkText.length()-2); + } + } + + if (scopePos==-1 && isLowerCase(tsName)) + { // link to lower case only name => do not try to autolink + od.docify(linkText); + // text has been written, stop now. + return FALSE; + } + + //printf("scName=%s tmpName=%s\n",scName,tmpName.data()); + // check if this is a class or namespace reference if (scName!=tmpName && getScopeDefs(scName,name,cd,nd)) { diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 435c7dc..60eb9f3 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -224,9 +224,12 @@ class XMLGenerator : public OutputDocInterface void docify(const char *s) { - XML_DB(("(docify \"%s\")\n",s)); - startParMode(); - writeXMLString(m_t,s); + if (m_outputEnabled) + { + XML_DB(("(docify \"%s\")\n",s)); + startParMode(); + writeXMLString(m_t,s); + } } void writeChar(char c) { @@ -779,10 +782,12 @@ class XMLGenerator : public OutputDocInterface void startPageRef() { XML_DB(("(startPageRef)\n")); + m_outputEnabled = FALSE; } void endPageRef(const char *,const char *) { XML_DB(("(endPageRef)\n")); + m_outputEnabled = TRUE; } void writeLineNumber(const char *extRef,const char *compId, const char *anchorId,int l) @@ -886,6 +891,7 @@ class XMLGenerator : public OutputDocInterface m_t.setDevice(&m_b); m_t.setEncoding(QTextStream::Latin1); m_inParamList = FALSE; + m_outputEnabled = TRUE; } /*! copy constructor */ XMLGenerator(const XMLGenerator *xg) @@ -902,6 +908,7 @@ class XMLGenerator : public OutputDocInterface m_inParStack = xg->m_inParStack; m_inListStack = xg->m_inListStack; m_inParamList = xg->m_inParamList; + m_outputEnabled = xg->m_outputEnabled; } /*! destructor */ virtual ~XMLGenerator() @@ -935,6 +942,7 @@ class XMLGenerator : public OutputDocInterface ValStack<bool> m_inParStack; ValStack<bool> m_inListStack; bool m_inParamList; + bool m_outputEnabled; friend void writeXMLCodeBlock(QTextStream &t,FileDef *fd); }; |