473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to Identify functions in a .C File??

can any one help me out in writing a c code for identifying all the
functions present and the number of arguments taken by each function in
a given .C file????

Regards,
Pardha

Mar 31 '06 #1
9 3472
Ico
Pardha <pa*************@gmail.com> wrote:
can any one help me out in writing a c code for identifying all the
functions present and the number of arguments taken by each function in
a given .C file????


Take a look at 'cproto' :

http://sourceforge.net/projects/cproto/

--
:wq
^X^Cy^K^X^C^C^C^C
Mar 31 '06 #2
Pardha wrote:
can any one help me out in writing a c code for identifying all the
functions present and the number of arguments taken by each function in
a given .C file????

Have a look at the gcc source.

--
Ian Collins.
Mar 31 '06 #3
"Pardha" wrote:
can any one help me out in writing a c code for identifying all the
functions present and the number of arguments taken by each function in
a given .C file????


Unless this is a student's project, why to reinvent the wheel?
http://ctags.sourceforge.net/index.html
Mar 31 '06 #4
In article <11**********************@j33g2000cwa.googlegroups .com>,
Pardha <pa*************@gmail.com> wrote:
can any one help me out in writing a c code for identifying all the
functions present and the number of arguments taken by each function in
a given .C file????


You (or something acting on your behalf) need to parse all the
include files and need to parse the C code in order to determine
such things. Macros and comments and conditional compilation
and quoted strings can all consume apparent declarations,
and macros be used to create code that does not look like declarations
but is.

In short: unless you are forced to write this yourself, use someone else's
pre-written tool for it.

And watch out that the tool matches the compiler version you are using,
as there are compiler extensions in common compilers that result in
declarations being understood where the C language standards would say
the code was invalid.
--
Prototypes are supertypes of their clones. -- maplesoft
Apr 1 '06 #5
Walter Roberson wrote:
In article <11**********************@j33g2000cwa.googlegroups .com>,
Pardha <pa*************@gmail.com> wrote:
can any one help me out in writing a c code for identifying all the
functions present and the number of arguments taken by each function in
a given .C file????


Do you also need the functions defined in the include files?
The standard include files can define a large number of such
functions that are never used in a specific program.

You (or something acting on your behalf) need to parse all the
include files and need to parse the C code in order to determine
such things. Macros and comments and conditional compilation
and quoted strings can all consume apparent declarations,
and macros be used to create code that does not look like declarations
but is.
To parse the include files, you could use one of the
pre-processors (like the one that comes with gcc), just
make sure that all the defines set up automatically
by the compiler match those used in the pre-processor.
In short: unless you are forced to write this yourself, use someone else's
pre-written tool for it.

And watch out that the tool matches the compiler version you are using,
as there are compiler extensions in common compilers that result in
declarations being understood where the C language standards would say
the code was invalid.


----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Apr 3 '06 #6
On Mon, 03 Apr 2006 14:49:48 -0600, Kevin Handy <kt*@srv.net> wrote:
Walter Roberson wrote:
In article <11**********************@j33g2000cwa.googlegroups .com>,
Pardha <pa*************@gmail.com> wrote:
can any one help me out in writing a c code for identifying all the
functions present and the number of arguments taken by each function in
a given .C file????


Do you also need the functions defined in the include files?
The standard include files can define a large number of such
functions that are never used in a specific program.


Most header files do not define functions. They declare them.

Remove del for email
Apr 4 '06 #7
hi,

i need only those functions that are defined in the source file.
i dnt need those functions that that are declared in the header
files...

regards,
Pardha

Apr 5 '06 #8
Pardha wrote:

i need only those functions that are defined in the source file.
i dnt need those functions that that are declared in the header
files...


What, if anything, is this about? Lacking context, it is totally
meaningless. Google is not usenet, it is only a foully
misorganized interface to usenet. There is no reason to assume any
reader has ever, or ever will, receive any particular message.
Thus your articles have to stand by themselves. For means to do
this even via Google, see my sig below. Please read the referenced
URLs.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Apr 5 '06 #9
Pardha wrote:

can any one help me out in writing a c code for identifying all the
functions present and the number
of arguments taken by each function in
a given .C file????


That might be tough.
I wrote this code for David Moews Bignum contest a long time ago.
I think there are 66 different functions defined here.

/* pete-4.c */

#define F(Q,R,P) Q(int x){int i=x;while(i--)x=R(x,x);return x;}\
P(int L,int x){int i=x;if(L--)while(i--)x=P(L,x);return Q(x);}

#define Y(A,z,B,C,D,E,G,H,I,J,K,M,N,O,S,T,U,V,W)\
F(A,z,B)F(C,B,D)F(E,D,G)F(H,G,I)F(J,I,K)F(M,K,N)F( O,N,S)F(T,S,U)F(V,U,W)

Z(int L,int x)
{
int i = x;

if(L--)
while(i--)
x = Z(L,x);
return x << x;
}

Y(a,Z,b,c,d,e,g,h,X,j,k,m,n,o,s,t,u,v,w)
Y(Aa,w,Ba,Ca,Da,Ea,Ga,Ha,Ia,Ja,Ka,Ma,Na,Oa,Sa,Ta,U a,Va,Wa)
Y(Ab,Wa,Bb,Cb,Db,Eb,Gb,Hb,Ib,Jb,Kb,V,U,W,T,S,O,N,M )
F(A,M,B)
F(C,B,D)
F(E,D,G)
F(H,G,I)
F(J,I,K)

int main()
{
return K(99999,9);
}
--
pete
Apr 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: NewToCPP | last post by:
Is there any debugging mechanism to find out which part of the code is causing memory leak?
1
by: smitap | last post by:
Hi , I have to print the name of the file and the function into a log file. I am using "writeToLog" function for that in all the files and all the functions in that file. Can anyone let me know...
6
by: Pieter | last post by:
Hi, For some procedures that throws exceptions, I would like to show different messages to the user depending on what type of exception he's getting. For instance this one: when the file is...
6
by: Pieter | last post by:
Hi, For some procedures that throws exceptions, I would like to show different messages to the user depending on what type of exception he's getting. For instance this one: when the file is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.