require '_h2ph_pre.ph';

unless(defined(&_AMIGA_BUS_H_)) {
    eval 'sub _AMIGA_BUS_H_ () {1;}' unless defined(&_AMIGA_BUS_H_);
    require 'machine/endian.ph';
    if(defined(&__STDC__)) {
	eval 'sub CAT {
	    local($a,$b) = @_;
    	    eval q($a$b);
	}' unless defined(&CAT);
	eval 'sub CAT3 {
	    local($a,$b,$c) = @_;
    	    eval q($a$b$c);
	}' unless defined(&CAT3);
    } else {
	eval 'sub CAT {
	    local($a,$b) = @_;
    	    eval q( &ab);
	}' unless defined(&CAT);
	eval 'sub CAT3 {
	    local($a,$b,$c) = @_;
    	    eval q( &abc);
	}' unless defined(&CAT3);
    }
    eval 'sub bus_space_map {
        local($t, $port, $size, $cacheable, $bshp) = @_;
	    eval q((*($t)-> &bs_map)(($t), ($port), ($size), ($cacheable), ($bshp)));
    }' unless defined(&bus_space_map);
    eval 'sub bus_space_unmap {
        local($t, $bshp, $size) = @_;
	    eval q((*($t)-> &bs_unmap)(($t), ($bshp), ($size)));
    }' unless defined(&bus_space_unmap);
    eval 'sub bus_space_read_8 () {!!!  &bus_space_read_8  &not  &implemented !!!;}' unless defined(&bus_space_read_8);
    eval 'sub bus_space_read_multi {
        local($n, $m) = @_;
	    eval q( &static  &__inline  &void  &CAT( &bus_space_read_multi_,$n)( &bus_space_tag_t  &bst,  &bus_space_handle_t  &bsh,  &bus_size_t  &ba,  &CAT3(\'u_int\',$m, &_t) * &buf,  &bus_size_t  &cnt) {  &while ( &cnt--) * &buf++ =  &CAT( &bus_space_read_,$n)( &bst,  &bsh,  &ba); });
    }' unless defined(&bus_space_read_multi);
    eval 'sub bus_space_read_multi_8 () {!!!  &bus_space_read_multi_8  &not  &implemented !!!;}' unless defined(&bus_space_read_multi_8);
    eval 'sub bus_space_read_region {
        local($n, $m) = @_;
	    eval q( &static  &__inline  &void  &CAT( &bus_space_read_region_,$n)( &bus_space_tag_t  &bst,  &bus_space_handle_t  &bsh,  &bus_size_t  &ba,  &CAT3(\'u_int\',$m, &_t) * &buf,  &bus_size_t  &cnt) {  &while ( &cnt--) { * &buf++ =  &CAT( &bus_space_read_,$n)( &bst,  &bsh,  &ba);  &ba += $n; } });
    }' unless defined(&bus_space_read_region);
    eval 'sub bus_space_read_region_8 () {!!!  &bus_space_read_region_8  &not  &implemented !!!;}' unless defined(&bus_space_read_region_8);
    eval 'sub bus_space_write_8 () {!!!  &bus_space_write_8  &not  &implemented !!!;}' unless defined(&bus_space_write_8);
    eval 'sub bus_space_write_multi {
        local($n, $m) = @_;
	    eval q( &static  &__inline  &void  &CAT( &bus_space_write_multi_,$n)( &bus_space_tag_t  &bst,  &bus_space_handle_t  &bsh,  &bus_size_t  &ba,  &const  &CAT3(\'u_int\',$m, &_t) * &buf,  &bus_size_t  &cnt) {  &while ( &cnt--)  &CAT( &bus_space_write_,$n)( &bst,  &bsh,  &ba, * &buf++); });
    }' unless defined(&bus_space_write_multi);
    eval 'sub bus_space_write_multi_8 () {!!!  &bus_space_write_multi_8  &not  &implemented !!!;}' unless defined(&bus_space_write_multi_8);
    eval 'sub bus_space_write_region {
        local($n, $m) = @_;
	    eval q( &static  &__inline  &void  &CAT( &bus_space_write_region_,$n)( &bus_space_tag_t  &bst,  &bus_space_handle_t  &bsh,  &bus_size_t  &ba,  &const  &CAT3(\'u_int\',$m, &_t) * &buf,  &bus_size_t  &cnt) {  &while ( &cnt--) {  &CAT( &bus_space_write_,$n)( &bst,  &bsh,  &ba, * &buf++);  &ba += $n; } });
    }' unless defined(&bus_space_write_region);
    eval 'sub bus_space_write_region_8 () {!!!  &bus_space_write_region_8  &not  &implemented !!!;}' unless defined(&bus_space_write_region_8);
    eval 'sub bus_space_set_region {
        local($n, $m) = @_;
	    eval q( &static  &__inline  &void  &CAT( &bus_space_set_region_,$n)( &bus_space_tag_t  &bst,  &bus_space_handle_t  &bsh,  &bus_size_t  &bs,  &CAT3(\'u_int\',$m, &_t)  &val,  &size_t  &count) {  &while ( &count--)  &CAT( &bus_space_write_,$n)( &bst,  &bsh,  &bs++,  &val); });
    }' unless defined(&bus_space_set_region);
    eval 'sub bus_space_set_region_8 () {!!!  &bus_space_set_region_8  &not  &implemented !!!;}' unless defined(&bus_space_set_region_8);
    eval 'sub bus_space_read_raw_multi_8 () {!!!  &bus_space_read_raw_multi_8  &not  &implemented !!!;}' unless defined(&bus_space_read_raw_multi_8);
    eval 'sub bus_space_read_raw_region_8 () {!!!  &bus_space_read_raw_region_8  &not  &implemented !!!;}' unless defined(&bus_space_read_raw_region_8);
    eval 'sub bus_space_write_raw_multi_8 () {!!!  &bus_space_write_raw_multi_8  &not  &implemented !!!;}' unless defined(&bus_space_write_raw_multi_8);
    eval 'sub bus_space_write_raw_region_8 () {!!!  &bus_space_write_raw_region_8  &not  &implemented !!!;}' unless defined(&bus_space_write_raw_region_8);
}
1;
