Re: Is it possible to make c global variable as a tag?

Shigio YAMAGUCHI <[email protected]> Tue, 18 Apr 2017 20:49:44 +0900
Newsgroups gmane.comp.gnu.global.general
Message-ID <CADJmJYqHvvYisK_P2uekJV1QApCBAv2BgZMbwWEy+udU2w-Fhw@mail.gmail.com>
--===============0483749425159814449==
Content-Type: multipart/alternative; boundary=001a113f971c0b8939054d6f81db

--001a113f971c0b8939054d6f81db
Content-Type: text/plain; charset=UTF-8

Hi,
> Is it possible to make c global variable as a tag?
>
> Would be better if the fields of c structs are also recorded in tag file.

Yes, it is. Please use -s option of global(1).
There is no distinction between definitions and references, though.

$ cat -n test.c
     1  int gv;
     2  struct {
     3          int m1;
     4  } gv2;
     5  main() {
     6          gv = 1;
     7          gv2.m1 = 2;
     8  }
$ gtags
$ global -xs '.*'
gv                  1 test.c           int gv;
gv                  6 test.c                   gv = 1;
gv2                 4 test.c           } gv2;
gv2                 7 test.c                   gv2.m1 = 2;
m1                  3 test.c                   int m1;
m1                  7 test.c                   gv2.m1 = 2;

Regards,
Shigio


2017-04-18 12:42 GMT+09:00 Shiyao Ma <[email protected]>:

> Hi,
>
> Is it possible to make c global variable as a tag?
>
> Would be better if the fields of c structs are also recorded in tag file.
>
>
> Best.
>
> _______________________________________________
> Help-global mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-global
>



-- 
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint:
26F6 31B4 3D62 4A92 7E6F  1C33 969C 3BE3 89DD A6EB (Currently in use)
D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3 (Used until 2017/2)

--001a113f971c0b8939054d6f81db
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,</div><div>&gt; Is it possible to make c global va=
riable as a tag?</div><div>&gt;</div><div>&gt; Would be better if the field=
s of c structs are also recorded in tag file.</div><div><br></div><div>Yes,=
 it is. Please use -s option of global(1).</div><div>There is no distinctio=
n between definitions and references, though.</div><div><br></div><div>$ ca=
t -n test.c</div><div>=C2=A0 =C2=A0 =C2=A01 =C2=A0int gv;</div><div>=C2=A0 =
=C2=A0 =C2=A02 =C2=A0struct {</div><div>=C2=A0 =C2=A0 =C2=A03 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0int m1;</div><div>=C2=A0 =C2=A0 =C2=A04 =C2=A0} gv2;</=
div><div>=C2=A0 =C2=A0 =C2=A05 =C2=A0main() {</div><div>=C2=A0 =C2=A0 =C2=
=A06 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0gv =3D 1;</div><div>=C2=A0 =C2=A0 =
=C2=A07 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0gv2.m1 =3D 2;</div><div>=C2=A0 =
=C2=A0 =C2=A08 =C2=A0}</div><div>$ gtags</div><div>$ global -xs &#39;.*&#39=
;</div><div>gv =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A01 test.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int gv;</div><div>gv =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06 test.c =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gv =3D 1;</div><div>gv=
2 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 4 test.c =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 } gv2;</div><div>gv2 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 7 test.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gv2.m1 =3D 2;</div><div>m1 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A03 test.c =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 int m1;</div><div>m1 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A07 test.c =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gv2.m1 =3D 2;</div><div><b=
r></div><div>Regards,</div><div>Shigio</div><div><br></div></div><div class=
=3D"gmail_extra"><br><div class=3D"gmail_quote">2017-04-18 12:42 GMT+09:00 =
Shiyao Ma <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_b=
lank">[email protected]</a>&gt;</span>:<br><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Is it possible to make c global variable as a tag?<br>
<br>
Would be better if the fields of c structs are also recorded in tag file.<b=
r>
<br>
<br>
Best.<br>
<br>
______________________________<wbr>_________________<br>
Help-global mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]</a><br>
<a href=3D"https://lists.gnu.org/mailman/listinfo/help-global" rel=3D"noref=
errer" target=3D"_blank">https://lists.gnu.org/mailman/<wbr>listinfo/help-g=
lobal</a><br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><d=
iv><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr">Shig=
io YAMAGUCHI &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">shigio=
@gnu.org</a>&gt;</div><div dir=3D"ltr"><div dir=3D"ltr">PGP fingerprint:=C2=
=A0</div><div dir=3D"ltr">26F6 31B4 3D62 4A92 7E6F =C2=A01C33 969C 3BE3 89D=
D A6EB (Currently in use)</div><div dir=3D"ltr">D1CB 0B89 B346 4AB6 5663 =
=C2=A0C4B6 3CA5 BBB3 57BE DDA3 (Used until 2017/2)</div></div></div></div><=
/div></div></div></div>
</div>

--001a113f971c0b8939054d6f81db--


--===============0483749425159814449==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============0483749425159814449==--