ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
-
- 帖子: 31
- 注册时间: 2008-06-02 12:44
ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
本人在ubuntu /usr/include/ 下面用ctags 生成了一个大的tags文件,但是里面有一些用到的函数不能找到。这些函数有个特点就是后面用个__THROW;
eg:
extern int socket(int __domain, int __type, int __protocol) __THROW;
extern int socketpair (int __domain, int __type, int __protocol, int __fds[2]) __THROW;
extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) __THROW;
extern int getsockname (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len) __THROW;
各位有这样的问题吗,如果用到这类函数,就不能用自动提示了。
eg:
extern int socket(int __domain, int __type, int __protocol) __THROW;
extern int socketpair (int __domain, int __type, int __protocol, int __fds[2]) __THROW;
extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len) __THROW;
extern int getsockname (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __len) __THROW;
各位有这样的问题吗,如果用到这类函数,就不能用自动提示了。
-
- 帖子: 31
- 注册时间: 2008-06-02 12:44
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
有没有朋友可以解释一下呀!
- BigSnake.NET
- 帖子: 12522
- 注册时间: 2006-07-02 11:16
- 来自: 廣州
- 联系:
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
加个 __THROW 就不合 C 语法了, ctags 就不认了, 所以就杯具了
^_^ ~~~
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
-
- 帖子: 31
- 注册时间: 2008-06-02 12:44
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
那如何改进呢!!BigSnake.NET 写了:加个 __THROW 就不合 C 语法了, ctags 就不认了, 所以就杯具了
- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
-I 参数
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
代码: 全选
#!/bin/bash
p=/usr/include/
echo "std"
std=(aio.h arpa/inet.h assert.h complex.h cpio.h ctype.h dirent.h \
dlfcn.h errno.h fcntl.h fenv.h float.h fmtmsg.h fnmatch.h ftw.h \
glob.h grp.h iconv.h inttypes.h iso646.h langinfo.h libgen.h \
limits.h locale.h math.h monetary.h mqueue.h ndbm.h net/if.h \
netdb.h netinet/in.h netinet/tcp.h nl_types.h poll.h pthread.h \
pwd.h regex.h sched.h search.h semaphore.h setjmp.h signal.h \
spawn.h stdarg.h stdbool.h stddef.h stdint.h stdio.h stdlib.h \
string.h strings.h stropts.h syslog.h tar.h termios.h tgmath.h \
time.h trace.h ucontext.h ulimit.h unistd.h utime.h utmpx.h \
wchar.h wctype.h wordexp.h getopt.h)
std=${std[@]/#/$p}
ctags -f std --c++-kinds=+p --fields=+iaS --extra=+q \
-I "__nonnull __dead2 __pure2 __unused __packed __aligned \
__section __always_inline __nonnull __wur __THROW" $std
libs=("gtk*" "glib*" curl sys bits)
libs=${libs[@]/#/$p}
for file in $libs;do
if [ ! -d "$file" ]; then
continue
fi
dirname=$(basename "$file")
echo "$dirname"
ctags -f "$dirname" -R --c++-kinds=+p --fields=+iaS --extra=+q \
-I "__nonnull __dead2 __pure2 __unused __packed __aligned \
__section __always_inline __nonnull __wur __THROW" "$file"
done
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
-
- 帖子: 31
- 注册时间: 2008-06-02 12:44
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
O_O_BOT
谢谢你哦!!以前没有好好看过Ctag参数!!多谢,我现在试一下如果有问题在来问你!
非常的感谢!
谢谢你哦!!以前没有好好看过Ctag参数!!多谢,我现在试一下如果有问题在来问你!
非常的感谢!
-
- 帖子: 31
- 注册时间: 2008-06-02 12:44
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q \
-I "__nonnull __dead2 __pure2 __unused __packed __aligned \
__section __always_inline __nonnull __wur __THROW" .
O_O_BOT :
我使用了上面的ctags生成了tags文件,但还是有些错误,不知道为什么,总是定位到错的头文件上面,难道非得向你那样指定头文件吗?还有上面两个__nonnull是不是写重了呀!
谢谢!!
-I "__nonnull __dead2 __pure2 __unused __packed __aligned \
__section __always_inline __nonnull __wur __THROW" .
O_O_BOT :
我使用了上面的ctags生成了tags文件,但还是有些错误,不知道为什么,总是定位到错的头文件上面,难道非得向你那样指定头文件吗?还有上面两个__nonnull是不是写重了呀!
谢谢!!
-
- 帖子: 31
- 注册时间: 2008-06-02 12:44
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
我都快疯了,怎么搞了不行,你能不能给我做一个试试呀,不用你的这个shell文件方法。O_O_BOT 写了:我在用的tags代码: 全选
#!/bin/bash p=/usr/include/ echo "std" std=(aio.h arpa/inet.h assert.h complex.h cpio.h ctype.h dirent.h \ dlfcn.h errno.h fcntl.h fenv.h float.h fmtmsg.h fnmatch.h ftw.h \ glob.h grp.h iconv.h inttypes.h iso646.h langinfo.h libgen.h \ limits.h locale.h math.h monetary.h mqueue.h ndbm.h net/if.h \ netdb.h netinet/in.h netinet/tcp.h nl_types.h poll.h pthread.h \ pwd.h regex.h sched.h search.h semaphore.h setjmp.h signal.h \ spawn.h stdarg.h stdbool.h stddef.h stdint.h stdio.h stdlib.h \ string.h strings.h stropts.h syslog.h tar.h termios.h tgmath.h \ time.h trace.h ucontext.h ulimit.h unistd.h utime.h utmpx.h \ wchar.h wctype.h wordexp.h getopt.h) std=${std[@]/#/$p} ctags -f std --c++-kinds=+p --fields=+iaS --extra=+q \ -I "__nonnull __dead2 __pure2 __unused __packed __aligned \ __section __always_inline __nonnull __wur __THROW" $std libs=("gtk*" "glib*" curl sys bits) libs=${libs[@]/#/$p} for file in $libs;do if [ ! -d "$file" ]; then continue fi dirname=$(basename "$file") echo "$dirname" ctags -f "$dirname" -R --c++-kinds=+p --fields=+iaS --extra=+q \ -I "__nonnull __dead2 __pure2 __unused __packed __aligned \ __section __always_inline __nonnull __wur __THROW" "$file" done
我的意思是,直接在vim中输入ctags -R --c++-kinds=+p --fields=+iaS --extra=+q \
-I "__nonnull __dead2 __pure2 __unused __packed __aligned \
__section __always_inline __nonnull __wur __THROW" .
这就可直接生成tags,是生成tags了,但用ctlr+]意是跳不正确,如socket,bind等等,
set tags=/usr/include/tags
对socket 用ctrl+]时它跳到/usr/include/rpcsvc/nislib.h中去了!bind 用ctrl+]时它跳到
/usr/include/c++/4.2.4/trl/functional_iterate.h中去了。
对了个问题我都搞疯了,不知道为什么呀!我的目的就是真生成一个liunx系统tags!!
BOT指点一下吧,你按我的想法试试,行不行!多谢了!!!
- O_O_BOT
- 帖子: 2461
- 注册时间: 2009-05-20 19:32
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
-R 是对目录下的文件 递归生成 有重复 可能
请用 g [
nonull 是写重了 呵呵
请用 g [
nonull 是写重了 呵呵
irc 聊天室
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
ubuntu-cn 的irc 频道为
irc.ubuntu.com 8001 #ubuntu-cn
UTF8编码 可用 irssi xchat pidgin weechat 登录
http://webchat.freenode.net/?channels=ubuntu-cn
[url]irc://irc.freenode.net/ubuntu-cn[/url]
-
- 帖子: 31
- 注册时间: 2008-06-02 12:44
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
谢谢你哦,正如你说的,可以正工作了!为什么ctrl+]与g]有区别呢!我去看看vim!非常的感谢。O_O_BOT 写了:-R 是对目录下的文件 递归生成 有重复 可能
请用 g [
nonull 是写重了 呵呵