[BACK]Return to make_vi_tags CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / src

File: [local] / OpenXM_contrib / pari-2.2 / src / Attic / make_vi_tags (download)

Revision 1.2, Wed Sep 11 07:26:47 2002 UTC (21 years, 9 months ago) by noro
Branch: MAIN
CVS Tags: RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2
Changes since 1.1: +20 -1 lines

Upgraded pari-2.2 to pari-2.2.4.

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";

@tags=""; $old="";
# 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");
geterrs("$src/language/errmsg.c");
open(T,"$tmptags");
for (sort(@gp))
{
  ($a, $b) = split(/#/);
  if ($a eq $old) { push(@tags,"$b$rest\n"); next; }
  $old = $a;
  while(<T>)
  {
    push(@tags,$_);
    if (/^$a(.*)/) { $rest="$1"; push(@tags,"$b$rest\n"); last; }
  }
}
while(<T>) { push(@tags,$_); }
close(T);

open(OUT,">$tags");
print OUT sort(@tags);
unlink $tmptags;

sub getnames
{
  open(A,$_[0]);
  while (<A>)
  {
    if (/^entree functions_/../^$/)
    {
      push(@gp,"$2#$1") if (/[^"]*"([^"]*)".*\(void\*\) *([^,]*)/);
    }
  }
  close(A);
}

sub geterrs
{
  my $f = $_[0];
  open(A,$f);
  while (<A>)
  {
    if (m,^/(\*\s*\w+\s*\*)/,)
    {
      $e = $pat = $1;
      $e =~ s/\W*(\w+)\W*/$1/;
      push(@tags, "$e\t$f\t/$pat\n");
    }
  }
  close(A);
}