require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_EXEC_COFF_H_)) {
    eval 'sub _SYS_EXEC_COFF_H_ () {1;}' unless defined(&_SYS_EXEC_COFF_H_);
    require 'machine/coff_machdep.ph';
    eval 'sub COFF_F_RELFLG () {0x1;}' unless defined(&COFF_F_RELFLG);
    eval 'sub COFF_F_EXEC () {0x2;}' unless defined(&COFF_F_EXEC);
    eval 'sub COFF_F_LNNO () {0x4;}' unless defined(&COFF_F_LNNO);
    eval 'sub COFF_F_LSYMS () {0x8;}' unless defined(&COFF_F_LSYMS);
    eval 'sub COFF_F_SWABD () {0x40;}' unless defined(&COFF_F_SWABD);
    eval 'sub COFF_F_AR16WR () {0x80;}' unless defined(&COFF_F_AR16WR);
    eval 'sub COFF_F_AR32WR () {0x100;}' unless defined(&COFF_F_AR32WR);
    eval 'sub COFF_F_AR32W () {0x200;}' unless defined(&COFF_F_AR32W);
    eval 'sub COFF_STYP_REG () {0x;}' unless defined(&COFF_STYP_REG);
    eval 'sub COFF_STYP_DSECT () {0x1;}' unless defined(&COFF_STYP_DSECT);
    eval 'sub COFF_STYP_NOLOAD () {0x2;}' unless defined(&COFF_STYP_NOLOAD);
    eval 'sub COFF_STYP_GROUP () {0x4;}' unless defined(&COFF_STYP_GROUP);
    eval 'sub COFF_STYP_PAD () {0x8;}' unless defined(&COFF_STYP_PAD);
    eval 'sub COFF_STYP_COPY () {0x10;}' unless defined(&COFF_STYP_COPY);
    eval 'sub COFF_STYP_TEXT () {0x20;}' unless defined(&COFF_STYP_TEXT);
    eval 'sub COFF_STYP_DATA () {0x40;}' unless defined(&COFF_STYP_DATA);
    eval 'sub COFF_STYP_BSS () {0x80;}' unless defined(&COFF_STYP_BSS);
    eval 'sub COFF_STYP_INFO () {0x200;}' unless defined(&COFF_STYP_INFO);
    eval 'sub COFF_STYP_OVER () {0x400;}' unless defined(&COFF_STYP_OVER);
    eval 'sub COFF_STYP_SHLIB () {0x800;}' unless defined(&COFF_STYP_SHLIB);
    eval 'sub COFF_ROUND {
        my($val, $by) = @_;
	    eval q(((($val) + $by - 1) & ~($by - 1)));
    }' unless defined(&COFF_ROUND);
    eval 'sub COFF_ALIGN {
        my($a) = @_;
	    eval q((($a) & ~( &COFF_LDPGSZ - 1)));
    }' unless defined(&COFF_ALIGN);
    eval 'sub COFF_HDR_SIZE () {($sizeof{\'struct coff_filehdr\'} + $sizeof{\'struct coff_aouthdr\'});}' unless defined(&COFF_HDR_SIZE);
    eval 'sub COFF_BLOCK_ALIGN {
        my($ap, $value) = @_;
	    eval q((($ap)-> &a_magic ==  &COFF_ZMAGIC ?  &COFF_ROUND($value,  &COFF_LDPGSZ) : $value));
    }' unless defined(&COFF_BLOCK_ALIGN);
    eval 'sub COFF_TXTOFF {
        my($fp, $ap) = @_;
	    eval q((($ap)-> &a_magic ==  &COFF_ZMAGIC ? 0:  &COFF_ROUND( &COFF_HDR_SIZE + ($fp)-> &f_nscns * $sizeof{\'struct coff_scnhdr\'},  &COFF_SEGMENT_ALIGNMENT($fp, $ap))));
    }' unless defined(&COFF_TXTOFF);
    eval 'sub COFF_DATOFF {
        my($fp, $ap) = @_;
	    eval q(( &COFF_BLOCK_ALIGN($ap,  &COFF_TXTOFF($fp, $ap) + ($ap)-> &a_tsize)));
    }' unless defined(&COFF_DATOFF);
    eval 'sub COFF_SEGMENT_ALIGN {
        my($fp, $ap, $value) = @_;
	    eval q(( &COFF_ROUND($value, (($ap)-> &a_magic ==  &COFF_ZMAGIC ?  &COFF_LDPGSZ :  &COFF_SEGMENT_ALIGNMENT($fp, $ap)))));
    }' unless defined(&COFF_SEGMENT_ALIGN);
    if(defined(&_KERNEL)) {
    }
}
1;
