prog::calltree -- visualize the
call structure of nested function calls
IntroductionWith prog::calltree the call structure of nested
function calls can be visualized.
Call(s)prog::calltree(statement <, maxdepth > <, excl_funcs
> <, option>)
Parametersstatement |
- | a MuPAD statement to examine |
maxdepth |
- | maximal ``call depth'' to show calls on screen |
excl_funcs |
- | set of MuPAD objects to exclude from showing on screen |
option |
- | a set or one of Plain and Args |
OptionsArgs |
- | The arguments of any function call are printed additionally. |
Tree |
- | The call of prog::calltree returns an
object of type adt::Tree. |
Returnsprog::calltree returns the result of the execution of
statement. Additionally, information on the flow of
control is printed.
Related
Functionsprog::trace, setuserinfo, debug, prog::profile
Detailsprog::calltree visualizes the call structure of nested
function calls.statement can be any MuPAD statement. If a
function is called, prog::calltree prints all functions
called while executing statement in a tree structure.
Option: Args
Option: Treeprog::calltree returns an object of type
adt::Tree. No output is
printed on screen. The return object contains all call structure
informations, that would be printed on screen without this option (see
adt::Tree).
Example
1fib is a self-calling procedure,
prog::calltree visualizes the calling structure:
>> fib:= proc(n)
begin
if n < 2 then
n
else
fib(n - 1) + fib(n - 2)
end_if
end_proc:
prog::calltree(fib(4))
fib
|
+-- fib
| |
| +-- fib
| | |
| | +-- fib
| | |
| | `-- fib
| |
| `-- fib
|
`-- fib
|
+-- fib
|
`-- fib
3
With the option Args, the arguments of each function call are printed:
>> prog::calltree(fib(3), Args)
fib(fib(3))
|
+-- fib(fib(2))
| |
| +-- fib(fib(1))
| |
| `-- fib(fib(0))
|
`-- fib(fib(1))
2