gcc: extract function prototypes
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > gcc: extract function prototypes




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    gcc: extract function prototypes  
rhXX


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-15-07 06:20 PM

hi,

is there any option of gcc in order to extract the function prototypes
of the functions written in a file (.c or .c++) ?

i would appreciate very much any comment or help

tks in advance






[ Post a follow-up to this message ]



    Re: gcc: extract function prototypes  
William.Deans@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-16-07 12:17 PM

On May 15, 11:06 am, rhXX <rh00...@gmail.com> wrote:
> hi,
>
> is there any option of gcc in order to extract the function prototypes
> of the functions written in a file (.c or .c++) ?
>
> i would appreciate very much any comment or help
>
> tks in advance

I am sure there is a better solution than this, but in case no one
steps forward with one:
---------------------

Greetings,

I don't know the answer to your question but I do know that some IDE's
have a tree view which includes functions prototypes.  If your job was
on a medium to large scale you could automate the extraction using
that code.  Simply modify the IDE such that it logs the function
prototypes as it adds them to the tree view.  Unless you run into some
difficulty, I do not see why this logging code should take longer than
a few minutes to add.

Hope this helps,
William






[ Post a follow-up to this message ]



    Re: gcc: extract function prototypes  
Thomas Dickey


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-16-07 12:17 PM

rhXX <rh00667@gmail.com> wrote:
> hi,

> is there any option of gcc in order to extract the function prototypes
> of the functions written in a file (.c or .c++) ?

protoize works for C (except that it changes the parameter types).
cproto also works for C (doesn't change the parameter types).

http://invisible-island.net/cproto/

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net





[ Post a follow-up to this message ]



    Re: gcc: extract function prototypes  
rhXX


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-17-07 12:16 PM

> Greetings,
>
> I don't know the answer to your question but I do know that some IDE's
> have a tree view which includes functions prototypes.  If your job was
> on a medium to large scale you could automate the extraction using
> that code.  Simply modify the IDE such that it logs the function
> prototypes as it adds them to the tree view.  Unless you run into some
> difficulty, I do not see why this logging code should take longer than
> a few minutes to add.
>
> Hope this helps,
> William

i'm not sure, but many years ago, i remember that there was an option
in the compiler (maybe borland C???) that generate all the prototypes
of the project.

now i wanted to include this option in the makefile and have all
prototypes updated. really it is not a BIG project, only i want to do
it .... im not working with ide enviroment but simple comand line

just yesterday i found in internet cprot (already refered in the next
answer), it worked ok for C

tks a lot!






[ Post a follow-up to this message ]



    Re: gcc: extract function prototypes  
rhXX


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-17-07 12:16 PM

On May 16, 12:42 pm, Thomas Dickey <dic...@saltmine.radix.net> wrote:
> rhXX <rh00...@gmail.com> wrote: 
>
> protoize works for C (except that it changes the parameter types).
> cproto also works for C (doesn't change the parameter types).
>
>        http://invisible-island.net/cproto/
>
> --
> Thomas E. Dickeyhttp://invisible-island.netftp://invisible-island.net

tks a lot! yesterday, before i read ur note, i found internet cproto,
i compiled it and worked fine. anyway i will check ur link also about
protoize.

tks very much!






[ Post a follow-up to this message ]



    Re: gcc: extract function prototypes  
rhXX


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-18-07 12:20 PM

> > protoize works for C (except that it changes the parameter types).[vbcol=seagreen] 

hi thomas,

i was looking about protoize, but i'm a bit confused:

protoize works in the same .c file, and as u told, it changes the
parameters types, for example a function i wrote as

test()  it changes to test(void)

that is ok

it introduces at the begining of .c file, ONLY the prototypes of
functions forward refered, not ALL of the functions defined in the
file, ok????

the huge .X file contains ALL the definition found for that .c file
including ALL the headers found?

cproto, gives me a cute file, only with the functions defined in
the .c file. ok?????

so i can't obtain the similar results of cproto with protoize?????

tks in advance









[ Post a follow-up to this message ]



    Re: gcc: extract function prototypes  
rhXX


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-18-07 12:20 PM

> > > protoize works for C (except that it changes the parameter types).

so at the end, the useful file, .X, can be obtained directly with the
option -aux-info in gcc??? (very huge file)

in this case any .c or .h file are changed

ok???
tks in advance






[ Post a follow-up to this message ]



    Re: gcc: extract function prototypes  
Thomas Dickey


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-22-07 12:18 PM

rhXX <rh00667@gmail.com> wrote: 
[vbcol=seagreen]
> hi thomas,

> i was looking about protoize, but i'm a bit confused:

> protoize works in the same .c file, and as u told, it changes the
> parameters types, for example a function i wrote as

> test()  it changes to test(void)

that's ok, but not what I meant.  Something like

int foo(a) char a; {}

would be handled by protoize as

int foo(char a) {}

which may seem right, except that's not the way K&R code is mapped to ANSI.
The default promotion rule for "char a;" makes it really "int a;":

int foo(int a) {}

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:24 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register