eval 'exec perl $0 $1' if $running_under_some_shell; # Build a (sorted) VI(M) tags file including GP functions # $src=$ARGV[0] || "$ENV{HOME}/PARI/src"; $tmptags="$src/tags.tmp"; $tags="$src/tags"; # assume ctags outputs sorted tags (e.g Exuberant Ctags) system("ctags -f $tmptags `find $src -name '*.[chs]' -type f -print`"); getnames("$src/gp/gp_init.c"); getnames("$src/language/init.c"); open(T,"$tmptags"); @tags=""; $old=""; for (sort(@gp)) { ($a, $b) = split(/#/); if ($a eq $old) { push(@tags,"$b$rest\n"); next; } $old = $a; while() { push(@tags,$_); if (/^$a(.*)/) { $rest="$1"; push(@tags,"$b$rest\n"); last; } } } while() { push(@tags,$_); } open(OUT,">$tags"); print OUT sort(@tags); unlink $tmptags; sub getnames { open(A,$_[0]); while () { if (/^entree functions_/../^$/) { push(@gp,"$2#$1") if (/[^"]*"([^"]*)".*\(void\*\) *([^,]*)/); } } close(A); }