our @EXPORT = qw(init_state);
##############################################################################
$diag_root = $ENV{DV_ROOT
} unless defined $diag_root;
$start_dir = getcwd
unless defined $start_dir;
$dest_dir = getcwd
unless defined $start_dir;
$diag_root = File
::Spec
->rel2abs($diag_root, getcwd
);
$start_dir = File
::Spec
->rel2abs($start_dir, getcwd
);
$dest_dir = File
::Spec
->rel2abs($dest_dir, getcwd
);
my $state = Midas
::State
->new(start_dir
=> $start_dir,
$state->set_build_dir($state->get_build_dir());
$ENV{DIAG_ROOT
} = $diag_root;
$ENV{START_DIR
} = $start_dir;
$ENV{DEST_DIR
} = $dest_dir;
##############################################################################
$this = fields
::new
($this);
foreach my $key (keys %args) {
$this->{$key} = $args{$key};
##############################################################################
$this->{start_dir
} = '.';
$this->{build_dir
} = undef;
$this->{diag_root
} = $ENV{DV_ROOT
};
$this->{created_build_dir
} = 0;
$this->{skipping_build
} = 0;
##############################################################################
my $build = $this->{build_dir
};
$build = $CONFIG{build_dir
};
my $build_abs = File
::Spec
->rel2abs($build, $this->{start_dir
});
if(grep /^\-abs$/, @args) {
return compact_path
($build_abs);
##############################################################################
my $build = File
::Spec
->rel2abs($build_dir, $this->{start_dir
});
$this->{build_dir
} = $build;
return $this->{build_dir
};
##############################################################################
my $start_dir = $this->{start_dir
};
if(grep /^\-abs$/, @args) {
return compact_path
$start_dir;
##############################################################################
my $dest_dir = $this->{dest_dir
};
if(grep /^\-abs$/, @args) {
return compact_path
$dest_dir;
##############################################################################
$this->{dest_dir
} = File
::Spec
->rel2abs($dest_dir);
##############################################################################
sub get_created_build_dir
{
return $this->{created_build_dir
};
##############################################################################
sub set_created_build_dir
{
$val = 1 unless defined $val;
$this->{created_build_dir
} = $val;
return $this->{created_build_dir
};
##############################################################################
return $this->{diag_root
};
##############################################################################
fatal
"Tried to get mmu of specified type $type when an mmu already ".
"exists!\n", M_CODE
if defined $type && defined $this->{mmu
};
return $this->{mmu
} if defined $this->{mmu
};
my $mmu = create_mmu
( defined $type ?
$type : $CONFIG{mmu_type
} );
##############################################################################
##############################################################################
$this->{skipping_build
} = $bool if defined $bool;
return $this->{skipping_build
};
##############################################################################
return $this->{tsbs
}{$name} if exists $this->{tsbs
}{$name};
##############################################################################
return $this->{tsblinks
}{$name} if exists $this->{tsblinks
}{$name};
##############################################################################