mirror of
https://github.com/dkogan/feedgnuplot.git
synced 2025-05-05 22:11:12 +08:00
Merge branch 'master' into debian
This commit is contained in:
commit
7c704dc251
7
Changes
7
Changes
@ -1,3 +1,10 @@
|
||||
feedgnuplot (1.42) unstable; urgency=medium
|
||||
|
||||
* Data can now come from STDIN or files on the cmdline.
|
||||
This fixes a regression. Self-plotting data files work again
|
||||
|
||||
-- Dima Kogan <dima@secretsauce.net> Fri, 31 Mar 2017 15:38:47 -0700
|
||||
|
||||
feedgnuplot (1.41)
|
||||
|
||||
* Histograms: --xlen can coexist with --xmin/--xmax
|
||||
|
103
bin/feedgnuplot
103
bin/feedgnuplot
@ -15,7 +15,7 @@ use Text::ParseWords; # for shellwords
|
||||
use Pod::Usage;
|
||||
use Time::Piece;
|
||||
|
||||
my $VERSION = 1.41;
|
||||
my $VERSION = 1.42;
|
||||
|
||||
my %options;
|
||||
interpretCommandline();
|
||||
@ -41,17 +41,10 @@ my $last_replot_time = [gettimeofday];
|
||||
|
||||
# whether the previous replot was timer based
|
||||
my $last_replot_is_from_timer = 1;
|
||||
|
||||
|
||||
my $prev_timed_replot_time = [gettimeofday];
|
||||
my $this_replot_is_from_timer;
|
||||
my $stdin = IO::Handle->new();
|
||||
die "Couldn't open STDIN" unless $stdin->fdopen(fileno(STDIN),"r");
|
||||
my $selector = IO::Select->new( $stdin );
|
||||
|
||||
|
||||
|
||||
mainThread();
|
||||
|
||||
|
||||
|
||||
@ -122,7 +115,6 @@ sub interpretCommandline
|
||||
'help', 'dump', 'exit', 'version',
|
||||
'geometry=s') or exit 1;
|
||||
|
||||
|
||||
# handle various cmdline-option errors
|
||||
if ( $options{help} )
|
||||
{
|
||||
@ -479,16 +471,66 @@ sub makeDomainNumeric
|
||||
}
|
||||
|
||||
|
||||
my $prev_timed_replot_time = [gettimeofday];
|
||||
my $pipe_in;
|
||||
my $selector;
|
||||
my $line_number = 0;
|
||||
my $is_stdin = !@ARGV; # read stdin only if no data files given on the cmdline
|
||||
sub openNextFile
|
||||
{
|
||||
my $fd;
|
||||
if($is_stdin)
|
||||
{
|
||||
$fd = IO::Handle->new();
|
||||
$fd->fdopen(fileno(STDIN), "r") or die "Couldn't open STDIN";
|
||||
}
|
||||
else
|
||||
{
|
||||
my $filename = shift @ARGV;
|
||||
$fd = IO::File->new($filename, "r") or die "Couldn't open file '$filename'";
|
||||
}
|
||||
|
||||
my $selector = IO::Select->new( $fd );
|
||||
return ($fd, $selector);
|
||||
}
|
||||
sub getNextLine
|
||||
{
|
||||
sub getline_internal
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
my $line = $pipe_in->getline();
|
||||
if( !$is_stdin && !defined $line && $pipe_in->eof() && @ARGV)
|
||||
{
|
||||
# I got to the end of one file, so open the next one (which I'm
|
||||
# sure exists)
|
||||
($pipe_in, $selector) = openNextFile();
|
||||
next;
|
||||
}
|
||||
return $line;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if( !defined $pipe_in )
|
||||
{
|
||||
($pipe_in, $selector) = openNextFile();
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
$this_replot_is_from_timer = undef;
|
||||
|
||||
# if we're not streaming, or we're doing triggered-only replotting, simply
|
||||
# do a blocking read
|
||||
return $stdin->getline()
|
||||
if (! $options{stream} || $options{stream} < 0);
|
||||
if (! $options{stream} || $options{stream} < 0)
|
||||
{
|
||||
$line_number++;
|
||||
return getline_internal();
|
||||
}
|
||||
|
||||
|
||||
my $now = [gettimeofday];
|
||||
@ -503,7 +545,8 @@ sub getNextLine
|
||||
|
||||
if ($selector->can_read($time_remaining))
|
||||
{
|
||||
return $stdin->getline();
|
||||
$line_number++;
|
||||
return getline_internal();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -773,7 +816,7 @@ sub mainThread
|
||||
}
|
||||
else
|
||||
{
|
||||
$domain[0] = $.;
|
||||
$domain[0] = $line_number;
|
||||
$domain0_numeric = makeDomainNumeric( $domain[0] );
|
||||
}
|
||||
|
||||
@ -1082,6 +1125,9 @@ sub pushPoint
|
||||
}
|
||||
|
||||
|
||||
mainThread();
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
feedgnuplot - General purpose pipe-oriented plotting tool
|
||||
@ -1801,16 +1847,15 @@ is possible to send the output produced this way to gnuplot directly.
|
||||
|
||||
C<--exit>
|
||||
|
||||
This controls the details of what happens when the input data is exhausted, or
|
||||
when some part of the C<feedgnuplot> pipeline is killed. This option does
|
||||
different things depending on whether C<--stream> is active, so read this
|
||||
closely.
|
||||
This controls what happens when the input data is exhausted, or when some part
|
||||
of the C<feedgnuplot> pipeline is killed. This option does different things
|
||||
depending on whether C<--stream> is active, so read this closely.
|
||||
|
||||
With interactive gnuplot terminals (qt, x11, wxt), the plot windows live in a
|
||||
separate process from the main C<gnuplot> process. It is thus possible for the
|
||||
main C<gnuplot> process to exit, while leaving the plot windows up (a caveat is
|
||||
that such decapitated windows aren't interactive). To be clear, there are 3
|
||||
possible states:
|
||||
that such decapitated windows aren't interactive). There are 3 possible states
|
||||
of the polotting pipeline:
|
||||
|
||||
=over
|
||||
|
||||
@ -1825,35 +1870,35 @@ prompt available
|
||||
|
||||
=back
|
||||
|
||||
The C<--exit> option controls the details of this behavior. The possibilities
|
||||
are:
|
||||
The possibilities are:
|
||||
|
||||
=over
|
||||
|
||||
=item No C<--stream>, input pipe is exhausted (all data read in)
|
||||
=item No C<--stream>, all data read in
|
||||
|
||||
=over
|
||||
|
||||
=item default; no C<--exit>
|
||||
=item no C<--exit> (default)
|
||||
|
||||
Alive. Need to Ctrl-C to get back into the shell
|
||||
|
||||
=item C<--exit>
|
||||
|
||||
Half-alive. Non-interactive prompt up, and the shell accepts new commands.
|
||||
Without C<--stream> the goal is to show a plot, so a Dead state is not useful
|
||||
here.
|
||||
Without C<--stream> the goal is to show a plot, so a Dead state would not be
|
||||
useful.
|
||||
|
||||
=back
|
||||
|
||||
=item C<--stream>, input pipe is exhausted (all data read in) or the
|
||||
C<feedgnuplot> process terminated
|
||||
=item C<--stream>, all data read in or the C<feedgnuplot> process terminated
|
||||
|
||||
=over
|
||||
|
||||
=item default; no C<--exit>
|
||||
=item no C<--exit> (default)
|
||||
|
||||
Alive. Need to Ctrl-C to get back into the shell
|
||||
Alive. Need to Ctrl-C to get back into the shell. This means that when making
|
||||
live plots, the first Ctrl-C kills the data feeding process, but leaves the
|
||||
final plot up for inspection. A second Ctrl-C kills feedgnuplot as well.
|
||||
|
||||
=item C<--exit>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user