bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gtags and ctags like --regex support


From: Aneesh Kumar
Subject: Re: gtags and ctags like --regex support
Date: Sun, 21 Jun 2009 12:11:18 +0530

On Sun, Jun 21, 2009 at 6:44 AM, Shigio YAMAGUCHI<address@hidden> wrote:
> Hi,
>> Is there a way i can make gtags makes tags based on the regex matching
>> in addition to the tags made with the standard parsing based on
>> language ?
>> What i wanted to achive is to  use something like
>> --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'
>> That would help me have tag data generated with name like
>> sys_fallocate where in the code it will appear
>> as SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
>
> This kind of option is available in Exuberant Ctags.
> You can use Exuberant Ctag as a parser for GLOBAL.
> (It cannot make GRTAGS and GSYMS files though.)
> Please see the section 'Plug-in parser' in the info manual and
> gtags.conf file.
>
> However, it might be quicker to rewrite gtags-parser/C.c directly.
> You can refer the code for recognizing Guile function entries (SCM_DEFINE).
>

I did that and it mostly works. But the linux kernel have complex
indirection like
SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
which it doesn't match.

it works for SYSCALL_DEFINE3(open, const char __user *, filename, int,
flags, int, mode)

+                                               linux_kernel =
getenv("LINUX_KERNEL_SOURCE");
+                                               if (linux_kernel &&
!strcmp(linux_kernel, "yes") &&
+
!strncmp(savetok, "SYSCALL_DEFINE", 14 ) && *arg1) {
+
strcpy(savetok, "sys_");
+
strncat(savetok, arg1, sizeof(savetok) - 4);
+                                               }


But it is better than what i had till now.

> By the way, the help mailing list (address@hidden) would be better
> to post such a question. You can get answers easily there. :)

I did post to help-global. But didn't receive any response.


http://lists.gnu.org/archive/html/help-global/2009-02/msg00000.html

-aneesh




reply via email to

[Prev in Thread] Current Thread [Next in Thread]