PATCH: Support for caller graph and modify hyperlink behaviour for references/referenced by
Daniel and Mary-Beth Sherwood <[email protected]>
| Newsgroups | gmane.text.doxygen.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Please find attached a patch (based on yesterday's tarball) that adds the following features: 1) Caller graphs (inverse call graphs) are enabled with the CALLER_GRAPH tag (defaults to NO) and /callergraph commands and behave in the same way as call graphs. 2) The REFERENCES_LINK_SOURCE tag (defaults to YES) can be used to modify the behaviour of the 'referenced by' and 'references' lists such that they if the tag is set to NO, then links to functions will go to the documentation rather than the source. Default behaviour remains the same. Hope that this is in the expected format for rapid inclusion. Daniel ___________________________________________________________ Switch an email account to Yahoo! Mail, you could win FIFA World Cup tickets. http://uk.mail.yahoo.com
doxygen.diff
(application/octet-stream, 10.1 KB)
diff -r doxygen.base/Doxyfile doxygen/Doxyfile
115a116
> REFERENCES_LINK_SOURCE = YES
227a229
> CALLER_GRAPH = NO
diff -r doxygen.base/doc/commands.doc doxygen/doc/commands.doc
50a51
> \refitem cmdcallergraph \\callergraph
220a222,233
> \section cmdcallergraph \\callergraph
>
> \addindex \\callergraph
> When this command is put in a comment block of a function or method
> and \ref cfg_have_dot "HAVE_DOT" is set to YES, then doxygen will
> generate a caller graph for that function (provided the implementation of the
> function or method calls other documented functions). The caller graph will
> generated regardless of the value of \ref cfg_caller_graph "CALLER_GRAPH".
> \note The completeness (and correctness) of the caller graph depends on the
> doxygen code parser which is not perfect.
>
> <hr>
diff -r doxygen.base/doc/config.doc doxygen/doc/config.doc
66a67
> \refitem cfg_caller_graph CALLER_GRAPH
182a184
> \refitem cfg_references_link_source REFERENCES_LINK_SOURCE
921a924,931
> \anchor cfg_references_link_source_relation
> <dt>\c REFERENCES_LINK_SOURCE <dd>
> \addindex REFERENCES_LINK_SOURCE
> If the \c REFERENCES_LINK_SOURCE tag is set to \c YES (the default)
> and SOURCE_BROWSER tag is set to \c YES, then the hyperlinks from
> functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
> link to the source code. Otherwise they will link to the documentstion.
>
1690a1701,1709
> \anchor cfg_caller_graph
> <dt>\c CALLER_GRAPH <dd>
> \addindex CALLER_GRAPH
> If the \c CALLER_GRAPH and \c HAVE_DOT tags are set to \c YES then doxygen will
> generate a caller dependency graph for every global function or class method.
> Note that enabling this option will significantly increase the time of a run.
> So in most cases it will be better to enable caller graphs for selected
> functions only using the \\callergraph command.
>
diff -r doxygen.base/doc/diagrams.doc doxygen/doc/diagrams.doc
57a58,60
> <li>if \ref cfg_caller_graph "CALLER_GRAPH" is set to YES, a
> graphical caller graph is drawn for each function showing the
> functions that the function is directly or indirectly called by.
diff -r doxygen.base/qtools/Doxyfile doxygen/qtools/Doxyfile
529a530,536
> # If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
> # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
> # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
> # link to the source code. Otherwise they will link to the documentstion.
>
> REFERENCES_LINK_SOURCE = YES
>
1075a1083,1090
> # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will
> # generate a caller dependency graph for every global function or class method.
> # Note that enabling this option will significantly increase the time of a run.
> # So in most cases it will be better to enable caller graphs for selected
> # functions only using the \callergraph command.
>
> CALLER_GRAPH = NO
>
diff -r doxygen.base/src/code.l doxygen/src/code.l
769c769
< if (Config_getBool("REFERENCED_BY_RELATION") &&
---
> if ((Config_getBool("REFERENCED_BY_RELATION") || Config_getBool("CALLER_GRAPH")) &&
diff -r doxygen.base/src/commentscan.l doxygen/src/commentscan.l
95a96
> static bool handleCallergraph(const QCString &);
181a183
> { "callergraph", &handleCallergraph },
2079a2082,2087
> static bool handleCallergraph(const QCString &)
> {
> current->callerGraph = TRUE; // ON
> return FALSE;
> }
>
diff -r doxygen.base/src/config.l doxygen/src/config.l
1951a1952,1959
> cb = addBool( "REFERENCES_LINK_SOURCE",
> "If the REFERENCES_LINK_SOURCE tag is set to YES (the default)\n"
> "and SOURCE_BROWSER tag is set to YES, then the hyperlinks from\n"
> "functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will\n"
> "link to the source code. Otherwise they will link to the documentstion.\n",
> TRUE
> );
> cb->addDependency("SOURCE_BROWSER");
2653a2662,2671
> "CALLER_GRAPH",
> "If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will \n"
> "generate a caller dependency graph for every global function or class method. \n"
> "Note that enabling this option will significantly increase the time of a run. \n"
> "So in most cases it will be better to enable caller graphs for selected \n"
> "functions only using the \\callergraph command.\n",
> FALSE
> );
> cb->addDependency("HAVE_DOT");
> cb = addBool(
diff -r doxygen.base/src/definition.cpp doxygen/src/definition.cpp
546c546
< if (md->getStartBodyLine()!=-1 && md->getBodyDef())
---
> if (!(md->isLinkable() && !Config_getBool("REFERENCES_LINK_SOURCE")) && md->getStartBodyLine()!=-1 && md->getBodyDef())
diff -r doxygen.base/src/dot.cpp doxygen/src/dot.cpp
2187c2187
< DotCallGraph::DotCallGraph(MemberDef *md,int maxRecursionDepth)
---
> DotCallGraph::DotCallGraph(MemberDef *md,int maxRecursionDepth,bool inverse)
2190a2191
> m_inverse = inverse;
2236c2237
< QCString baseName=m_diskName+"_cgraph";
---
> QCString baseName = m_diskName + (m_inverse ? "_icgraph" : "_cgraph");
2260c2261
< FALSE // backArrows
---
> m_inverse // backArrows
2348c2349
< MemberSDict *refs = md->getReferencesMembers();
---
> MemberSDict *refs = m_inverse ? md->getReferencedByMembers() : md->getReferencesMembers();
diff -r doxygen.base/src/dot.h doxygen/src/dot.h
200c200
< DotCallGraph(MemberDef *md,int maxRecursionDepth);
---
> DotCallGraph(MemberDef *md,int maxRecursionDepth, bool inverse);
212a213
> bool m_inverse;
diff -r doxygen.base/src/doxygen.cpp doxygen/src/doxygen.cpp
1676a1677
> newMd->enableCallerGraph(root->callerGraph);
1833a1835
> md->enableCallerGraph(root->callerGraph);
2001a2004
> md->enableCallerGraph(root->callerGraph);
2523a2527
> md->enableCallerGraph(root->callerGraph);
2755a2760
> md->enableCallerGraph(md->hasCallerGraph() || root->callerGraph);
2865a2871
> md->enableCallerGraph(root->callerGraph);
3013a3020
> mmd->enableCallerGraph(mmd->hasCallerGraph() || fmd->hasCallerGraph());
3014a3022
> fmd->enableCallerGraph(mmd->hasCallerGraph() || fmd->hasCallerGraph());
3186a3195
> mdef->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
3187a3197
> mdec->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
4356a4367
> md->enableCallerGraph(root->callerGraph);
4468a4480
> md->enableCallerGraph(md->hasCallerGraph() || root->callerGraph);
5281a5294
> md->enableCallerGraph(root->callerGraph);
5341a5355
> md->enableCallerGraph(root->callerGraph);
5501a5516
> md->enableCallerGraph(root->callerGraph);
5564a5580
> md->enableCallerGraph(root->callerGraph);
5859a5876
> md->enableCallerGraph(root->callerGraph);
6351c6368
< (Doxygen::parseSourcesNeeded || Config_getBool("CALL_GRAPH")))
---
> (Doxygen::parseSourcesNeeded || Config_getBool("CALL_GRAPH") || Config_getBool("CALLER_GRAPH")))
diff -r doxygen.base/src/entry.cpp doxygen/src/entry.cpp
89a90
> callerGraph = e.callerGraph;
226a228
> callerGraph = FALSE;
diff -r doxygen.base/src/entry.h doxygen/src/entry.h
272a273
> bool callerGraph; //!< do we need to draw the caller graph?
diff -r doxygen.base/src/memberdef.cpp doxygen/src/memberdef.cpp
335a336
> m_hasCallerGraph = FALSE;
1911c1912
< DotCallGraph callGraph(this,Config_getInt("MAX_DOT_GRAPH_DEPTH"));
---
> DotCallGraph callGraph(this,Config_getInt("MAX_DOT_GRAPH_DEPTH"), false);
1922a1924,1939
> if ((m_hasCallerGraph || Config_getBool("CALLER_GRAPH"))
> && isFunction() && Config_getBool("HAVE_DOT")
> )
> {
> DotCallGraph callerGraph(this,Config_getInt("MAX_DOT_GRAPH_DEPTH"), true);
> if (!callerGraph.isTrivial())
> {
> msg("Generating caller graph for function %s\n",qualifiedName().data());
> ol.disable(OutputGenerator::Man);
> ol.newParagraph();
> ol.startCallGraph();
> ol.parseText(theTranslator->trCallerGraph());
> ol.endCallGraph(callerGraph);
> ol.enableAll();
> }
> }
2461a2479,2484
> void MemberDef::enableCallerGraph(bool e)
> {
> m_hasCallerGraph=e;
> if (e) Doxygen::parseSourcesNeeded = TRUE;
> }
>
diff -r doxygen.base/src/memberdef.h doxygen/src/memberdef.h
267a268,271
> // callergraph related members
> bool hasCallerGraph() const { return m_hasCallerGraph; }
> void enableCallerGraph(bool e);
>
354a359
> bool m_hasCallerGraph;
diff -r doxygen.base/src/pycode.l doxygen/src/pycode.l
476c476
< if (Config_getBool("REFERENCED_BY_RELATION") &&
---
> if ((Config_getBool("REFERENCED_BY_RELATION") || Config_getBool("CALLER_GRAPH")) &&
diff -r doxygen.base/src/scanner.l doxygen/src/scanner.l
534c534
< SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"xrefitem"|"ingroup"|"callgraph"|"latexonly"|"htmlonly"|"xmlonly"|"{"|"verbatim"|"dotfile"|"dot"|"defgroup"|"addtogroup"|"weakgroup"|"class"|"namespace"|"union"|"struct"|"fn"|"var"|"details"|"typedef"|"def"|"overload")|("<"{PRE}">")
---
> SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"xrefitem"|"ingroup"|"callgraph"|"callergraph"|"latexonly"|"htmlonly"|"xmlonly"|"{"|"verbatim"|"dotfile"|"dot"|"defgroup"|"addtogroup"|"weakgroup"|"class"|"namespace"|"union"|"struct"|"fn"|"var"|"details"|"typedef"|"def"|"overload")|("<"{PRE}">")
diff -r doxygen.base/src/translator.h doxygen/src/translator.h
409a410,414
> virtual QCString trCallerGraph()
> {
> return "Here is the caller graph for this function:";
> }
>