#!/usr/bin/perl require 'library.pl'; die unless @ARGV==4; ($primer,$zinput,$options,$output) = @ARGV; $output =~ s/^\-o// or die "$output ?"; die if $primer =~ m/^\-/; die if $zinput =~ m/^\-/; die unless $options =~ m/^\-([gTa])$/; $ztype= $1; $gnuplot= "$output.gnuplot.tmp"; $initdata= "$output.initdata.tmp"; open G, ">$gnuplot" or die $!; open Z, "$zinput" or die "$zinput $!"; sub pg ($$) { printf G "%s(u,v) = %s\n", @_ or die $!; } for (;;) { $!=0; defined($_= ) or die "$zinput $!"; s/\r$//; if ($ztype eq 'g') { print G or die $!; last if m/^END$/; } elsif ($ztype eq 'T') { next unless m/^splot\s+([^,]+),([^,]+),([^,]+)\s*$/; pg('x',$1); pg('y',$2); pg('z',$3); last; } } printf G "set print \"-\"\n" or die $!; close G or die $!; run("./$primer 'print ' '+-+' 'xyz' '( ' ', ' '); # ' ". "'print ' ', ' - >>$gnuplot"); run("gnuplot $gnuplot >$initdata"); make_initdata();