Author Topic: How to get a call tree  (Read 4271 times)

kevert

  • Community Member
  • Posts: 5
  • Hero Points: 0
How to get a call tree
« on: April 13, 2007, 09:07:00 am »
Can anybody tell me how can I get a call tree or a called tree in  graphics mode in C project ?
Can cbrower.e do it ? But how can I do ?
« Last Edit: April 13, 2007, 09:11:39 am by kevert »

hs2

  • Senior Community Member
  • Posts: 2752
  • Hero Points: 291
Re: How to get a call tree
« Reply #1 on: April 13, 2007, 10:34:43 am »
If you want to get the calltree of the current tag when editing, you can try this macro.
Unfortunately you need to patch cbrowser.e - maybe_convert_proto_to_proc(): remove 'static'
Normally you get the 'Show Call Tree' or 'Calls or uses' bei r-clicking (context menu) in 'Defs' or 'Symbols' toolbar.

Code: [Select]
// incl. switch back to edit win if called from by keybinding
static boolean called_from_edit_win = true;

_command edit_calltree() name_info(','VSARG2_EDITORCTL)
{
   struct VS_TAG_BROWSE_INFO cm;
   _UpdateContext(true);
   _UpdateLocals(true,true);
   int context_id = tag_current_context();
   if (context_id > 0)
   {
      tag_get_context_info(context_id, cm);

      // check if there is a load-tags function, if so, bail out
      _str ext=_bufname2ext( cm.file_name );
      int index=find_index('vs'ext'-load-tags',PROC_TYPE);
      if (index_callable(index)) {
         _message_box(nls('Can not locate source code for %s.',cm.file_name));
         return(1);
      }

      // This has to be patched from 'static' to 'global' in cbrowser.e
      maybe_convert_proto_to_proc(cm);
      // store called_from_edit_win flag (used in on_destroy2)
      called_from_edit_win = true;

      show("-xy _cbcalls_form", cm, true);
   }
}

defeventtab _cbcalls_form;
void ctl_ok_button.on_destroy2()
{
   // switch back to edit win
   if ( called_from_edit_win )
   {
      called_from_edit_win = false;
      cursor_data();
   }
}

HS2

lastguy

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: How to get a call tree
« Reply #2 on: June 08, 2007, 10:40:30 pm »
HS2: would you mind be more specific, v11.0.2 has no _convert_proto_to_proc() in the file. thanks

hs2

  • Senior Community Member
  • Posts: 2752
  • Hero Points: 291
Re: How to get a call tree
« Reply #3 on: June 09, 2007, 10:29:28 am »
In v11.02 it's there: cbrowser.e - maybe_convert_proto_to_proc() [line 2745]
Good luck,
HS2