SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: kevert on April 13, 2007, 09:07:00 am

Title: How to get a call tree
Post by: kevert 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 ?
Title: Re: How to get a call tree
Post by: hs2 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
Title: Re: How to get a call tree
Post by: lastguy 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
Title: Re: How to get a call tree
Post by: hs2 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