#!/usr/bin/perl 

## create the gif files seperate from the tth running for speed

@ps_files = <*.ps>;
#@ps_files = ('dt-1.ps');
$CONVERT = '/usr/bin/convert';
$IMAGE_COMMAND = "$CONVERT -geometry 250x200+0+0";
$debug = 0;
foreach (@ps_files) {
  next if /tutorial/;
  /(.*)\.ps$/;			# $1 is basename
  $giffile = "$1.gif";
  $psfile =  "$1.ps";
  @gif = stat $giffile;
  @ps = stat $psfile;
  if ($gif[9] > $ps[9]) {
    print "$giffile is newer" if $debug;
    next;
  }
  print "convert $psfile to $giffile\n" if $debug;
  $ret = system ("$IMAGE_COMMAND $1.ps $1.gif");
  print "trouble with $_\n" if $ret;
}
