Previous Page Next Page Contents

prog::calltree -- visualize the call structure of nested function calls

Introduction

With prog::calltree the call structure of nested function calls can be visualized.

Call(s)

prog::calltree(statement <, maxdepth > <, excl_funcs > <, option>)

Parameters

statement - 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

Options

Args - The arguments of any function call are printed additionally.
Tree - The call of prog::calltree returns an object of type adt::Tree.

Returns

prog::calltree returns the result of the execution of statement. Additionally, information on the flow of control is printed.

Related Functions

prog::trace, setuserinfo, debug, prog::profile

Details

Option: Args

Option: Tree

Example 1

fib 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

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000