summaryrefslogtreecommitdiffstats
path: root/src/code.l
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2005-02-27 20:01:29 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2005-02-27 20:01:29 (GMT)
commitd745dd3737ece0f328e515b1cf10306da0901597 (patch)
tree2d189d04d6f9413eb324fae5f56f273f3855ff8b /src/code.l
parent11de530ba769e4e2735a20a74262380d51f8772f (diff)
downloadDoxygen-d745dd3737ece0f328e515b1cf10306da0901597.zip
Doxygen-d745dd3737ece0f328e515b1cf10306da0901597.tar.gz
Doxygen-d745dd3737ece0f328e515b1cf10306da0901597.tar.bz2
Release-1.4.1-20050227
Diffstat (limited to 'src/code.l')
-rw-r--r--src/code.l174
1 files changed, 92 insertions, 82 deletions
diff --git a/src/code.l b/src/code.l
index 8909de0..3d17bd1 100644
--- a/src/code.l
+++ b/src/code.l
@@ -752,6 +752,85 @@ static void addDocCrossReference(MemberDef *src,MemberDef *dst)
}
+static bool getLinkInScope(const QCString &c, // scope
+ const QCString &m, // member
+ const char *memberText, // exact text
+ BaseCodeDocInterface &ol,
+ const char *text
+ )
+{
+ MemberDef *md;
+ ClassDef *cd;
+ FileDef *fd;
+ NamespaceDef *nd;
+ GroupDef *gd;
+ //printf("Trying `%s'::`%s'\n",c.data(),m.data());
+ if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,g_sourceFileDef) &&
+ md->isLinkable())
+ {
+ //printf("Found!\n");
+ if (g_exampleBlock)
+ {
+ QCString anchor;
+ anchor.sprintf("a%d",g_anchorCount);
+ //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),g_exampleName.data(),
+ // g_exampleFile.data());
+ if (md->addExample(anchor,g_exampleName,g_exampleFile))
+ {
+ ol.writeCodeAnchor(anchor);
+ g_anchorCount++;
+ }
+ }
+ //Definition *d=0;
+ //if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd;
+
+ Definition *d = md->getOuterScope()==Doxygen::globalScope ?
+ md->getBodyDef() : md->getOuterScope();
+ if (md->getGroupDef()) d = md->getGroupDef();
+ if (d && d->isLinkable())
+ {
+ g_theCallContext.setClass(stripClassName(md->typeString()));
+ //printf("g_currentDefinition=%p g_currentMemberDef=%p g_insideBody=%d\n",
+ // g_currentDefinition,g_currentMemberDef,g_insideBody);
+
+ if (g_currentDefinition && g_currentMemberDef &&
+ md!=g_currentMemberDef && g_insideBody)
+ {
+ addDocCrossReference(g_currentMemberDef,md);
+ }
+ //printf("d->getReference()=`%s' d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
+
+ writeMultiLineCodeLink(ol,md->getReference(),
+ md->getOutputFileBase(),
+ md->anchor(),
+ text ? text : memberText);
+ addToSearchIndex(text ? text : memberText);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static bool getLink(const char *className,
+ const char *memberName,
+ BaseCodeDocInterface &ol,
+ const char *text=0)
+{
+ QCString m=removeRedundantWhiteSpace(memberName);
+ QCString c=className;
+ if (!getLinkInScope(c,m,memberName,ol,text))
+ {
+ if (!g_curClassName.isEmpty())
+ {
+ if (!c.isEmpty()) c.prepend("::");
+ c.prepend(g_curClassName);
+ return getLinkInScope(c,m,memberName,ol,text);
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName,
bool typeOnly=FALSE)
{
@@ -780,7 +859,14 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName,
{
cd=getResolvedClass(d,g_sourceFileDef,className.left(i),&md);
}
- //fprintf(stderr,"is found as a type %s\n",cd?cd->name().data():"<null>");
+ //print("is found as a type %s\n",cd?cd->name().data():"<null>");
+ if (cd==0 && md==0) // also see if it is variable or enum or enum value
+ {
+ if (getLink(g_classScope,clName,ol,clName))
+ {
+ return;
+ }
+ }
}
else
{
@@ -825,8 +911,8 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName,
{
if (md==0) // not found as a typedef
{
- //printf("setCallContextForVar(%s)\n",clName);
md = setCallContextForVar(clName);
+ //printf("setCallContextForVar(%s) md=%p g_currentDefinition=%p\n",clName,md,g_currentDefinition);
if (md && g_currentDefinition)
{
//fprintf(stderr,"%s accessible from %s? %d md->getOuterScope=%s\n",
@@ -863,85 +949,6 @@ static void generateClassOrGlobalLink(BaseCodeDocInterface &ol,char *clName,
}
}
-static bool getLinkInScope(const QCString &c, // scope
- const QCString &m, // member
- const char *memberText, // exact text
- BaseCodeDocInterface &ol,
- const char *text
- )
-{
- MemberDef *md;
- ClassDef *cd;
- FileDef *fd;
- NamespaceDef *nd;
- GroupDef *gd;
- //printf("Trying `%s'::`%s'\n",c.data(),m.data());
- if (getDefs(c,m,"()",md,cd,fd,nd,gd,FALSE,g_sourceFileDef) &&
- md->isLinkable())
- {
- //printf("Found!\n");
- if (g_exampleBlock)
- {
- QCString anchor;
- anchor.sprintf("a%d",g_anchorCount);
- //printf("addExampleFile(%s,%s,%s)\n",anchor.data(),g_exampleName.data(),
- // g_exampleFile.data());
- if (md->addExample(anchor,g_exampleName,g_exampleFile))
- {
- ol.writeCodeAnchor(anchor);
- g_anchorCount++;
- }
- }
- //Definition *d=0;
- //if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd;
-
- Definition *d = md->getOuterScope()==Doxygen::globalScope ?
- md->getBodyDef() : md->getOuterScope();
- if (md->getGroupDef()) d = md->getGroupDef();
- if (d && d->isLinkable())
- {
- g_theCallContext.setClass(stripClassName(md->typeString()));
- //printf("g_currentDefinition=%p g_currentMemberDef=%p g_insideBody=%d\n",
- // g_currentDefinition,g_currentMemberDef,g_insideBody);
-
- if (g_currentDefinition && g_currentMemberDef &&
- md!=g_currentMemberDef && g_insideBody)
- {
- addDocCrossReference(g_currentMemberDef,md);
- }
- //printf("d->getReference()=`%s' d->getOutputBase()=`%s' name=`%s' member name=`%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
-
- writeMultiLineCodeLink(ol,md->getReference(),
- md->getOutputFileBase(),
- md->anchor(),
- text ? text : memberText);
- addToSearchIndex(text ? text : memberText);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static bool getLink(const char *className,
- const char *memberName,
- BaseCodeDocInterface &ol,
- const char *text=0)
-{
- QCString m=removeRedundantWhiteSpace(memberName);
- QCString c=className;
- if (!getLinkInScope(c,m,memberName,ol,text))
- {
- if (!g_curClassName.isEmpty())
- {
- if (!c.isEmpty()) c.prepend("::");
- c.prepend(g_curClassName);
- return getLinkInScope(c,m,memberName,ol,text);
- }
- return FALSE;
- }
- return TRUE;
-}
-
static bool generateClassMemberLink(BaseCodeDocInterface &ol,ClassDef *mcd,const char *memName)
{
if (mcd)
@@ -2404,8 +2411,11 @@ OPERATOR {ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}
}
}
<MemberCall2,FuncCall>{OPERATOR} { // operator
+ if (strcmp(yytext,"*") && strcmp(yytext,"&")) // typically a pointer or reference
+ {
+ g_parmType.resize(0);g_parmName.resize(0);
+ }
g_code->codify(yytext);
- g_parmType.resize(0);g_parmName.resize(0);
}
<MemberCall,MemberCall2,FuncCall>")" {
g_theVarContext.addVariable(g_parmType,g_parmName);