require '_h2ph_pre.ph';

unless(defined(&__A_OUT_GNU_H__)) {
    eval 'sub __A_OUT_GNU_H__ () {1;}' unless defined(&__A_OUT_GNU_H__);
    eval 'sub __GNU_EXEC_MACROS__ () {1;}' unless defined(&__GNU_EXEC_MACROS__);
    unless(defined(&__STRUCT_EXEC_OVERRIDE__)) {
	require 'asm/a.out.ph';
    }
    eval("sub M_386 () { 100; }") unless defined(&M_386);
    eval("sub M_MIPS1 () { 151; }") unless defined(&M_MIPS1);
    eval("sub M_MIPS2 () { 152; }") unless defined(&M_MIPS2);
    if(!defined ( &N_MAGIC)) {
	eval 'sub N_MAGIC {
	    local($exec) = @_;
    	    eval q((($exec). &a_info & 0xffff));
	}' unless defined(&N_MAGIC);
    }
    eval 'sub N_MACHTYPE {
        local($exec) = @_;
	    eval q((((($exec). &a_info >> 16) & 0xff)));
    }' unless defined(&N_MACHTYPE);
    eval 'sub N_FLAGS {
        local($exec) = @_;
	    eval q(((($exec). &a_info >> 24) & 0xff));
    }' unless defined(&N_FLAGS);
    eval 'sub N_SET_INFO {
        local($exec, $magic, $type, $flags) = @_;
	    eval q((. &a_info = ( & 0xffff) | ((($type) & 0xff) << 16) | ((($flags) & 0xff) << 24)));
    }' unless defined(&N_SET_INFO);
    eval 'sub N_SET_MAGIC {
        local($exec, $magic) = @_;
	    eval q((($exec). &a_info = ((($exec). &a_info & 0xffff0000) | (($magic) & 0xffff))));
    }' unless defined(&N_SET_MAGIC);
    eval 'sub N_SET_MACHTYPE {
        local($exec, $machtype) = @_;
	    eval q((. &a_info = (. &a_info&0xff00ffff) | (((($machtype))&0xff) << 16)));
    }' unless defined(&N_SET_MACHTYPE);
    eval 'sub N_SET_FLAGS {
        local($exec, $flags) = @_;
	    eval q((($exec). &a_info = (($exec). &a_info&0xffffff) | ((($flags) & 0xff) << 24)));
    }' unless defined(&N_SET_FLAGS);
    eval 'sub OMAGIC () {0407;}' unless defined(&OMAGIC);
    eval 'sub NMAGIC () {0410;}' unless defined(&NMAGIC);
    eval 'sub ZMAGIC () {0413;}' unless defined(&ZMAGIC);
    eval 'sub QMAGIC () {0314;}' unless defined(&QMAGIC);
    eval 'sub CMAGIC () {0421;}' unless defined(&CMAGIC);
    if(!defined ( &N_BADMAG)) {
	eval 'sub N_BADMAG {
	    local($x) = @_;
    	    eval q(( &N_MAGIC($x) !=  &OMAGIC  &&  &N_MAGIC($x) !=  &NMAGIC  &&  &N_MAGIC($x) !=  &ZMAGIC  &&  &N_MAGIC($x) !=  &QMAGIC));
	}' unless defined(&N_BADMAG);
    }
    eval 'sub _N_HDROFF {
        local($x) = @_;
	    eval q((1024- $sizeof{\'struct exec\'}));
    }' unless defined(&_N_HDROFF);
    if(!defined ( &N_TXTOFF)) {
	eval 'sub N_TXTOFF {
	    local($x) = @_;
    	    eval q(( &N_MAGIC($x) ==  &ZMAGIC ?  &_N_HDROFF(($x)) + $sizeof{\'struct exec\'} : ( &N_MAGIC($x) ==  &QMAGIC ? 0: $sizeof{\'struct exec\'})));
	}' unless defined(&N_TXTOFF);
    }
    if(!defined ( &N_DATOFF)) {
	eval 'sub N_DATOFF {
	    local($x) = @_;
    	    eval q(( &N_TXTOFF($x) + ($x). &a_text));
	}' unless defined(&N_DATOFF);
    }
    if(!defined ( &N_TRELOFF)) {
	eval 'sub N_TRELOFF {
	    local($x) = @_;
    	    eval q(( &N_DATOFF($x) + ($x). &a_data));
	}' unless defined(&N_TRELOFF);
    }
    if(!defined ( &N_DRELOFF)) {
	eval 'sub N_DRELOFF {
	    local($x) = @_;
    	    eval q(( &N_TRELOFF($x) +  &N_TRSIZE($x)));
	}' unless defined(&N_DRELOFF);
    }
    if(!defined ( &N_SYMOFF)) {
	eval 'sub N_SYMOFF {
	    local($x) = @_;
    	    eval q(( &N_DRELOFF($x) +  &N_DRSIZE($x)));
	}' unless defined(&N_SYMOFF);
    }
    if(!defined ( &N_STROFF)) {
	eval 'sub N_STROFF {
	    local($x) = @_;
    	    eval q(( &N_SYMOFF($x) +  &N_SYMSIZE($x)));
	}' unless defined(&N_STROFF);
    }
    if(!defined ( &N_TXTADDR)) {
	eval 'sub N_TXTADDR {
	    local($x) = @_;
    	    eval q(( &N_MAGIC($x) ==  &QMAGIC ?  &PAGE_SIZE : 0));
	}' unless defined(&N_TXTADDR);
    }
    if(defined( &vax) || defined( &hp300) || defined( &pyr)) {
	eval 'sub SEGMENT_SIZE () { &page_size;}' unless defined(&SEGMENT_SIZE);
    }
    if(defined(&sony)) {
	eval 'sub SEGMENT_SIZE () {0x2000;}' unless defined(&SEGMENT_SIZE);
    }
    if(defined(&is68k)) {
	eval 'sub SEGMENT_SIZE () {0x20000;}' unless defined(&SEGMENT_SIZE);
    }
    if(defined( &m68k)  && defined( &PORTAR)) {
	eval 'sub PAGE_SIZE () {0x400;}' unless defined(&PAGE_SIZE);
	eval 'sub SEGMENT_SIZE () { &PAGE_SIZE;}' unless defined(&SEGMENT_SIZE);
    }
    if(defined(&linux)) {
	require 'asm/page.ph';
	if(defined( &__i386__) || defined( &__mc68000__)) {
	    eval 'sub SEGMENT_SIZE () {1024;}' unless defined(&SEGMENT_SIZE);
	} else {
	    unless(defined(&SEGMENT_SIZE)) {
		eval 'sub SEGMENT_SIZE () { &PAGE_SIZE;}' unless defined(&SEGMENT_SIZE);
	    }
	}
    }
    eval 'sub _N_SEGMENT_ROUND {
        local($x) = @_;
	    eval q(((($x) +  &SEGMENT_SIZE - 1) & ~( &SEGMENT_SIZE - 1)));
    }' unless defined(&_N_SEGMENT_ROUND);
    eval 'sub _N_TXTENDADDR {
        local($x) = @_;
	    eval q(( &N_TXTADDR($x)+($x). &a_text));
    }' unless defined(&_N_TXTENDADDR);
    unless(defined(&N_DATADDR)) {
	eval 'sub N_DATADDR {
	    local($x) = @_;
    	    eval q(( &N_MAGIC($x)== &OMAGIC? ( &_N_TXTENDADDR($x)) : ( &_N_SEGMENT_ROUND ( &_N_TXTENDADDR($x)))));
	}' unless defined(&N_DATADDR);
    }
    if(!defined ( &N_BSSADDR)) {
	eval 'sub N_BSSADDR {
	    local($x) = @_;
    	    eval q(( &N_DATADDR($x) + ($x). &a_data));
	}' unless defined(&N_BSSADDR);
    }
    if(!defined ( &N_NLIST_DECLARED)) {
    }
    if(!defined ( &N_UNDF)) {
	eval 'sub N_UNDF () {0;}' unless defined(&N_UNDF);
    }
    if(!defined ( &N_ABS)) {
	eval 'sub N_ABS () {2;}' unless defined(&N_ABS);
    }
    if(!defined ( &N_TEXT)) {
	eval 'sub N_TEXT () {4;}' unless defined(&N_TEXT);
    }
    if(!defined ( &N_DATA)) {
	eval 'sub N_DATA () {6;}' unless defined(&N_DATA);
    }
    if(!defined ( &N_BSS)) {
	eval 'sub N_BSS () {8;}' unless defined(&N_BSS);
    }
    if(!defined ( &N_FN)) {
	eval 'sub N_FN () {15;}' unless defined(&N_FN);
    }
    if(!defined ( &N_EXT)) {
	eval 'sub N_EXT () {1;}' unless defined(&N_EXT);
    }
    if(!defined ( &N_TYPE)) {
	eval 'sub N_TYPE () {036;}' unless defined(&N_TYPE);
    }
    if(!defined ( &N_STAB)) {
	eval 'sub N_STAB () {0340;}' unless defined(&N_STAB);
    }
    eval 'sub N_INDR () {0xa;}' unless defined(&N_INDR);
    eval 'sub N_SETA () {0x14;}' unless defined(&N_SETA);
    eval 'sub N_SETT () {0x16;}' unless defined(&N_SETT);
    eval 'sub N_SETD () {0x18;}' unless defined(&N_SETD);
    eval 'sub N_SETB () {0x1a;}' unless defined(&N_SETB);
    eval 'sub N_SETV () {0x1c;}' unless defined(&N_SETV);
    if(!defined ( &N_RELOCATION_INFO_DECLARED)) {
	if(defined(&NS32K)) {
	} else {
	}
    }
}
1;
