#!/bin/sh
#
# This script is no longer necessary. -Matthias
#
#!/usr/bin/perl
#  
# This script is used to update the CM proxies so that the export lists
# are consistent with the cm files in MLRISC. 
#
# -- Allen (leunga@cs.nyu.edu)
#

echo Running $0 is no longer necessary.

cat >/dev/null <<\stop
foreach $filename (@ARGV)
{  process($filename); 
}

sub process
{  my($filename) = @_;
   my($infile) = "../../../MLRISC/cm/$filename";
   open(CM,$infile) || die ("$!: $infile\n");
   my(@exports) = ();
   while (<CM>)
   {  push @exports, $_ if (/structure (.*)/);
      push @exports, $_ if (/functor (.*)/);
      push @exports, $_ if (/signature (.*)/);
   }
   close(CM);
   my($outfile) = "$filename";

   open(CM,">$outfile") || die("$!: $outfile\n");
   print CM <<"END";
(* This file is generated by running 'perl makeproxies $filename' *)

(*
 * This is library \$smlnj/MLRISC/$filename -- a proxy providing the
 * services of \$SMLNJ-MLRISC/$filename.
 *   The path anchor \$SMLNJ-MLRISC points to (implementation of the)
 *   version of MLRISC that is used by SML/NJ.
 *   This proxy takes care of binding path anchors internal to MLRISC
 *   in such a way that they consistently point to the same version
 *   of MLRISC.
 *
 *   Copyright (c) 2000 by Lucent Bell Laboratories
 *
 * author: Matthias Blume (blume\@cs.princeton.edu)
 *)     
END
   print CM "Library\n"; 
   foreach $entry (@exports)
   {  print CM $entry;
   }
   print CM "is\n";
   print CM "\t\$SMLNJ-MLRISC/$filename\n";
   print CM <<'END';
                (bind:(anchor:Control.cm value:$SMLNJ-MLRISC)
                 bind:(anchor:Lib.cm value:$SMLNJ-MLRISC)
                 bind:(anchor:MLTREE.cm value:$SMLNJ-MLRISC)
                 bind:(anchor:MLRISC.cm value:$SMLNJ-MLRISC))        
END
   print STDERR "[ $outfile written ]\n";
   close(CM);
}
stop

exit 1
