require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_SYS_LIMITS_H_)) {
    eval 'sub _SYS_LIMITS_H_ () {1;}' unless defined(&_SYS_LIMITS_H_);
    require 'sys/cdefs.ph';
    require 'machine/internal_types.ph';
    require 'machine/limits.ph';
    eval 'sub CHAR_BIT () {8;}' unless defined(&CHAR_BIT);
    eval 'sub SCHAR_MAX () {0x7f;}' unless defined(&SCHAR_MAX);
    eval 'sub SCHAR_MIN () {(-0x7f-1);}' unless defined(&SCHAR_MIN);
    eval 'sub UCHAR_MAX () {0xff;}' unless defined(&UCHAR_MAX);
    if(defined(&__machine_has_unsigned_chars)) {
	eval 'sub CHAR_MIN () {0;}' unless defined(&CHAR_MIN);
	eval 'sub CHAR_MAX () {0xff;}' unless defined(&CHAR_MAX);
    } else {
	eval 'sub CHAR_MAX () {0x7f;}' unless defined(&CHAR_MAX);
	eval 'sub CHAR_MIN () {(-0x7f-1);}' unless defined(&CHAR_MIN);
    }
    eval 'sub USHRT_MAX () {0xffff;}' unless defined(&USHRT_MAX);
    eval 'sub SHRT_MAX () {0x7fff;}' unless defined(&SHRT_MAX);
    eval 'sub SHRT_MIN () {(-0x7fff-1);}' unless defined(&SHRT_MIN);
    eval 'sub UINT_MAX () {0xffffffff;}' unless defined(&UINT_MAX);
    eval 'sub INT_MAX () {0x7fffffff;}' unless defined(&INT_MAX);
    eval 'sub INT_MIN () {(-0x7fffffff-1);}' unless defined(&INT_MIN);
    if(defined(&__LP64__)) {
	eval 'sub ULONG_MAX () {1.84467440737096e+19;}' unless defined(&ULONG_MAX);
	eval 'sub LONG_MAX () {9.22337203685478e+18;}' unless defined(&LONG_MAX);
	eval 'sub LONG_MIN () {(-9.22337203685478e+18-1);}' unless defined(&LONG_MIN);
    } else {
	eval 'sub ULONG_MAX () {0xffffffff;}' unless defined(&ULONG_MAX);
	eval 'sub LONG_MAX () {0x7fffffff;}' unless defined(&LONG_MAX);
	eval 'sub LONG_MIN () {(-0x7fffffff-1);}' unless defined(&LONG_MIN);
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0) || (defined(&__ISO_C_VISIBLE) ? &__ISO_C_VISIBLE : 0) >= 1999) {
	eval 'sub ULLONG_MAX () {1.84467440737096e+19;}' unless defined(&ULLONG_MAX);
	eval 'sub LLONG_MAX () {9.22337203685478e+18;}' unless defined(&LLONG_MAX);
	eval 'sub LLONG_MIN () {(-9.22337203685478e+18-1);}' unless defined(&LLONG_MIN);
    }
    if((defined(&__BSD_VISIBLE) ? &__BSD_VISIBLE : 0)) {
	eval 'sub UID_MAX () { &UINT_MAX;}' unless defined(&UID_MAX);
	eval 'sub GID_MAX () { &UINT_MAX;}' unless defined(&GID_MAX);
    }
    if((defined(&__XPG_VISIBLE) ? &__XPG_VISIBLE : 0)) {
	if(defined(&__LP64__)) {
	    eval 'sub LONG_BIT () {64;}' unless defined(&LONG_BIT);
	} else {
	    eval 'sub LONG_BIT () {32;}' unless defined(&LONG_BIT);
	}
	eval 'sub WORD_BIT () {32;}' unless defined(&WORD_BIT);
	if(!defined( &DBL_DIG)) {
	    if(defined( &__DBL_DIG)) {
		eval 'sub DBL_DIG () { &__DBL_DIG;}' unless defined(&DBL_DIG);
		eval 'sub DBL_MAX () { &__DBL_MAX;}' unless defined(&DBL_MAX);
		eval 'sub DBL_MIN () { &__DBL_MIN;}' unless defined(&DBL_MIN);
		eval 'sub FLT_DIG () { &__FLT_DIG;}' unless defined(&FLT_DIG);
		eval 'sub FLT_MAX () { &__FLT_MAX;}' unless defined(&FLT_MAX);
		eval 'sub FLT_MIN () { &__FLT_MIN;}' unless defined(&FLT_MIN);
	    } else {
		eval 'sub DBL_DIG () {15;}' unless defined(&DBL_DIG);
		eval 'sub DBL_MAX () {1.7976931348623157E+308;}' unless defined(&DBL_MAX);
		eval 'sub DBL_MIN () {2.2250738585072014E-308;}' unless defined(&DBL_MIN);
		eval 'sub FLT_DIG () {6;}' unless defined(&FLT_DIG);
		eval 'sub FLT_MAX () {3.40282347E+38;}' unless defined(&FLT_MAX);
		eval 'sub FLT_MIN () {1.17549435E-38;}' unless defined(&FLT_MIN);
	    }
	}
    }
}
1;
