usage is now at the front, not at the end of the file

Ignore-this: 86899869bed3fd0c62b04f86f2ee7943

darcs-hash:20091206204850-0cb85-8fd04b4dce799512f1b6f0223e063846fdc4e6c8.gz
This commit is contained in:
Dima Kogan 2009-12-06 12:48:50 -08:00
parent 772f07d3c7
commit d6e1dc5643

View File

@ -15,6 +15,26 @@ autoflush STDOUT 1;
# options
my @curves = ();
my $usage = <<OEF;
Usage: $0 <options>
--[no]stream Do [not] display the data a point at a time, as it comes in
--[no]lines Do [not] draw lines to connect consecutive points
--xlabel xxx Set x-axis label
--ylabel xxx Set y-axis label
--y2label xxx Set y2-axis label
--title xxx Set the title of the plot
--legend xxx Set the label for a curve plot. Give this option multiple times for multiple curves
--xlen xxx Set the size of the x-window to plot
--xmin xxx Set the range for the x axis. These are ignored in a streaming plot
--xmax xxx Set the range for the x axis. These are ignored in a streaming plot
--ymin xxx Set the range for the y axis.
--ymax xxx Set the range for the y axis.
--y2min xxx Set the range for the y2 axis.
--y2max xxx Set the range for the y2 axis.
--y2 xxx Plot the data with this index on the y2 axis. These are 0-indexed
--hardcopy xxx If not streaming, output to a file specified here. Format inferred from filename
OEF
# stream in the data by default
# point plotting by default
my %options = ( "stream" => 1,
@ -43,7 +63,7 @@ GetOptions(\%options,
"y2=i@",
"hardcopy=s",
"help",
"dump");
"dump") or die($usage);
# set up plotting style
my $style = "";
@ -54,8 +74,7 @@ if(!$style) { $style = "points"; }
if( defined $options{"help"} )
{
usage();
return;
die($usage);
}
# now start the data acquisition and plotting threads
@ -70,8 +89,7 @@ if($options{"stream"})
}
if( !defined $options{"xlen"} )
{
usage();
die("Must specify the size of the moving x-window. Doing nothing\n");
die("$usage\nMust specify the size of the moving x-window. Doing nothing\n");
}
$xwindow = $options{"xlen"};
@ -338,27 +356,3 @@ sub pushNewEmptyCurve
my $opts = "notitle ";
push @curves, [" $opts"];
}
sub usage {
print "Usage: $0 <options>\n";
print <<OEF;
--[no]stream Do [not] display the data a point at a time, as it comes in
--[no]lines Do [not] draw lines to connect consecutive points
--xlabel xxx Set x-axis label
--ylabel xxx Set y-axis label
--y2label xxx Set y2-axis label
--title xxx Set the title of the plot
--legend xxx Set the label for a curve plot. Give this option multiple times for multiple curves
--xlen xxx Set the size of the x-window to plot
--xmin xxx Set the range for the x axis. These are ignored in a streaming plot
--xmax xxx Set the range for the x axis. These are ignored in a streaming plot
--ymin xxx Set the range for the y axis.
--ymax xxx Set the range for the y axis.
--y2min xxx Set the range for the y2 axis.
--y2max xxx Set the range for the y2 axis.
--y2 xxx Plot the data with this index on the y2 axis. These are 0-indexed
--hardcopy xxx If not streaming, output to a file specified here. Format inferred from filename
OEF
}