require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_SYS_STDINT_H_)) {
    eval 'sub _SYS_STDINT_H_ () {1;}' unless defined(&_SYS_STDINT_H_);
    require 'sys/cdefs.ph';
    require 'machine/_types.ph';
    unless(defined(&__BIT_TYPES_DEFINED__)) {
	eval 'sub __BIT_TYPES_DEFINED__ () {1;}' unless defined(&__BIT_TYPES_DEFINED__);
    }
    unless(defined(&_INT8_T_DEFINED_)) {
	eval 'sub _INT8_T_DEFINED_ () {1;}' unless defined(&_INT8_T_DEFINED_);
    }
    unless(defined(&_UINT8_T_DEFINED_)) {
	eval 'sub _UINT8_T_DEFINED_ () {1;}' unless defined(&_UINT8_T_DEFINED_);
    }
    unless(defined(&_INT16_T_DEFINED_)) {
	eval 'sub _INT16_T_DEFINED_ () {1;}' unless defined(&_INT16_T_DEFINED_);
    }
    unless(defined(&_UINT16_T_DEFINED_)) {
	eval 'sub _UINT16_T_DEFINED_ () {1;}' unless defined(&_UINT16_T_DEFINED_);
    }
    unless(defined(&_INT32_T_DEFINED_)) {
	eval 'sub _INT32_T_DEFINED_ () {1;}' unless defined(&_INT32_T_DEFINED_);
    }
    unless(defined(&_UINT32_T_DEFINED_)) {
	eval 'sub _UINT32_T_DEFINED_ () {1;}' unless defined(&_UINT32_T_DEFINED_);
    }
    unless(defined(&_INT64_T_DEFINED_)) {
	eval 'sub _INT64_T_DEFINED_ () {1;}' unless defined(&_INT64_T_DEFINED_);
    }
    unless(defined(&_UINT64_T_DEFINED_)) {
	eval 'sub _UINT64_T_DEFINED_ () {1;}' unless defined(&_UINT64_T_DEFINED_);
    }
    if(!defined( &__cplusplus) || defined( &__STDC_LIMIT_MACROS)) {
	eval 'sub INT8_MIN () {(-0x7f - 1);}' unless defined(&INT8_MIN);
	eval 'sub INT16_MIN () {(-0x7fff - 1);}' unless defined(&INT16_MIN);
	eval 'sub INT32_MIN () {(-0x7fffffff - 1);}' unless defined(&INT32_MIN);
	eval 'sub INT64_MIN () {(-0x7fffffffffffffff - 1);}' unless defined(&INT64_MIN);
	eval 'sub INT8_MAX () {0x7f;}' unless defined(&INT8_MAX);
	eval 'sub INT16_MAX () {0x7fff;}' unless defined(&INT16_MAX);
	eval 'sub INT32_MAX () {0x7fffffff;}' unless defined(&INT32_MAX);
	eval 'sub INT64_MAX () {0x7fffffffffffffff;}' unless defined(&INT64_MAX);
	eval 'sub UINT8_MAX () {0xff;}' unless defined(&UINT8_MAX);
	eval 'sub UINT16_MAX () {0xffff;}' unless defined(&UINT16_MAX);
	eval 'sub UINT32_MAX () {0xffffffff;}' unless defined(&UINT32_MAX);
	eval 'sub UINT64_MAX () {0xffffffffffffffff;}' unless defined(&UINT64_MAX);
	eval 'sub INT_LEAST8_MIN () { &INT8_MIN;}' unless defined(&INT_LEAST8_MIN);
	eval 'sub INT_LEAST16_MIN () { &INT16_MIN;}' unless defined(&INT_LEAST16_MIN);
	eval 'sub INT_LEAST32_MIN () { &INT32_MIN;}' unless defined(&INT_LEAST32_MIN);
	eval 'sub INT_LEAST64_MIN () { &INT64_MIN;}' unless defined(&INT_LEAST64_MIN);
	eval 'sub INT_LEAST8_MAX () { &INT8_MAX;}' unless defined(&INT_LEAST8_MAX);
	eval 'sub INT_LEAST16_MAX () { &INT16_MAX;}' unless defined(&INT_LEAST16_MAX);
	eval 'sub INT_LEAST32_MAX () { &INT32_MAX;}' unless defined(&INT_LEAST32_MAX);
	eval 'sub INT_LEAST64_MAX () { &INT64_MAX;}' unless defined(&INT_LEAST64_MAX);
	eval 'sub UINT_LEAST8_MAX () { &UINT8_MAX;}' unless defined(&UINT_LEAST8_MAX);
	eval 'sub UINT_LEAST16_MAX () { &UINT16_MAX;}' unless defined(&UINT_LEAST16_MAX);
	eval 'sub UINT_LEAST32_MAX () { &UINT32_MAX;}' unless defined(&UINT_LEAST32_MAX);
	eval 'sub UINT_LEAST64_MAX () { &UINT64_MAX;}' unless defined(&UINT_LEAST64_MAX);
	eval 'sub INT_FAST8_MIN () { &INT8_MIN;}' unless defined(&INT_FAST8_MIN);
	eval 'sub INT_FAST16_MIN () { &INT16_MIN;}' unless defined(&INT_FAST16_MIN);
	eval 'sub INT_FAST32_MIN () { &INT32_MIN;}' unless defined(&INT_FAST32_MIN);
	eval 'sub INT_FAST64_MIN () { &INT64_MIN;}' unless defined(&INT_FAST64_MIN);
	eval 'sub INT_FAST8_MAX () { &INT8_MAX;}' unless defined(&INT_FAST8_MAX);
	eval 'sub INT_FAST16_MAX () { &INT16_MAX;}' unless defined(&INT_FAST16_MAX);
	eval 'sub INT_FAST32_MAX () { &INT32_MAX;}' unless defined(&INT_FAST32_MAX);
	eval 'sub INT_FAST64_MAX () { &INT64_MAX;}' unless defined(&INT_FAST64_MAX);
	eval 'sub UINT_FAST8_MAX () { &UINT8_MAX;}' unless defined(&UINT_FAST8_MAX);
	eval 'sub UINT_FAST16_MAX () { &UINT16_MAX;}' unless defined(&UINT_FAST16_MAX);
	eval 'sub UINT_FAST32_MAX () { &UINT32_MAX;}' unless defined(&UINT_FAST32_MAX);
	eval 'sub UINT_FAST64_MAX () { &UINT64_MAX;}' unless defined(&UINT_FAST64_MAX);
	if(defined(&__LP64__)) {
	    eval 'sub INTPTR_MIN () { &INT64_MIN;}' unless defined(&INTPTR_MIN);
	    eval 'sub INTPTR_MAX () { &INT64_MAX;}' unless defined(&INTPTR_MAX);
	    eval 'sub UINTPTR_MAX () { &UINT64_MAX;}' unless defined(&UINTPTR_MAX);
	} else {
	    eval 'sub INTPTR_MIN () { &INT32_MIN;}' unless defined(&INTPTR_MIN);
	    eval 'sub INTPTR_MAX () { &INT32_MAX;}' unless defined(&INTPTR_MAX);
	    eval 'sub UINTPTR_MAX () { &UINT32_MAX;}' unless defined(&UINTPTR_MAX);
	}
	eval 'sub INTMAX_MIN () { &INT64_MIN;}' unless defined(&INTMAX_MIN);
	eval 'sub INTMAX_MAX () { &INT64_MAX;}' unless defined(&INTMAX_MAX);
	eval 'sub UINTMAX_MAX () { &UINT64_MAX;}' unless defined(&UINTMAX_MAX);
	eval 'sub PTRDIFF_MIN () { &INTPTR_MIN;}' unless defined(&PTRDIFF_MIN);
	eval 'sub PTRDIFF_MAX () { &INTPTR_MAX;}' unless defined(&PTRDIFF_MAX);
	eval 'sub SIG_ATOMIC_MIN () { &INT32_MIN;}' unless defined(&SIG_ATOMIC_MIN);
	eval 'sub SIG_ATOMIC_MAX () { &INT32_MAX;}' unless defined(&SIG_ATOMIC_MAX);
	unless(defined(&SIZE_MAX)) {
	    eval 'sub SIZE_MAX () { &UINTPTR_MAX;}' unless defined(&SIZE_MAX);
	}
	eval 'sub WCHAR_MIN () { &INT32_MIN;}' unless defined(&WCHAR_MIN);
	eval 'sub WCHAR_MAX () { &INT32_MAX;}' unless defined(&WCHAR_MAX);
	eval 'sub WINT_MIN () { &INT32_MIN;}' unless defined(&WINT_MIN);
	eval 'sub WINT_MAX () { &INT32_MAX;}' unless defined(&WINT_MAX);
    }
    if(!defined( &__cplusplus) || defined( &__STDC_CONSTANT_MACROS)) {
	eval 'sub INT8_C {
	    my($_c) = @_;
    	    eval q(($_c));
	}' unless defined(&INT8_C);
	eval 'sub INT16_C {
	    my($_c) = @_;
    	    eval q(($_c));
	}' unless defined(&INT16_C);
	eval 'sub INT32_C {
	    my($_c) = @_;
    	    eval q(($_c));
	}' unless defined(&INT32_C);
	eval 'sub INT64_C {
	    my($_c) = @_;
    	    eval q( &__CONCAT($_c,  &LL));
	}' unless defined(&INT64_C);
	eval 'sub UINT8_C {
	    my($_c) = @_;
    	    eval q(($_c));
	}' unless defined(&UINT8_C);
	eval 'sub UINT16_C {
	    my($_c) = @_;
    	    eval q(($_c));
	}' unless defined(&UINT16_C);
	eval 'sub UINT32_C {
	    my($_c) = @_;
    	    eval q( &__CONCAT($_c,  &U));
	}' unless defined(&UINT32_C);
	eval 'sub UINT64_C {
	    my($_c) = @_;
    	    eval q( &__CONCAT($_c,  &ULL));
	}' unless defined(&UINT64_C);
	eval 'sub INTMAX_C {
	    my($_c) = @_;
    	    eval q( &__CONCAT($_c,  &LL));
	}' unless defined(&INTMAX_C);
	eval 'sub UINTMAX_C {
	    my($_c) = @_;
    	    eval q( &__CONCAT($_c,  &ULL));
	}' unless defined(&UINTMAX_C);
    }
}
1;
