Author Topic: How to get list of functions in current c++ file  (Read 8334 times)

ehab

  • Senior Community Member
  • Posts: 285
  • Hero Points: 15
  • coding with SE is like playing music
How to get list of functions in current c++ file
« on: March 17, 2008, 10:07:36 AM »
hi

i didn't do a lot of searching on this but maybe some one already knows how.

I want to able to list all functions in current c++ file with arguments in a new buffer.

eg:

sample.cpp

void fun1()
{
....
 }

int fun2(int i)
{
....
 }


call some macro

New buffer, contains:
void fun1();
int fun2(int i);



any direction appreicated.
ehab


LBCEi

  • Senior Community Member
  • Posts: 261
  • Hero Points: 21
Re: How to get list of functions in current c++ file
« Reply #1 on: March 18, 2008, 05:11:07 AM »
This is close to what you are looking for.  Works in V12 and V13beta2 on C source (haven't tried on C++).  The same context menu has several other options that may be similar.

1.  Open the Defs toolbar.
2.  Expand the node (file) you want.
3.  Right click the desired file and select Contents->Save Subtree.
4.  Enter a filename into the Save File Tree As Text dialog (browse as desired to pick where to store the file)

This will save the list of functions in the selected file to a .txt file and open that file as a buffer.

The output format is (for example):

Code: [Select]
|| File.c
   Fn Example_function(void)
   Fn Example_function2(uint8 param)
   Fn Example_function3(uint8 *Record)
   Fn Num_To_ASCII(uint8 Number)

You can then easily use block selection to delete the extra 'Fn ' (and the indent if you wish). You can also, obviously, delete the first line with the source file name (and the leading '|| ', if you don't want it.

You can record/edit a macro based on this menu-based way of doing this if you want to short-cut the process.

I hope this helps.

Les
« Last Edit: March 18, 2008, 05:52:07 AM by LBCEi »

ehab

  • Senior Community Member
  • Posts: 285
  • Hero Points: 15
  • coding with SE is like playing music
Re: How to get list of functions in current c++ file
« Reply #2 on: March 18, 2008, 08:51:53 AM »
Yes it is  : ) thank you very much

my regards
ehab