By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,291 Members | 3,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,291 IT Pros & Developers. It's quick & easy.

List of all functions in a C files

P: n/a
Hi All,

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

thanks,
Uday
Nov 15 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a
> 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.

--
Martijn
http://www.sereneconcepts.nl
Nov 15 '05 #2

P: n/a
In article <Eo**************@news.oracle.com>, Uday <l0***@yahoo.com> wrote:
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.
--
7842++
Nov 15 '05 #3

P: n/a
Uday wrote:

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


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>

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 15 '05 #4

P: n/a
CBFalconer wrote:
Uday wrote:

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


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

Nov 15 '05 #5

P: n/a
In article <11**********************@o13g2000cwo.googlegroups .com>,
Robert Gamble <rg*******@gmail.com> wrote:
....
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.

Nov 15 '05 #6

P: n/a
Kenny McCormack wrote:
In article <11**********************@o13g2000cwo.googlegroups .com>,
Robert Gamble <rg*******@gmail.com> wrote:
...
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.


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.

Nov 15 '05 #7

P: n/a
CBFalconer wrote:
Uday wrote:

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


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

Nov 15 '05 #8

P: n/a
Jaspreet wrote:
Kenny McCormack wrote:
In article <11**********************@o13g2000cwo.googlegroups .com>,
Robert Gamble <rg*******@gmail.com> wrote:
...
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.


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

Nov 15 '05 #9

P: n/a
Robert Gamble wrote:
CBFalconer wrote:
Uday wrote:

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


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?


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.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 15 '05 #10

P: n/a
Uday wrote:

Part 1.1 Type: Plain Text (text/plain)
Encoding: 7bit


Security risk html/mime ignored and destroyed. Usenet is a pure
text medium.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 15 '05 #11

P: n/a


CBFalconer wrote:
Uday wrote:
Part 1.1 Type: Plain Text (text/plain)
Encoding: 7bit

Security risk html/mime ignored and destroyed. Usenet is a pure
text medium.


"Usenet is a pure text medium?" Surely you're
joking, Mr. Fey-- er, Falconer.

http://ars.userfriendly.org/cartoons/?id=20050720

--
Er*********@sun.com

Nov 15 '05 #12

P: n/a
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...

Nov 15 '05 #13

P: n/a
On 2005-07-22 05:27, LucasRescue wrote:
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...


Not necessarily.

Nov 15 '05 #14

P: n/a
In article <20050724194328.U39760@gothmog>,
Giorgos Keramidas <ke******@ceid.upatras.gr> wrote:
On 2005-07-22 05:27, LucasRescue wrote:
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...


Not necessarily.


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

Nov 15 '05 #15

P: n/a
ga*****@yin.interaccess.com (Kenny McCormack) wrote:
In article <20050724194328.U39760@gothmog>,
Giorgos Keramidas <ke******@ceid.upatras.gr> wrote:
On 2005-07-22 05:27, LucasRescue wrote:
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...


Not necessarily.


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
Nov 15 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.