Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | if (@ARGV != 3) { |
---|
4 | print STDERR "Use:\n"; |
---|
5 | print STDERR " showdf <showg-script> <old-file> <new-file>\n"; |
---|
6 | print STDERR "to create a showg diagram of glyphs differing in two files\n"; |
---|
7 | exit 1; |
---|
8 | } |
---|
9 | |
---|
10 | $cmd = shift @ARGV; |
---|
11 | $oldf = shift @ARGV; |
---|
12 | $newf = shift @ARGV; |
---|
13 | |
---|
14 | open(O, "<$oldf") or die "Unable to open '$oldf'\n"; |
---|
15 | open(N, "<$newf") or die "Unable to open '$newf'\n"; |
---|
16 | |
---|
17 | while(<O>) { |
---|
18 | last if(/CharStrings/); |
---|
19 | } |
---|
20 | while(<N>) { |
---|
21 | last if(/CharStrings/); |
---|
22 | } |
---|
23 | |
---|
24 | undef @symlist; |
---|
25 | $sym = ''; |
---|
26 | $inlist = 0; |
---|
27 | $nstop = 0; |
---|
28 | |
---|
29 | while($so = <O>) { |
---|
30 | if($so =~ m|^(/\S+)\s+\{|) { |
---|
31 | $sym = $1; |
---|
32 | $inlist = 0; |
---|
33 | #printf STDERR "found sym $sym\n"; |
---|
34 | if (!$nstop || $sn !~ m|^$sym\s+\{|) { |
---|
35 | while($sn = <N>) { |
---|
36 | #print STDERR "+$sn"; |
---|
37 | last if($sn =~ m|^${sym}\s+\{|); |
---|
38 | } |
---|
39 | } |
---|
40 | $nstop = 0; |
---|
41 | } elsif(!$nstop) { |
---|
42 | $sn = <N>; |
---|
43 | #print STDERR "<$so>$sn\n"; |
---|
44 | if($so ne $sn) { |
---|
45 | if(!$inlist) { |
---|
46 | $inlist = 1; |
---|
47 | push(@symlist, $sym); |
---|
48 | } |
---|
49 | if($sn =~ m|^(/\S+)\s+\{|) { |
---|
50 | $nstop = 1; |
---|
51 | #printf STDERR "stop at $1\n"; |
---|
52 | } |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|
56 | unshift(@symlist, $cmd, '-c', $oldf, $newf); |
---|
57 | #printf("%s\n", join(' ', @symlist)); |
---|
58 | exec @symlist; |
---|
Note: See
TracBrowser
for help on using the repository browser.