require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_I386_STDARG_H_)) {
    eval 'sub _I386_STDARG_H_ () {1;}' unless defined(&_I386_STDARG_H_);
    require 'sys/cdefs.ph';
    require 'machine/_types.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((($ap) = ( &va_list) &__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((*($type *)(($ap) +=  &__va_size($type), ($ap) -  &__va_size($type))));
    }' unless defined(&va_arg);
    if((defined(&__ISO_C_VISIBLE) ? &__ISO_C_VISIBLE : 0) >= 1999) {
	eval 'sub va_copy {
	    local($dest, $src) = @_;
    	    eval q((($dest) = ($src)));
	}' unless defined(&va_copy);
    }
    eval 'sub va_end {
        local($ap) = @_;
	    eval q();
    }' unless defined(&va_end);
}
1;
