#!/bin/csh -f
#
# do_plot - Messreihe plotten (eps)
#
# sth 10-nov-97
#
if (-f plots) then
  echo "'plots' exists and is NO directory - aborting"
  exit 1
endif
if ( ! -d plots) then
  mkdir plots
endif
set wd=$cwd
set tmpfile=/tmp/do_plots_$$
foreach i ($*)
  cd $wd
  echo "Plotting $i ..."			# ignore comment lines
  fgrep -v \# $i | awk -f make_plot_from_messreihe.awk > $tmpfile
  cd $wd/plots
  set line1=`fgrep "PLOT:# Measurements " $tmpfile`	# Bench-Namen etc holen
  set benchname=`echo "$line1" | cut -d' ' -f3 | cut -d',' -f1`
  set size=`echo "$line1" | cut -d' ' -f5 | cut -d',' -f1`
  set cpus=`echo "$line1" | cut -d' ' -f6`
  set basefile="$benchname"_"$size"_"$cpus"cpu
  set datafile="$basefile".data			# Herausgefilterte Datenzeilen
  set plotfile="$basefile".plot			#  und Plot-Befehle
  fgrep DATA: $tmpfile | cut -c6- > $datafile	# Referenzen "datafile" biegen
  fgrep PLOT: $tmpfile | sed -e "s/datafile/$datafile/g" | cut -c6- > $plotfile
  rm -f $tmpfile
  gnuplot < $plotfile
  ls -l "$basefile"*
  echo ""
end

