$putattr="PutAttrChar\\('(.)' = 0x.., {A_NORMAL}\\) at \\(([0-9]+), ([0-9]+)\\)";
$waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}";
sub transaddr
{
$arg = $_[0];
$arg =~ s/$curscr/curscr/ if ($curscr);
$arg =~ s/$newscr/newscr/ if ($newscr);
$arg =~ s/$stdscr/stdscr/ if ($stdscr);
return $arg;
}
while (<STDIN>)
{
CLASSIFY: {
$awaiting = "curscr" if ($_ =~ /creating curscr/);
$awaiting = "newscr" if ($_ =~ /creating newscr/);
$awaiting = "stdscr" if ($_ =~ /creating stdscr/);
if ($awaiting && $_ =~ /newwin: returned window is 0x([0-9a-f]+)/)
{
$curscr = "0x$1" if ($awaiting eq "curscr");
$newscr = "0x$1" if ($awaiting eq "newscr");
$stdscr = "0x$1" if ($awaiting eq "stdscr");
$awaiting = "";
}
if ($_ =~ /$putattr/)
{
$putattr_chars = $1;
$starty = $2;
$startx = $3;
while (<STDIN>)
{
if ($_ =~ /$putattr/) {
$putattr_chars .= $1;
} else {
last;
}
}
print "RUN of PutAttrChar()s: \"$putattr_chars\" from ${starty}, ${startx}\n";
redo CLASSIFY;
}
if ($_ =~ /$waddnstr/)
{
$waddnstr_chars = $2;
$winaddr = $1;
while (<STDIN>)
{
if ($_ =~ /$waddnstr/ && $1 eq $winaddr) {
$waddnstr_chars .= $2;
} else {
last;
}
}
$winaddstr = &transaddr($winaddr);
print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n";
redo CLASSIFY;
}
$anyline = &transaddr($_);
$repeatcount = 1;
while (<STDIN>) {
if (&transaddr($_) eq $anyline) {
$repeatcount++;
} else {
last;
}
}
if ($repeatcount > 1) {
print "${repeatcount} REPEATS OF $anyline";
} else {
print $anyline
}
redo CLASSIFY if $_;
} }