#!/usr/bin/perl
#-------------------------------------------------------------------------------
#Purpose     : generate star list from unknown entries in frame.type
#Author      : Robert Greimel (greimel@uvastro.phys.uvic.ca,greimel@ing.iac.es)
#Last Change : 11-Oct-1999
#-------------------------------------------------------------------------------

$frame_file = "frame.type";

if ($#ARGV == 0) {$dir=$ARGV[0];}
else             {$dir=".";}

if ( ! -e $dir."/".$frame_file )
  {die "file ".$dir."/".$frame_file." does not exist\n";}
open FRAME,$dir."/".$frame_file;

%full=();
$full{"alp"}="Alpha"; $full{"bet"}="Beta"; $full{"gam"}="Gamma";
$full{"del"}="Delta"; $full{"eps"}="Epsilon"; $full{"zet"}="Zeta";
$full{"the"}="Theta"; $full{"iot"}="Iota"; $full{"kap"}="Kappa";
$full{"lam"}="Lambda"; $full{"omi"}="Omikron"; $full{"sig"}="Sigma";
$full{"yps"}="Ypsilon"; $full{"ome"}="Omega";

while (<FRAME>)
  {
  next if ( ! m/unknown/ );
  @o=split;
  @a=split /'/;
  $fn=$a[1];
  $a[1] =~ tr/A-Z /a-z/d;
  @b=split " ",$fn;
  if ($#b > 0)
    {
    $b[0] =~ m/([0-9]*$)/;
    $b[0] =~ tr/A-Z0-9/a-z/d;
    if ( exists $full{$b[0]} ) {$b[0]=$full{$b[0]}.$1;$fn=join " ",@b;}
    }
  $s="\t\t";
  if ( (length $a[1]) > 7) {$s="\t";}
  print $a[1].$s.$o[-5]."\t".$o[-4]."\t".$fn."\n";
  }

close FRAME;

