473,587 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3486
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************ **********@j33g 2000cwa.googleg roups.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************ **********@j33g 2000cwa.googleg roups.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************ **********@j33g 2000cwa.googleg roups.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.c om, 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/googlegroupsrep ly/>
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);retur n x;}\
P(int L,int x){int i=x;if(L--)while(i--)x=P(L,x);retur n 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,Ua,Va,Wa)
Y(Ab,Wa,Bb,Cb,D b,Eb,Gb,Hb,Ib,J b,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
2292
by: NewToCPP | last post by:
Is there any debugging mechanism to find out which part of the code is causing memory leak?
1
2984
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 about a macro which can be used for this purpose so that the same line of code is written in all the files and functions instead of changing the function name and file name for all the occurrances of writeToLog(). A code snippet for the same will...
6
2485
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 locked, I want a messagebox to tell that the user has to close the file first. Is there a way to identify an exception by some kind of unique number or something like this? I don't want to identify it on the Exception Message because some users are...
6
1220
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 locked, I want a messagebox to tell that the user has to close the file first. Is there a way to identify an exception by some kind of unique number or something like this? I don't want to identify it on the Exception Message because some users are...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7974
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.