List of all functions in a C files

U

Uday

Hi All,

Is there way to list all functions in a C files? I've to rename all the
functions.

thanks,
Uday
 
M

Martijn

Is there way to list all functions in a C files? I've to rename all
the functions.

I don't know what you are trying to do, but you may want to rethink your
strategy.
 
A

Anonymous 7843

Hi All,

Is there way to list all functions in a C files? I've to rename all the
functions.

UNIX-ish answer: compile it and run elfdump or nm with the appropriate
options.

Windows answer: your "visual" thingy has a mode that lists function names

Or just read the files yourself and write down a list. if there is a
large number of functions to deal with (100+) then such a change should
probably planned with great care, far beyond simply renaming. Sounds
like someone gave you some busy-work.
 
R

Robert Gamble

CBFalconer said:
Many. nm, cscope, xref all come to mind.

What exactly would be the prescribed procedure for obtaining a list of
all functions in a source file using cscope?

Robert Gamble
 
K

Kenny McCormack

Robert Gamble said:
What exactly would be the prescribed procedure for obtaining a list of
all functions in a source file using cscope?

Probably start by reading the manual. After that, it's easy.
 
J

Jaspreet

Kenny said:
Probably start by reading the manual. After that, it's easy.

I thought cscope pnly had the following options:

Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:

Not sure how can I get a list of functions in a file.
 
R

Robert Gamble

Jaspreet said:
I thought cscope pnly had the following options:

Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:

Not sure how can I get a list of functions in a file.

Apparently Kenny has a copy of the manual that contains information not
found at http://cscope.sourceforge.net/cscope_man_page.html. Maybe he
will be kind enough to enlighten us with the knowledge of where to
obtain said manual.

Robert Gamble
 
U

Uday

CBFalconer said:
Uday wrote:



Many. nm, cscope, xref all come to mind. However you have to make
corresponding changes in many files, including the .h ones. Once
you have a list id2id will come in handy. See:

<http://cbfalconer.home.att.net/download/id2id-20.zip>
Thanks a lot Chuck. I used *nm *to get the function names and then used
*id2id*.

But not sure how cscope helps here. I use cscope daily. It doesn't have
an option to list all function names in a C file. Let me know if I
missed something.


rgds,
Uday
 
C

CBFalconer

Robert said:
What exactly would be the prescribed procedure for obtaining a
list of all functions in a source file using cscope?

Cscope does seem to be a problem. It also has some funny ideas
about what constitutes a function.

However the xref I include in the hashlib package (DOS executable
only, source is lost) marks all function names with a terminal ().
So you can easily pick out the list with simple things such as
"grep () <xrefoutput.xrf>". However it won't discriminate between
static declarations in different files. It considers functional
macros to be functions and has similar failings to cscope. To
illustrate:

#include <iso646.h>

int main(void) {
while (not(something)) continue;
....

and cscope and xref both think not is a function.
 
L

LucasRescue

Hi if you are try to rename all functions in a c files, you take the
risk of your project not run in other operationals system...
 
R

Richard Bos

Please go to m-w.com and lookup the word "risk".

Yes, and? If you write a C program, any C program, you take the risk of
it not running under other implementations, because some do declare
identifiers they should not declare. If it's a proper C implementation,
these non-Standard identifiers can be turned off. Renaming all functions
in _your_ C files, if done correctly, does not increase this risk.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top