-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfaux_bold.pl
executable file
·49 lines (45 loc) · 997 Bytes
/
faux_bold.pl
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/env perl
use strict;
use warnings 'FATAL' => 'all';
use Carp ();
$SIG{__DIE__} = sub { Carp::confess(@_) };
while (my $line = <STDIN>)
{
chomp $line;
my ($code, @rest) = split(/\s+/, $line);
my @details;
for my $i (1..pop(@rest))
{
my $dline = <STDIN>;
chomp $dline;
push(@details, $dline);
}
if ($code eq 'MT')
{
$rest[3]++;
}
elsif ($code eq 'BB')
{
$rest[0]++;
}
elsif ($code eq 'GM' || $code eq 'GL')
{
my $pos = ($code eq 'GM') ? 0 : 1;
$rest[$pos]++ if $rest[$pos] > 0;
for my $y (0..(scalar(@details) - 1))
{
my $dline = $details[$y];
$dline .= '.';
my @dvals = map { $_ eq '*' } split(//, $dline);
my $nline;
for my $x (0..(scalar(@dvals) - 1))
{
$nline .= ($dvals[$x] || ($x && $dvals[$x - 1])) ? '*' : '.';
}
$details[$y] = $nline;
}
}
print join(' ', $code, @rest, scalar(@details)) . "\n";
print map { $_ . "\n" } @details;
}
exit;