]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/tracemunch
ncurses 5.3
[ncurses.git] / test / tracemunch
index d6761cd0421940ffc9cb1d16938f5c67f6929ea0..451d17f3858c0a217b573334c9baa1e99785e7e6 100755 (executable)
@@ -1,16 +1,44 @@
-#!/usr/bin/perl
-#
+#!/usr/bin/perl -w
+# $Id: tracemunch,v 1.3 2002/09/22 16:31:18 tom Exp $
+##############################################################################
+# Copyright (c) 1998,2002 Free Software Foundation, Inc.                     #
+#                                                                            #
+# Permission is hereby granted, free of charge, to any person obtaining a    #
+# copy of this software and associated documentation files (the "Software"), #
+# to deal in the Software without restriction, including without limitation  #
+# the rights to use, copy, modify, merge, publish, distribute, distribute    #
+# with modifications, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to the  #
+# following conditions:                                                      #
+#                                                                            #
+# The above copyright notice and this permission notice shall be included in #
+# all copies or substantial portions of the Software.                        #
+#                                                                            #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
+# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
+# DEALINGS IN THE SOFTWARE.                                                  #
+#                                                                            #
+# Except as contained in this notice, the name(s) of the above copyright     #
+# holders shall not be used in advertising or otherwise to promote the sale, #
+# use or other dealings in this Software without prior written               #
+# authorization.                                                             #
+##############################################################################
 # 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.
 #
 # 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}";
 
 
 $putattr="PutAttrChar\\('(.)' = 0x.., {A_NORMAL}\\) at \\(([0-9]+), ([0-9]+)\\)";
 $waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}";
 
+$win_nums=0;
+
 sub transaddr
 {
     $arg = $_[0];
 sub transaddr
 {
     $arg = $_[0];
@@ -18,6 +46,9 @@ sub transaddr
     $arg =~ s/$curscr/curscr/ if ($curscr);
     $arg =~ s/$newscr/newscr/ if ($newscr);
     $arg =~ s/$stdscr/stdscr/ if ($stdscr);
     $arg =~ s/$curscr/curscr/ if ($curscr);
     $arg =~ s/$newscr/newscr/ if ($newscr);
     $arg =~ s/$stdscr/stdscr/ if ($stdscr);
+    for $n (0..$#win_addr) {
+       $arg =~ s/$win_addr[$n]/window$n/ if $win_addr[$n];
+    }
 
     return $arg;
 }
 
     return $arg;
 }
@@ -26,15 +57,37 @@ while (<STDIN>)
 {
 CLASSIFY: {
        # Transform window pointer addresses so it's easier to compare logs
 {
 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 = "curscr" if ($_ =~ /creating curscr/);
+       $awaiting = "newscr" if ($_ =~ /creating newscr/);
+       $awaiting = "stdscr" if ($_ =~ /creating stdscr/);
+       if ($_ =~ /^create :window 0x([0-9a-f]+)/) {
+           $addr = "0x$1";
+           if ($awaiting eq "curscr") {
+               $curscr = $addr;
+           } elsif ($awaiting eq "newscr") {
+               $newscr = $addr;
+           } elsif ($awaiting eq "stdscr") {
+               $stdscr = $addr;
+           } else {
+               $win_addr[$win_nums] = $addr;
+               $win_nums = $win_nums + 1;
+           }
            $awaiting = "";
            $awaiting = "";
+       } elsif ($_ =~ /^\.\.\.deleted win=0x([0-9a-f]+)/) {
+           $addr = "0x$1";
+           if ($addr eq $curscr) {
+               $curscr = "";
+           } elsif ($addr eq $newscr) {
+               $newscr = "";
+           } elsif ($addr eq $stdscr) {
+               $stdscr = "";
+           } else {
+               for $n (0..$#win_addr) {
+                   if ($win_addr[$n] eq $addr) {
+                       $win_addr[$n] = "";
+                   }
+               }
+           }
        }
 
        # Compactify runs of PutAttrChar calls (TR_CHARPUT)
        }
 
        # Compactify runs of PutAttrChar calls (TR_CHARPUT)