Annotation of OpenXM_contrib/pari-2.2/src/make_vi_tags, Revision 1.2
1.1 noro 1: eval 'exec perl $0 $1'
2: if $running_under_some_shell;
3: # Build a (sorted) VI(M) tags file including GP functions
4: #
5: $src=$ARGV[0] || "$ENV{HOME}/PARI/src";
6: $tmptags="$src/tags.tmp";
7: $tags="$src/tags";
8:
1.2 ! noro 9: @tags=""; $old="";
1.1 noro 10: # assume ctags outputs sorted tags (e.g Exuberant Ctags)
11: system("ctags -f $tmptags `find $src -name '*.[chs]' -type f -print`");
12: getnames("$src/gp/gp_init.c");
13: getnames("$src/language/init.c");
1.2 ! noro 14: geterrs("$src/language/errmsg.c");
1.1 noro 15: open(T,"$tmptags");
16: for (sort(@gp))
17: {
18: ($a, $b) = split(/#/);
19: if ($a eq $old) { push(@tags,"$b$rest\n"); next; }
20: $old = $a;
21: while(<T>)
22: {
23: push(@tags,$_);
24: if (/^$a(.*)/) { $rest="$1"; push(@tags,"$b$rest\n"); last; }
25: }
26: }
27: while(<T>) { push(@tags,$_); }
1.2 ! noro 28: close(T);
! 29:
1.1 noro 30: open(OUT,">$tags");
31: print OUT sort(@tags);
32: unlink $tmptags;
33:
34: sub getnames
35: {
36: open(A,$_[0]);
37: while (<A>)
38: {
39: if (/^entree functions_/../^$/)
40: {
41: push(@gp,"$2#$1") if (/[^"]*"([^"]*)".*\(void\*\) *([^,]*)/);
1.2 ! noro 42: }
! 43: }
! 44: close(A);
! 45: }
! 46:
! 47: sub geterrs
! 48: {
! 49: my $f = $_[0];
! 50: open(A,$f);
! 51: while (<A>)
! 52: {
! 53: if (m,^/(\*\s*\w+\s*\*)/,)
! 54: {
! 55: $e = $pat = $1;
! 56: $e =~ s/\W*(\w+)\W*/$1/;
! 57: push(@tags, "$e\t$f\t/$pat\n");
1.1 noro 58: }
59: }
60: close(A);
61: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>