#!/usr/bin/perl

use strict;


use Data::Dumper;
use Carp::Assert;

use lib qw( lib );
use ACIS::MiLa;

my $specml = shift || "amf.spec";


assert( ($specml and -f $specml), "can't find spec file $specml" );

#print "ML: $specml\n";

my $r = execute( $specml );

if ( ref $r and scalar @$r ) {
#  ACIS::MiLa::dump_data();
}

use AMF::Spec;
AMF::Spec::process( $AMF::Spec::spec ); 

my $depends = $AMF::Spec::spec -> {depends};

open SPEC, ">lib/AMF/Spec/Parsed.pm";
print SPEC Data::Dumper->Dump( [ $AMF::Spec::spec ], [ 'AMF::Spec' ] );

foreach ( @$depends ) {
  print SPEC "\nrequire $_;\n";
}

print SPEC "\n1;\n";
close SPEC;
