foreach $file (@ARGV) {
	&process($file);
}

sub process {
	local($filename,$input) = @_;
	$input++;
	unless (open($input,$filename)) {
		print STDERR "Can't open $filename: $!\n";
		return;
	}
	($dllfile = $filename) =~ s/\.gc/\.hs/;
	while (<$input>) {
		if (/^import\s+(\w*)/) {
			local $module = $1;
			print "$dllfile:	$module.gc\n" if -f "$module.gc";
		} elsif (/%#include\s+"(.*)"/) {
			print "$dllfile:	$1\n";
		}
	}
	close $input;
}
