summaryrefslogtreecommitdiffstats
path: root/konsole/doc/VT100/db2.pl
blob: f961e5d31d043e1f48fb2533232e96784a86d87e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl -w

$ops = "db.trans";
$src = "../../src/TEScreen.C";
$res1 = ">TEScreen.p1";
$res2 = ">TEScreen.p2";

open(OPS, $ops) || die "cannot open file '" . $ops . "'.";

my $tbl = {};
while (<OPS>) 
{
  chop;        # strip record separator
  my @Fld = split('\|', $_);
  if ($Fld[2] && $Fld[2] eq 'scr')
  {
    $tbl->{$Fld[3]} = 1;
  }
}
#foreach $p (sort keys %$tbl)
#{ 
#  print $p, "\n";
#}

open(SRC, $src) || die "cannot open file '" . $src . "'.";
open(RES1, $res1) || die "cannot open file '" . $res1 . "'.";
open(RES2, $res2) || die "cannot open file '" . $res2 . "'.";
my $control = 0;
while (<SRC>) 
{
  chop;
  if ( /void TEScreen::(.*)\((.*)\)/ && exists $tbl->{$1} )
  {
    print RES1 "\n";
    $control = 1;
  }
  if ($control)
  {
    print RES1 $_, "\n";
  }
  else
  {
    print RES2 $_, "\n";
  }
  if ( /^}$/ )
  {
    $control = 0;
  }
}