mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-06 06:21:16 +08:00
Allow to specify a limit on the number of curves.
This commit is contained in:
parent
c6ee73f97f
commit
5e44f777fb
@ -85,6 +85,11 @@ As an example, if line 3 of the input is "0 9 1 20"
|
|||||||
--hardcopy xxx If not streaming, output to a file specified here. Format
|
--hardcopy xxx If not streaming, output to a file specified here. Format
|
||||||
inferred from filename
|
inferred from filename
|
||||||
|
|
||||||
|
--maxcurves xxx The maximum allowed number of curves. This is 10 by default,
|
||||||
|
but can be reset with this option. This exists purely to
|
||||||
|
prevent perl from allocating all of the system's memory when
|
||||||
|
reading bogus data
|
||||||
|
|
||||||
--dump Instead of printing to gnuplot, print to STDOUT. For
|
--dump Instead of printing to gnuplot, print to STDOUT. For
|
||||||
debugging.
|
debugging.
|
||||||
OEF
|
OEF
|
||||||
@ -99,7 +104,9 @@ my %options = ( "stream" => 0,
|
|||||||
"ymin" => "",
|
"ymin" => "",
|
||||||
"ymax" => "",
|
"ymax" => "",
|
||||||
"y2min" => "",
|
"y2min" => "",
|
||||||
"y2max" => "");
|
"y2max" => "",
|
||||||
|
"maxcurves" => 10);
|
||||||
|
|
||||||
GetOptions(\%options,
|
GetOptions(\%options,
|
||||||
"stream!",
|
"stream!",
|
||||||
"domain!",
|
"domain!",
|
||||||
@ -120,6 +127,7 @@ GetOptions(\%options,
|
|||||||
"y2max=f",
|
"y2max=f",
|
||||||
"y2=i@",
|
"y2=i@",
|
||||||
"hardcopy=s",
|
"hardcopy=s",
|
||||||
|
"maxcurves=i",
|
||||||
"help",
|
"help",
|
||||||
"dump") or die($usage);
|
"dump") or die($usage);
|
||||||
|
|
||||||
@ -413,6 +421,13 @@ sub newCurve()
|
|||||||
{
|
{
|
||||||
my ($title, $opts, $newpoint, $idx) = @_;
|
my ($title, $opts, $newpoint, $idx) = @_;
|
||||||
|
|
||||||
|
if(scalar @curves >= $options{maxcurves})
|
||||||
|
{
|
||||||
|
say STDERR "Tried to exceed the --maxcurves setting.";
|
||||||
|
say STDERR "Invoke with a higher --maxcurves limit if you really want to do this.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
# if this curve index doesn't exist, create curve up-to this index
|
# if this curve index doesn't exist, create curve up-to this index
|
||||||
if(defined $idx)
|
if(defined $idx)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user