#!/usr/bin/perl -w
use strict;

######################################################################
# Create the names for cocoa-basics and cocoa-wrappers to share...
# Just have cocoa-basics as cocoa.dylan.prefix and cat i2d's output
# to it then run make-exports?
######################################################################

######################################################################
# Main
######################################################################

my $inputFile;

if ($#ARGV == 0) { #&& (-d $ARGV[0])) {
    $inputFile = $ARGV[0];
	open (INFILE, "<$inputFile") || die "Can't open $inputFile: $!\n";
	print "module: dylan-user\n\n";
	print "define module cocoa-names\n\tcreate ";
	while( <> )
    {
    	if( $_ =~ m/\/\*\s*exported\s*\*\/\s+(constant|method|functional\s+class)\s+([^\t \r\n]+)/ )
    	{
    		print"$2, ";
    	}
    }
	print ";\nend module cocoa-names;\n";
    close INFILE;
} 
else 
{
	die "You must specify a single input file for processing.\n";
}