Mac OS X 上的丰富 ctags 问题

发布于 2024-09-06 05:26:32 字数 1370 浏览 1 评论 0原文

我正在尝试使用 Exuberant Ctags 5.8 为 C 标准库生成标签,但是似乎标头未完全解析...例如,当我为 /usr/include/string.h 生成标签时,我得到this:

!_TAG_FILE_FORMAT   2   /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED   1   /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR    Darren Hiebert  /[email protected]/
!_TAG_PROGRAM_NAME  Exuberant Ctags //
!_TAG_PROGRAM_URL   http://ctags.sourceforge.net    /official site/
!_TAG_PROGRAM_VERSION   5.8 //
NULL    /usr/include/string.h   /^#define NULL /;"  d
_SIZE_T /usr/include/string.h   /^#define   _SIZE_T$/;" d
_SSIZE_T    /usr/include/string.h   /^#define _SSIZE_T$/;"  d
_STRING_H_  /usr/include/string.h   /^#define   _STRING_H_$/;"  d
size_t  /usr/include/string.h   /^typedef   __darwin_size_t     size_t;$/;" t
ssize_t /usr/include/string.h   /^typedef __darwin_ssize_t  ssize_t;$/;"    t
strerror    /usr/include/string.h   /^char  *strerror(int) __DARWIN_ALIAS(strerror);$/;"    v

显然,缺少很多函数(strcpy、strlen、strcmp 等。)这是实际头文件的链接:http://pastie.org/private/lvgvtg1lmzaenidg0rvq

我刚刚运行了 ctags /usr/include/string.h 我做错了什么吗?任何帮助将不胜感激...

I'm trying to generate tags for the C Standard Lib using Exuberant Ctags 5.8, however it seems that the headers are not parsed completely... For example, when I generate the tags for /usr/include/string.h, I get this:

!_TAG_FILE_FORMAT   2   /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED   1   /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR    Darren Hiebert  /[email protected]/
!_TAG_PROGRAM_NAME  Exuberant Ctags //
!_TAG_PROGRAM_URL   http://ctags.sourceforge.net    /official site/
!_TAG_PROGRAM_VERSION   5.8 //
NULL    /usr/include/string.h   /^#define NULL /;"  d
_SIZE_T /usr/include/string.h   /^#define   _SIZE_T$/;" d
_SSIZE_T    /usr/include/string.h   /^#define _SSIZE_T$/;"  d
_STRING_H_  /usr/include/string.h   /^#define   _STRING_H_$/;"  d
size_t  /usr/include/string.h   /^typedef   __darwin_size_t     size_t;$/;" t
ssize_t /usr/include/string.h   /^typedef __darwin_ssize_t  ssize_t;$/;"    t
strerror    /usr/include/string.h   /^char  *strerror(int) __DARWIN_ALIAS(strerror);$/;"    v

Obviously, a lot of functions are missing (strcpy, strlen, strcmp, etc..) Here's a link to the actual header file: http://pastie.org/private/lvgvtg1lmzaenidg0rvq

I just ran ctags /usr/include/string.h Am I doing something wrong? Any help would be appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

彼岸花ソ最美的依靠 2024-09-13 05:26:32

我相信 ctags 默认情况下不包含函数原型,仅包含函数实现。

如果您将其称为 ctags --c-kinds=+px /usr/include/string.h,那么您是否也可以获得声明?

(根据手册页此处,您可以调用ctags −−list−kinds =c 找出可以让 ctags 输出的内容。)

I believe that ctags doesn't include function prototypes by default, only function implementations.

If you call it as ctags --c-kinds=+px /usr/include/string.h, does that get you the declarations as well?

(According to the manual page here, you can call ctags −−list−kinds=c to find out what you can get ctags to output.)

雨落星ぅ辰 2024-09-13 05:26:32

我在这里找到了一些相关信息: http:// /www.mail-archive.com/[电子邮件受保护]/msg2103 27.html

值得注意的是:

ctags默认不为函数原型生成标签,仅
对于实际的函数定义。请参阅文档
---ctags(1) 中的 kinds 选项

所以事实证明我必须添加 --c-kinds=+p 标志才能解析函数原型。我不确定为什么它默认不解析原型?

I found some relevant information here: http://www.mail-archive.com/[email protected]/msg210327.html

Notably:

ctags does not generate tags for function prototypes by default, only
for the actual function definitions. See the documentation for the
---kinds option in ctags(1)

So it turns out I have to add the --c-kinds=+p flag for it to parse function prototypes. I'm not sure why it doesn't parse prototypes by default?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文