Description Usage Arguments Details Author(s) See Also Examples
This function (and the collection of supporting methods for recursive processing of the nodes) attempts to determine whether any of the mutable parameters, i.e. pointers or references, are actually modified with the body of the routine. If they are, these are probably out variables that we would want to return to the R user in a call to the specified routine.
This is incomplete at present and more a working prototype for people to add methods for new cases.
It does not try to determine inout variables, but just out. An inout parameter is one whose value is also used as an input to the code, i.e. is on the right hand side or in a call to another routine within the code and not just assigned a value.
1 | getInOutArgs(routine, nodes, params = list())
|
routine |
the resolved routine of interest.
In the future, we will add support for working with the
simple routine description or node returned from
|
nodes |
the parser, i.e. array of nodes. This is the return value
from |
params |
this is not usually specified by the top-level caller but calculated from the definition of the routine and passed to the recursive calls. This is the character vector giving the index or identifier of the parm_decl nodes corresponding to the mutable parameters of the routine. |
We need to enhance this to deal with assignments to local variables which are themselves modified. Also, we need to add a mechanism to identify the routines that are called with any of these parameters and the identity of the parameters so we can recursively determine things.
Duncan Temple Lang
createMethodBinding
getCallGraph
1 2 3 4 5 6 | filename = system.file("examples", "inout", "inout.c.tu", package = "RGCCTranslationUnit")
o = parseTU(filename)
rr = getRoutines(o, "inout.c")
routines = resolveType(rr, o)
getInOutArgs(routines$foo, o)
getInOutArgs(routines$bar, o)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.