chiark / gitweb /
readahead to cope with plusses; no y2tics if unneeded
authorianmdlvl <ianmdlvl>
Wed, 24 Mar 2004 01:00:50 +0000 (01:00 +0000)
committerianmdlvl <ianmdlvl>
Wed, 24 Mar 2004 01:00:50 +0000 (01:00 +0000)
scripts/gnucap2gnuplot

index 9d909ca670013ff7512cdb21f516f542c25bf39e..7e97b498b008ca27915e2d962bb5ea247fd0eece 100755 (executable)
@@ -105,7 +105,6 @@ sub startplot () {
     open S, "> $ofb,$cplot.gnuplot-cmd" or die $!;
     print S <<END
 set data style linespoints
     open S, "> $ofb,$cplot.gnuplot-cmd" or die $!;
     print S <<END
 set data style linespoints
-set y2tics autofreq
 set title '$cplot'
 END
         or die $!;
 set title '$cplot'
 END
         or die $!;
@@ -120,7 +119,7 @@ END
            die unless $columns[$yn] =~ m/.*([MP])\(\d+\)$/;
            $mmm[$yn]= 'y2' if $1 eq 'P';
        }
            die unless $columns[$yn] =~ m/.*([MP])\(\d+\)$/;
            $mmm[$yn]= 'y2' if $1 eq 'P';
        }
-       print S "set logscale xy\n" or die $!;
+       print S "set logscale xy\nset y2tics autofreq\n" or die $!;
     }
     for ($yn=1; $yn<=$#columns; $yn++) {
        open "O$yn", "> $ofb,$cplot-$yn.gnuplot-data" or die $!;
     }
     for ($yn=1; $yn<=$#columns; $yn++) {
        open "O$yn", "> $ofb,$cplot-$yn.gnuplot-data" or die $!;
@@ -149,8 +148,20 @@ sub endplot () {
     $kind= undef;
 }
 
     $kind= undef;
 }
 
-while (<STDIN>) {
+$readahead= <STDIN>;
+for (;;) {
+    $linesofar= $readahead;
+    for (;;) {
+       $readahead= <STDIN>;
+       last unless $readahead =~ s/^\+//;
+       die unless length $linesofar;
+       $linesofar =~ s/\n$//;
+       $linesofar .= $readahead;
+    }
+    $_= $linesofar;
+    last unless length;
     s/\s+$//;
     s/\s+$//;
+    
     if (m/^\#(\w+)/) {
        endplot();
        $kind= $1;
     if (m/^\#(\w+)/) {
        endplot();
        $kind= $1;
@@ -196,4 +207,4 @@ $?=0; close STDIN; $? and fail("gnucap failed (code $?)");
 $sof= "./$sof" unless $sof =~ m,/,;
 print ": generated ; $sof\n" or die $!;
 
 $sof= "./$sof" unless $sof =~ m,/,;
 print ": generated ; $sof\n" or die $!;
 
-# $Id: gnucap2gnuplot,v 1.2 2004-03-23 23:03:06 ianmdlvl Exp $
+# $Id: gnucap2gnuplot,v 1.3 2004-03-24 01:00:50 ianmdlvl Exp $