Hm... quite complex but better than nothing. Thx.

On Thu, Feb 18, 2016 at 5:22 AM, Shigio YAMAGUCHI <[email protected]> wrote:
> Hi,
> Though it cannot said an easy way, you can do it using the ctags plug-in
> parser.
> You need to modify both Exuberant Ctags and the ctags plug-in parser like
> follows:
>
> 1. Exuberant Ctags (version 5.8): writeXrefEntry() in entry.c
>
> [BEFORE]
>     length += writeCompactSourceLine (TagFile.fp, line);
>
> [AFTER]
>     if (Option.extensionFields.signature && tag->extensionFields.signature
> != NULL)
>         length += fprintf (TagFile.fp, "signature:%s",
> tag->extensionFields.signature);
>     else
>         length += writeCompactSourceLine (TagFile.fp, line);
>
> 2. Ctags plug-in parser (GLOBAL_6.5.2): plugin-factory/exuberant-c
>
> [BEFORE]
> #if defined(USE_EXTRA_FIELDS)
>         "--_xformat=%R %-16N %4n %-16F %C",
>         "--extra=+r",
> #else
>         "--format=1",
> #endif
>
> [AFTER]
> #if defined(USE_EXTRA_FIELDS)
>         "--_xformat=%R %-16N %4n %-16F %C",
>         "--extra=+r",
>         "--fields=+rS",
> #else
>         "--format=1",
>         "--fields=+S",
> #endif
>
> 3. The result
>
> $ global -x main
> main                2 main.c           signature:( int argc, char *argv[] )
>
> Regards,
> Shigio
>
>
> 2016-02-18 7:45 GMT+09:00 john smith <[email protected]>:
>>
>> Is this possible to get a full prototype of a given function in a
>> standardized, easily parsable form?  The point is I need to get a
>> number of parameters for a number of functions as I am writing a
>> custom REPL-like tool that will call functions from an external API.
>> I need to know how many parameters every function takes in order to
>> inform user that he gave too few parameters. What I do now is this:
>>
>> $ gtags -v -f LIST
>> $ global -f diff.h
>> foo                 5 diff.h           foo(
>>
>> But it doesn't show any arguments that foo() takes.  It's written like
>> this in a source file:
>>
>> void
>> foo(
>> int a,
>>          int b, int c, char
>> *f)
>> {
>> }
>>
>> It's possible to do this in ctags:
>>
>> $ ctags  --fields=+S diff.h
>> $ less tags
>> (...)
>> foo     diff.h  /^foo($/;"      f       signature:( int a, int b, int
>> c, char *f)
>>
>> Now I can easily parse `signature:part' and get a number of
>> parameters.  I could use ctags but I got used to global, is this
>> possible here?
>>
>> --
>> <[email protected]>
>>
>> _______________________________________________
>> Help-global mailing list
>> [email protected]
>> https://lists.gnu.org/mailman/listinfo/help-global
>
>
>
>
> --
> Shigio YAMAGUCHI <[email protected]>
> PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



-- 
<[email protected]>

_______________________________________________
Help-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-global

Reply via email to