]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/tracemunch
ncurses 5.9 - patch 20131110
[ncurses.git] / test / tracemunch
index 451d17f3858c0a217b573334c9baa1e99785e7e6..1ea6f4b69022c11c019616dfa51956557d2c2c7a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 #!/usr/bin/perl -w
-# $Id: tracemunch,v 1.3 2002/09/22 16:31:18 tom Exp $
+# $Id: tracemunch,v 1.6 2005/03/12 21:48:23 tom Exp $
 ##############################################################################
 ##############################################################################
-# Copyright (c) 1998,2002 Free Software Foundation, Inc.                     #
+# Copyright (c) 1998-2002,2005 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"), #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
 # 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.
 # 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.
-#
+use strict;
 
 
-$putattr="PutAttrChar\\('(.)' = 0x.., {A_NORMAL}\\) at \\(([0-9]+), ([0-9]+)\\)";
-$waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}";
+our $putattr="PutAttrChar\\({{ '(.)' = 0[0-7]+ }}\\) at \\(([0-9]+), ([0-9]+)\\)";
+our $waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}";
 
 
-$win_nums=0;
+our $win_nums=0;
+our $curscr="";
+our $newscr="";
+our $stdscr="";
+our @win_addr;
 
 sub transaddr
 {
 
 sub transaddr
 {
-    $arg = $_[0];
+    my $n;
+    my $arg = $_[0];
 
 
-    $arg =~ s/$curscr/curscr/ if ($curscr);
-    $arg =~ s/$newscr/newscr/ if ($newscr);
-    $arg =~ s/$stdscr/stdscr/ if ($stdscr);
+    $arg =~ s/$curscr/curscr/g if ($curscr);
+    $arg =~ s/$newscr/newscr/g if ($newscr);
+    $arg =~ s/$stdscr/stdscr/g if ($stdscr);
     for $n (0..$#win_addr) {
     for $n (0..$#win_addr) {
-       $arg =~ s/$win_addr[$n]/window$n/ if $win_addr[$n];
+       $arg =~ s/$win_addr[$n]/window$n/g if $win_addr[$n];
     }
 
     return $arg;
     }
 
     return $arg;
@@ -55,6 +60,10 @@ sub transaddr
 
 while (<STDIN>)
 {
 
 while (<STDIN>)
 {
+       my $addr;
+       my $n;
+       my $awaiting;
+
 CLASSIFY: {
        # Transform window pointer addresses so it's easier to compare logs
        $awaiting = "curscr" if ($_ =~ /creating curscr/);
 CLASSIFY: {
        # Transform window pointer addresses so it's easier to compare logs
        $awaiting = "curscr" if ($_ =~ /creating curscr/);
@@ -75,6 +84,7 @@ CLASSIFY: {
            $awaiting = "";
        } elsif ($_ =~ /^\.\.\.deleted win=0x([0-9a-f]+)/) {
            $addr = "0x$1";
            $awaiting = "";
        } elsif ($_ =~ /^\.\.\.deleted win=0x([0-9a-f]+)/) {
            $addr = "0x$1";
+           $_ = &transaddr($_);
            if ($addr eq $curscr) {
                $curscr = "";
            } elsif ($addr eq $newscr) {
            if ($addr eq $curscr) {
                $curscr = "";
            } elsif ($addr eq $newscr) {
@@ -93,9 +103,9 @@ CLASSIFY: {
        # Compactify runs of PutAttrChar calls (TR_CHARPUT)
        if ($_ =~ /$putattr/)
        {
        # Compactify runs of PutAttrChar calls (TR_CHARPUT)
        if ($_ =~ /$putattr/)
        {
-               $putattr_chars = $1;
-               $starty = $2;
-               $startx = $3;
+               my $putattr_chars = $1;
+               my $starty = $2;
+               my $startx = $3;
                while (<STDIN>)
                {
                        if ($_ =~ /$putattr/) {
                while (<STDIN>)
                {
                        if ($_ =~ /$putattr/) {
@@ -111,8 +121,8 @@ CLASSIFY: {
        # Compactify runs of waddnstr calls (TR_CALLS)
        if ($_ =~ /$waddnstr/)
        {
        # Compactify runs of waddnstr calls (TR_CALLS)
        if ($_ =~ /$waddnstr/)
        {
-               $waddnstr_chars = $2;
-               $winaddr = $1;
+               my $waddnstr_chars = $2;
+               my $winaddr = $1;
                while (<STDIN>)
                {
                        if ($_ =~ /$waddnstr/ && $1 eq $winaddr) {
                while (<STDIN>)
                {
                        if ($_ =~ /$waddnstr/ && $1 eq $winaddr) {
@@ -121,7 +131,7 @@ CLASSIFY: {
                                last;
                        }
                }
                                last;
                        }
                }
-               $winaddstr = &transaddr($winaddr);
+               my $winaddstr = &transaddr($winaddr);
                print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n";
                redo CLASSIFY;
        }
                print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n";
                redo CLASSIFY;
        }
@@ -129,8 +139,8 @@ CLASSIFY: {
        # More transformations can go here
 
        # Repeated runs of anything
        # More transformations can go here
 
        # Repeated runs of anything
-       $anyline = &transaddr($_);
-       $repeatcount = 1;
+       my $anyline = &transaddr($_);
+       my $repeatcount = 1;
        while (<STDIN>) {
            if (&transaddr($_) eq $anyline) {
                $repeatcount++;
        while (<STDIN>) {
            if (&transaddr($_) eq $anyline) {
                $repeatcount++;