require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_CORE_H_)) {
    eval 'sub _SYS_CORE_H_ () {1;}' unless defined(&_SYS_CORE_H_);
    eval 'sub COREMAGIC () {0507;}' unless defined(&COREMAGIC);
    eval 'sub CORESEGMAGIC () {0510;}' unless defined(&CORESEGMAGIC);
    eval 'sub CORE_GETMAGIC {
        my($c) = @_;
	    eval q((  &ntohl((($c). &c_midmag)) & 0xffff ));
    }' unless defined(&CORE_GETMAGIC);
    eval 'sub CORE_GETMID {
        my($c) = @_;
	    eval q(( ( &ntohl((($c). &c_midmag)) >> 16) & 0x3ff ));
    }' unless defined(&CORE_GETMID);
    eval 'sub CORE_GETFLAG {
        my($c) = @_;
	    eval q(( ( &ntohl((($c). &c_midmag)) >> 26) & 0x3f ));
    }' unless defined(&CORE_GETFLAG);
    eval 'sub CORE_SETMAGIC {
        my($c,$mag,$mid,$flag) = @_;
	    eval q(( ($c). &c_midmag =  &htonl ( ( (($flag) & 0x3f) << 26) | ( (($mid) & 0x3ff) << 16) | ( (($mag) & 0xffff) ) ) ));
    }' unless defined(&CORE_SETMAGIC);
    eval 'sub CORE_CPU () {1;}' unless defined(&CORE_CPU);
    eval 'sub CORE_DATA () {2;}' unless defined(&CORE_DATA);
    eval 'sub CORE_STACK () {4;}' unless defined(&CORE_STACK);
    require 'sys/aout_mids.ph';
}
1;
