require '_h2ph_pre.ph';

unless(defined(&_M68K_STDARG_H_)) {
    eval 'sub _M68K_STDARG_H_ () {1;}' unless defined(&_M68K_STDARG_H_);
    require 'machine/ansi.ph';
    eval 'sub __va_size {
        local($type) = @_;
	    eval q(((($sizeof{$type} + $sizeof{\'long\'} - 1) / $sizeof{\'long\'}) * $sizeof{\'long\'}));
    }' unless defined(&__va_size);
    if(defined(&__GNUC__)) {
	eval 'sub va_start {
	    local($ap, $last) = @_;
    	    eval q(( =  &__builtin_next_arg($last)));
	}' unless defined(&va_start);
    } else {
	eval 'sub va_start {
	    local($ap, $last) = @_;
    	    eval q((($ap) = ( &va_list)($last) +  &__va_size($last)));
	}' unless defined(&va_start);
    }
    eval 'sub va_arg {
        local($ap, $type) = @_;
	    eval q((*(($ap) +=  &__va_size($type), ($ap) - ($sizeof{$type} < $sizeof{\'long\'}  && $sizeof{$type} !=  &__va_size($type) ? $sizeof{$type} :  &__va_size($type)))));
    }' unless defined(&va_arg);
    eval 'sub va_end {
        local($ap) = @_;
	    eval q((0));
    }' unless defined(&va_end);
}
1;
