[padb-devel] [padb commit] r75 - Add a output-mode paramater to push_command() and pass
codesite-noreply at google.com
codesite-noreply at google.com
Mon Jun 29 15:03:31 BST 2009
Author: apittman
Date: Mon Jun 29 06:43:42 2009
New Revision: 75
Modified:
branches/full-duplex/src/padb
Log:
Add a output-mode paramater to push_command() and pass
this value back to default_output_handler. Provide a
sensible value both when running in a mode but also do
the right thing wrt the full-report mode.
Modified: branches/full-duplex/src/padb
==============================================================================
--- branches/full-duplex/src/padb (original)
+++ branches/full-duplex/src/padb Mon Jun 29 06:43:42 2009
@@ -2931,11 +2931,15 @@
}
sub default_output_handler {
- my ( $mode, $d ) = @_;
+ my ( $req, $d ) = @_;
# Could warn on missing output here...
- my $lines = $d->{target_output};
+ my $lines = $d->{target_output};
+ my $mode = $req->{mode};
+ my $output = "raw";
+
+ $output = $req->{out_format} if defined $req->{out_format};
if ( $mode eq "stack" or $input_file ) {
if ( $strip_below_main or $strip_above_wait ) {
@@ -2943,11 +2947,11 @@
}
}
- if ($tree) {
+ if ( $output eq "tree" ) {
print show_tree go_p( 0, $lines,
( sort { $a <=> $b } ( keys %$lines ) ) );
- } elsif ($compress) {
+ } elsif ( $output eq "compress" ) {
foreach my $tag ( sort { $a <=> $b } ( keys %$lines ) ) {
next if ( !defined( $lines->{$tag} ) );
@@ -2966,7 +2970,7 @@
print("$data\n");
}
}
- } elsif ($compress_C) {
+ } elsif ( $output eq "compress_c" ) {
foreach my $tag ( sort { $a <=> $b } ( keys %$lines ) ) {
print("----------------\n");
print("$tag\n");
@@ -3173,13 +3177,14 @@
# Push a command onto the list of commands to be executed.
sub push_command {
- my ( $mode, $args ) = @_;
+ my ( $mode, $out_format, $args ) = @_;
# $args = $conf{mode_options}{$mode};
my %cmd;
- $cmd{mode} = $mode;
- $cmd{args} = $args if defined($args);
+ $cmd{mode} = $mode;
+ $cmd{out_format} = $out_format if defined($out_format);
+ $cmd{args} = $args if defined($args);
push @commands, \%cmd;
}
@@ -3207,6 +3212,10 @@
$req->{cargs} = $cmd->{args};
}
+ if ( defined $cmd->{out_format} ) {
+ $req->{out_format} = $cmd->{out_format};
+ }
+
# Send along the secondary args.
if ( defined $allfns{ $req->{mode} }{secondary} ) {
foreach my $sec ( @{ $allfns{ $req->{mode} }{secondary} } ) {
@@ -3271,7 +3280,7 @@
if ( defined( $allfns{$mode}{out_handler} ) ) {
$allfns{$mode}{out_handler}( $conf{mode_options}{$mode}, $d );
} else {
- default_output_handler( $mode, $d );
+ default_output_handler( $comm_data->{current_req}, $d );
}
$comm_data->{current_req} = $req;
@@ -3831,29 +3840,17 @@
# exit 1;
#}
- push_command("queue");
+ push_command( "queue", "compress" );
my %c;
$c{"strip-above-wait"} = 0;
- push_command( "stack", \%c );
- go_job($full_report);
- exit(0);
-
- printf("\n");
-
- $compress = 1;
-
- go_job($full_report);
- undef $compress;
-
- printf("\n");
+ push_command( "stack", "tree", \%c );
+ # This option is still a global rather than being just a mode
option.
$strip_above_wait = 0;
- $tree = 1;
- go_job($full_report);
- undef $tree;
- exit 0;
+ go_job($full_report);
+ exit(0);
}
if ($show_jobs) {
@@ -3977,7 +3974,11 @@
$allfns{$mode}{pre_out_handler}();
}
- push_command( $mode, $conf{mode_options}{$mode} );
+ my $of;
+ $of = "tree" if $tree;
+ $of = "compress" if $compress;
+ $of = "compress_c" if $compress_C;
+ push_command( $mode, $of, $conf{mode_options}{$mode} );
go_job($jobid);
}
}
More information about the padb-devel
mailing list