CTAGS忽略libc6的,的libstdc ++和升压名单 [英] ctags ignore lists for libc6, libstdc++ and boost

查看:183
本文介绍了CTAGS忽略libc6的,的libstdc ++和升压名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用vim和CTAGS的 OmniCppComplete 插件。目前,我生成标签,当我做单独为每个库。对于我libc6的使用令牌/宏以下列表中的一个名为libc6的,忽略文件处理过程中忽略:

  __ attribute__
__attribute_de precated__
__attribute_format_arg__
__attribute_format_strfmon__
__attribute_malloc__
__attribute_noinline__
__attribute_pure__
__attribute_used__
__attribute_warn_unused_result__
__wur
__扔
__nonnull +

我失去了任何其他标​​记我应该忽略,我应该使用相同的列表或产生的libstdc ++的标签,当一个不同的提升?

对于任何人谁是有兴趣的我用下面的生成我的标记文件:

 #首先确保的apt-文件安装,然后做:$ sudo易于文件更新#为libc的设置标签,标准C库$的apt-文件列表中的libc6-dev的| grep的-o'/usr/include/.*\\.h'> 〜/的.vim /标签/ libc6的,文件清单:
$ CTAGS --sort = foldcase --c ++ - 种= + P = --fields攻速+ --extra = + Q -I./libc6-ignore -f〜/的.vim /标签/ -L libc6的〜/的.vim /标签/ libc6的,文件清单:#创建stdlibc ++和STL标签$贴切文件列表的libstdc ++ 6-4.4-dev的| grep的-E -o'/usr/include/.*\\.(h|hpp)'> 〜/的.vim /标签/ stdlibcpp,文件清单:
$ CTAGS --sort = foldcase -R --c ++ - 种= + P = --fields攻速+ --extra = + Q -f〜/的.vim /标签/ stdlibcpp -L〜/的.vim /标签/ stdlibcpp-文件清单#升压$贴切文件列表提振| grep的-E -o'/usr/include/.*\\.(h|hpp)| grep的-v/ usr / include目录/升压/ typeof运算/'> 〜/的.vim /标签/升压文件清单
$ CTAGS --sort = foldcase --c ++ - 种= + P = --fields攻速+ --extra = + Q -f〜/的.vim /标签/升压-L〜/的.vim /标签/升压文件清单


解决方案

<击>您还可以使用修改后的libstdc ++库:

http://www.vim.org/scripts/script.php? SCRIPT_ID = 2358

这包含了C ++头文件的一个简化版本,它适用于CTAGS。

我做了提取所有标签和从标签文件下划线开头的Python脚本。您可以使用此脚本标签排除选择。
随意定制脚本以满足您的需求或建议别的:

 进口重标签=打开('标签','R')
输出=开放('排除','W')
正则表达式= re.compile('^ _ [A-ZA-Z0-9 _] *)
结果=集()在标签行:
    结果= regex.match(线)
    如果(!结果=无):
        results.add(result.group(0))tags.close()在排序(结果)元素:
    output.write({0} \\ n'.format(元素))output.close()

I use ctags with vim and the OmniCppComplete plugin. Currently when generating my tags I do it individually for each library. For libc6 I use the following list of tokens / macros in a file named libc6-ignore to ignore during processing:

__attribute__
__attribute_deprecated__
__attribute_format_arg__
__attribute_format_strfmon__
__attribute_malloc__
__attribute_noinline__
__attribute_pure__
__attribute_used__
__attribute_warn_unused_result__
__wur
__THROW
__nonnull+

Am I missing any other tokens I should be ignoring and should I be using this same list or a different one when generating tags for libstdc++ and boost?

For anyone who's interested I use the following to generate my tag files:

# First make sure apt-file is install and then do:

$ sudo apt-file update

# set up tags for libc, the standard C library

$ apt-file list libc6-dev | grep -o '/usr/include/.*\.h'> ~/.vim/tags/libc6-filelist
$ ctags --sort=foldcase --c++-kinds=+p --fields=+iaS --extra=+q -I./libc6-ignore -f ~/.vim/tags/libc6 -L ~/.vim/tags/libc6-filelist 

# create tags for stdlibc++ and STL

$ apt-file list libstdc++6-4.4-dev | grep -E -o '/usr/include/.*\.(h|hpp)' > ~/.vim/tags/stdlibcpp-filelist
$ ctags --sort=foldcase -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/stdlibcpp -L ~/.vim/tags/stdlibcpp-filelist

# For Boost

$ apt-file list boost | grep -E -o '/usr/include/.*\.(h|hpp)' | grep -v '/usr/include/boost/typeof/' > ~/.vim/tags/boost-filelist
$ ctags --sort=foldcase --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/boost -L ~/.vim/tags/boost-filelist 

解决方案

You can also use the modified libstdc++ library:

http://www.vim.org/scripts/script.php?script_id=2358

This contains a stripped version of the C++ header files which works for ctags.

I made a Python script that extracts all tags beginning with an underscore from a tags file. You can choose with this script which tags to exclude. Feel free to tailor the script to meet your needs or suggest anything else:

import re

tags=open('tags','r')
output=open('exclude','w')
regex=re.compile('^_[a-zA-Z0-9_]*')
results=set()

for line in tags:
    result=regex.match(line)
    if(result!=None):
        results.add(result.group(0))

tags.close()

for element in sorted(results):
    output.write('{0}\n'.format(element))

output.close()

这篇关于CTAGS忽略libc6的,的libstdc ++和升压名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆