ctags 多行 C 函数原型
ctags 有没有办法处理 C 中的多行函数原型?
我已经搜索过, --fields=+S
应该做多行原型,但我无法让它工作:
ctags -x --c-kinds=pf --fields=+S file
file:
int
foo(int
x, int y
);
ctags 仅返回:(
foo(int
请注意,返回类型是也缺少)
最终我想得到类似于的输出
int foo(int x, int y);
,或者
int foo(int x, int y
--fields=+S
不是正确的方法? 我是否缺少部分 ctags 字段? 一般情况下有什么指点吗?
如果ctags没有办法做到这一点,有什么推荐的程序吗? (我目前正在研究 uncrustify)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我的代码也有同样的问题,但我无法修改它。
当我使用 --fields=+S 参数时,它似乎有效,因为我在标记文件中获得了额外的行。签名:部分包含函数的所有参数。
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 签名:( uint16 memory_ID, uint32 ** pt_data_address, uint32 nb_recover,uint32 * nb_copied,uint32 max_length )
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 )
--_xformat 选项可能会帮助您。
--_xformat option may help you.
我找不到 ctags 的任何内容,因此我编写了一个 python 脚本来重新排列我的文件,以便 ctags 可以捕获原型。
注意:我的代码有注释,所以要注意删除它们(否则它们会妨碍 ctags)。
操作按以下顺序完成:
I was unable to find anything with ctags so I wrote a python script to re-arrange my file so that ctags could capture the prototypes.
Note: my code had comments and so much of this takes care with removing them (otherwise they would get in the way of ctags).
Manipulations were done in this order:
您可以使用简单的过滤器删除不需要的换行符,例如
You can remove unneeded line breaks with a simple filter, e.g.