using ' instead of " for most of the strings that don't require interpolation

This commit is contained in:
Dima Kogan 2010-10-23 15:42:08 -07:00
parent 8135ab0a2d
commit 4dfb086e96

View File

@ -9,7 +9,7 @@ use threads::shared;
use Thread::Queue; use Thread::Queue;
use Text::ParseWords; use Text::ParseWords;
open(GNUPLOT_VERSION, "gnuplot --version |"); open(GNUPLOT_VERSION, 'gnuplot --version |');
my ($gnuplotVersion) = <GNUPLOT_VERSION> =~ /gnuplot\s*(\d*\.\d*)/; my ($gnuplotVersion) = <GNUPLOT_VERSION> =~ /gnuplot\s*(\d*\.\d*)/;
if(!$gnuplotVersion) if(!$gnuplotVersion)
{ {
@ -129,49 +129,49 @@ if(exists $ARGV[0] && !-r $ARGV[0])
# do not stream in the data by default # do not stream in the data by default
# point plotting by default. # point plotting by default.
# no monotonicity checks by default # no monotonicity checks by default
my %options = ( "stream" => 0, my %options = ( stream => 0,
"domain" => 0, domain => 0,
"dataid" => 0, dataid => 0,
"points" => 0, points => 0,
"lines" => 0, lines => 0,
"xlen" => 0, xlen => 0,
"maxcurves" => 100); maxcurves => 100);
GetOptions(\%options, GetOptions(\%options,
"stream!", 'stream!',
"domain!", 'domain!',
"dataid!", 'dataid!',
"lines!", 'lines!',
"points!", 'points!',
"legend=s@", 'legend=s@',
"xlabel=s", 'xlabel=s',
"ylabel=s", 'ylabel=s',
"y2label=s", 'y2label=s',
"title=s", 'title=s',
"xlen=f", 'xlen=f',
"ymin=f", 'ymin=f',
"ymax=f", 'ymax=f',
"xmin=f", 'xmin=f',
"xmax=f", 'xmax=f',
"y2min=f", 'y2min=f',
"y2max=f", 'y2max=f',
"y2=s@", 'y2=s@',
"curvestyle=s@", 'curvestyle=s@',
"extracmds=s@", 'extracmds=s@',
"size=s", 'size=s',
"square!", 'square!',
"hardcopy=s", 'hardcopy=s',
"maxcurves=i", 'maxcurves=i',
"monotonic!", 'monotonic!',
"help", 'help',
"dump") or die($usage); 'dump') or die($usage);
# set up plotting style # set up plotting style
my $style = ""; my $style = '';
if($options{lines}) { $style .= "lines";} if($options{lines}) { $style .= 'lines';}
if($options{points}) { $style .= "points";} if($options{points}) { $style .= 'points';}
if(!$style) { $style = "points"; } if(!$style) { $style = 'points'; }
if( defined $options{help} ) if( defined $options{help} )
{ {
@ -180,7 +180,7 @@ if( defined $options{help} )
# list containing the plot data. Each element is a reference to a list, representing the data for # list containing the plot data. Each element is a reference to a list, representing the data for
# one curve. The first "point" is a hash describing various curve parameters. The rest are all # one curve. The first 'point' is a hash describing various curve parameters. The rest are all
# references to lists of (x,y) tuples # references to lists of (x,y) tuples
my @curves = (); my @curves = ();
@ -234,7 +234,7 @@ sub plotThread
while(! $streamingFinished) while(! $streamingFinished)
{ {
sleep(1); sleep(1);
$dataQueue->enqueue("Plot now"); $dataQueue->enqueue('Plot now');
} }
$dataQueue->enqueue(undef); $dataQueue->enqueue(undef);
@ -243,11 +243,11 @@ sub plotThread
sub mainThread { sub mainThread {
local *PIPE; local *PIPE;
my $dopersist = ""; my $dopersist = '';
if($gnuplotVersion >= 4.3) if($gnuplotVersion >= 4.3)
{ {
$dopersist = "--persist" if(!$options{stream}); $dopersist = '--persist' if(!$options{stream});
} }
if(exists $options{dump}) if(exists $options{dump})
@ -283,12 +283,12 @@ sub mainThread {
# If a bound isn't given I want to set it to the empty string, so I can communicate it simply to # If a bound isn't given I want to set it to the empty string, so I can communicate it simply to
# gnuplot # gnuplot
$options{xmin} = "" unless defined $options{xmin}; $options{xmin} = '' unless defined $options{xmin};
$options{xmax} = "" unless defined $options{xmax}; $options{xmax} = '' unless defined $options{xmax};
$options{ymin} = "" unless defined $options{ymin}; $options{ymin} = '' unless defined $options{ymin};
$options{ymax} = "" unless defined $options{ymax}; $options{ymax} = '' unless defined $options{ymax};
$options{y2min} = "" unless defined $options{y2min}; $options{y2min} = '' unless defined $options{y2min};
$options{y2max} = "" unless defined $options{y2max}; $options{y2max} = '' unless defined $options{y2max};
print PIPE "set xtics\n"; print PIPE "set xtics\n";
if($options{y2}) if($options{y2})
@ -313,7 +313,7 @@ sub mainThread {
if($options{square}) if($options{square})
{ {
$options{size} = '' unless defined $options{size}; $options{size} = '' unless defined $options{size};
$options{size} .= " ratio -1"; $options{size} .= ' ratio -1';
} }
print(PIPE "set size $options{size}\n") if defined $options{size}; print(PIPE "set size $options{size}\n") if defined $options{size};
@ -362,7 +362,7 @@ sub mainThread {
{ {
next if /^#/o; next if /^#/o;
if($_ ne "Plot now") if($_ ne 'Plot now')
{ {
# parse the incoming data lines. The format is # parse the incoming data lines. The format is
# x id0 dat0 id1 dat1 .... # x id0 dat0 id1 dat1 ....
@ -502,10 +502,10 @@ sub plotStoredData
sub updateCurveOptions sub updateCurveOptions
{ {
# generates the "options" string for a curve, based on its legend title and its other options # generates the 'options' string for a curve, based on its legend title and its other options
# These could be integrated into a single string, but that raises an issue in the no-title # These could be integrated into a single string, but that raises an issue in the no-title
# case. When no title is specified, gnuplot will still add a legend entry with an unhelpful '-' # case. When no title is specified, gnuplot will still add a legend entry with an unhelpful '-'
# label. Thus I explicitly do "notitle" for that case # label. Thus I explicitly do 'notitle' for that case
my ($curveoptions) = @_; my ($curveoptions) = @_;
my $titleoption = defined $curveoptions->{title} ? my $titleoption = defined $curveoptions->{title} ?