Debian Codegraph @

src/switch/debug/demo

raw
1 #!/usr/bin/perl
2
3 @cmd = ("xterm -fn 5x7 -geometry +25+400",
4 "xterm -fn 5x7 -geometry +25+200",
5 "xterm -fn 5x7 -geometry +450+200",
6 "xterm -fn 5x7 -geometry +450+400",
7 "xterm -fn 5x7 -geometry 132x24+110+0",
8 "xterm -fn 5x7 -geometry +475+600",
9 "xterm -fn 5x7 -geometry +0+600");
10
11 open(IN,"README") || die "open README: $!";
12 while (<IN>) {
13 if (/^---\s*(\S+)\s*/) {
14 if ($mode eq "F") {
15 close OUT || die "close: $!";
16 }
17 open(OUT,">$1") || die "create $1: $!";
18 $mode = "F";
19 next;
20 }
21 if (/^Preparation/) {
22 $mode = "P";
23 next;
24 }
25 if (/^Start/) {
26 $mode = "S";
27 next;
28 }
29 if ($mode eq "P") {
30 chop;
31 $_ .= " &" if /-l/;
32 push(@do,$') if /^\s*#\s*/;
33 next;
34 }
35 if ($mode eq "S") {
36 chop;
37 next unless /^\s*%\s*/;
38 $c = $';
39 $c =~ s/-b/-d -l stderr/;
40 $c =~ s/isp/isp -v/;
41 $o = $c;
42 $c = "sh -c \"$c; sleep 300\"" if $c =~ /isp/;
43 push(@do,shift(@cmd)." -T '$o' -e $c &");
44 next;
45 }
46 if ($mode eq "F") {
47 print OUT $_ || die "write: $!";
48 }
49 }
50 if ($mode eq "F") {
51 close OUT || die "close: $!";
52 }
53 for (@do) {
54 print "$_\n";
55 system($_);
56 sleep(1);
57 }