Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ctags multi-line C function prototypes

Is there a way for ctags to handle multiline function prototypes in C?

I've searched around and the --fields=+S is supposed to do multiline prototypes, but I can't get it to work:

ctags -x --c-kinds=pf --fields=+S file

file:

int 
foo(int
    x, int y
    );

ctags only returns:

foo(int

(Note that the return type is also missing)

Ultimately I would like to get an output similar to

int foo(int x, int y);

or

int foo(int x, int y

is --fields=+S not the correct way? Are there part of the ctags fields that I am missing? Any pointers in general?

If there is not a way to do it in ctags, any recommended programs? (I'm currently looking at uncrustify)

like image 598
pseudosudo Avatar asked Jul 25 '11 18:07

pseudosudo


2 Answers

I had the same issue with my code but I couldn't modify it. When I use the --fields=+S parameter, it seem to work because I get an additional line in the tag file. The signature: part contains all the parameters of the function.

CopyToTX26 D:\BiseL\My Dropbox\Work\0_BSW\PKG_CMD\Memory.c /^void CopyToTX26( uint16 memory_ID, uint32 ** pt_data_address, uint32 nb_recover, $/;" f signature:( uint16 memory_ID, uint32 ** pt_data_address, uint32 nb_recover, uint32 * nb_copied, uint32 max_length )

like image 179
Leo Avatar answered Oct 20 '22 02:10

Leo


--_xformat option may help you.

[jet@localhost ~]$ cat /tmp/foo.h
int 
foo(int
    x, int y
    );
[jet@localhost ~]$ ~/var/ctags/ctags -x --c-kinds=pf --_xformat="%-16N %4n %-16F %C %S" /tmp/foo.h
foo                 2 /tmp/foo.h       foo(int (int x,int y)
like image 27
Masatake YAMATO Avatar answered Oct 20 '22 03:10

Masatake YAMATO