[feedgnuplot] 01/07: getRangeSize() function added to ocnsolidate that logic

Dima Kogan dima at secretsauce.net
Sat Feb 25 08:04:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkogan pushed a commit to branch debian
in repository feedgnuplot.

commit a48b8345128afd5d583ea9bda29b2edb2915bf5c
Author: Dima Kogan <dima at secretsauce.net>
Date:   Thu Feb 9 12:20:57 2017 -0800

    getRangeSize() function added to ocnsolidate that logic
---
 bin/feedgnuplot | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/bin/feedgnuplot b/bin/feedgnuplot
index ce3965a..c996d48 100755
--- a/bin/feedgnuplot
+++ b/bin/feedgnuplot
@@ -57,6 +57,17 @@ mainThread();
 
 
 
+sub getRangeSize
+{
+    my ($id) = @_;
+
+    # I'd like to use //, but I guess some people are still on perl 5.8
+    return
+      exists $options{rangesize_hash}{$id} ?
+      $options{rangesize_hash}{$id} :
+      $options{rangesize_default};
+}
+
 sub interpretCommandline
 {
   # if I'm using a self-plotting data file with a #! line, then $ARGV[0] will contain ALL of the
@@ -222,7 +233,10 @@ sub interpretCommandline
 
 
   # I now set up the rangesize to always be
-  #  $options{rangesize_hash}{$id} // $options{rangesize_default}
+  #
+  #   $options{rangesize_hash}{$id} // $options{rangesize_default}
+  #
+  # which is available as getRangeSize($id)
   if ( $options{rangesizeall} )
   {
       $options{rangesize_default} = $options{rangesizeall};
@@ -749,20 +763,10 @@ sub mainThread
 
       while(@fields)
       {
-          if($options{dataid})
-          {
-              $id = shift @fields;
-          }
-          else
-          {
-              $id++;
-          }
-
-          # I'd like to use //, but I guess some people are still on perl 5.8
-          my $rangesize = exists $options{rangesize_hash}{$id} ?
-            $options{rangesize_hash}{$id} :
-            $options{rangesize_default};
+          if($options{dataid}) { $id = shift @fields; }
+          else                 { $id++;               }
 
+          my $rangesize = getRangeSize($id);
           last if @fields < $rangesize;
 
           pushPoint(getCurve($id),
@@ -886,12 +890,7 @@ sub updateCurveOptions
       # as 1 + rangesize). I also need to start the range at the first column
       # past the timefmt
 
-      # I'd like to use //, but I guess some people are still on perl 5.8
-      my $rangesize = exists $options{rangesize_hash}{$id} ?
-        $options{rangesize_hash}{$id} :
-        $options{rangesize_default};
-
-      my @rest = map {$_ + $options{timefmt_Ncols}} (1..$rangesize);
+      my @rest = map {$_ + $options{timefmt_Ncols}} (1..getRangeSize($id));
 
       $usingoptions = "using 1:" . join(':', @rest);
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/feedgnuplot.git



More information about the debian-science-commits mailing list