分页: 1 / 1
ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-12 0:00
由 liu1061
本人在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;
各位有这样的问题吗,如果用到这类函数,就不能用自动提示了。
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-12 21:51
由 liu1061
有没有朋友可以解释一下呀!
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-12 21:57
由 BigSnake.NET
加个 __THROW 就不合 C 语法了, ctags 就不认了, 所以就杯具了
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-14 21:34
由 liu1061
BigSnake.NET 写了:加个 __THROW 就不合 C 语法了, ctags 就不认了, 所以就杯具了
那如何改进呢!!
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-18 17:03
由 O_O_BOT
-I 参数
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-18 17:04
由 O_O_BOT
代码: 全选
#!/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
我在用的tags
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-23 22:43
由 liu1061
O_O_BOT
谢谢你哦!!以前没有好好看过Ctag参数!!多谢,我现在试一下如果有问题在来问你!
非常的感谢!
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-27 13:08
由 liu1061
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是不是写重了呀!
谢谢!!
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-27 14:48
由 liu1061
O_O_BOT 写了:代码: 全选
#!/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
我在用的tags
我都快疯了,怎么搞了不行,你能不能给我做一个试试呀,不用你的这个shell文件方法。
我的意思是,直接在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指点一下吧,你按我的想法试试,行不行!多谢了!!!
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-28 9:32
由 O_O_BOT
-R 是对目录下的文件 递归生成 有重复 可能
请用 g [
nonull 是写重了 呵呵
Re: ubuntu 下 socket 编程时 socket.h 里面函数不能成生tag
发表于 : 2009-09-28 21:49
由 liu1061
O_O_BOT 写了:-R 是对目录下的文件 递归生成 有重复 可能
请用 g [
nonull 是写重了 呵呵
谢谢你哦,正如你说的,可以正工作了!为什么ctrl+]与g]有区别呢!我去看看vim!非常的感谢。
