diff options
author | peter <peter@FreeBSD.org> | 1999-08-24 01:06:48 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-08-24 01:06:48 +0000 |
commit | bacd15cb1fff2dee94d390e0f84c147cd82ea148 (patch) | |
tree | ad214c5b2c8142ad6dc6d2ce3a9c83e6317d7f77 /contrib/ncurses/test/tracemunch | |
download | FreeBSD-src-bacd15cb1fff2dee94d390e0f84c147cd82ea148.zip FreeBSD-src-bacd15cb1fff2dee94d390e0f84c147cd82ea148.tar.gz |
Import unmodified (but trimmed) ncurses 5.0 prerelease 990821.
This contains the full eti (panel, form, menu) extensions.
bmake glue to follow.
Obtained from: ftp://ftp.clark.net/pub/dickey/ncurses
Diffstat (limited to 'contrib/ncurses/test/tracemunch')
-rwxr-xr-x | contrib/ncurses/test/tracemunch | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/contrib/ncurses/test/tracemunch b/contrib/ncurses/test/tracemunch new file mode 100755 index 0000000..d6761cd --- /dev/null +++ b/contrib/ncurses/test/tracemunch @@ -0,0 +1,98 @@ +#!/usr/bin/perl +# +# tracemunch -- compactify ncurses trace logs +# +# The error logs produced by ncurses with tracing enabled can be very tedious +# to wade through. This script helps by compacting runs of log lines that +# can be conveniently expressed as higher-level operations. +# +# ($Id: tracemunch,v 1.2 1995/10/06 15:02:37 esr Exp $) + +$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: { + # Transform window pointer addresses so it's easier to compare logs + $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 = ""; + } + + # Compactify runs of PutAttrChar calls (TR_CHARPUT) + 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; + } + + # Compactify runs of waddnstr calls (TR_CALLS) + 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; + } + + # More transformations can go here + + # Repeated runs of anything + $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 $_; + + } # :CLASSIFY +} + +# tracemunch ends here |