require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&__objc_api_INCLUDE_GNU)) {
    eval 'sub __objc_api_INCLUDE_GNU () {1;}' unless defined(&__objc_api_INCLUDE_GNU);
    require 'objc/objc.ph';
    require 'objc/hash.ph';
    require 'objc/thr.ph';
    require 'stdio.ph';
    require 'stdarg.ph';
    eval 'sub METHOD_NULL () {( &Method_t)0;}' unless defined(&METHOD_NULL);
    eval 'sub _C_ID () {ord(\'@\');}' unless defined(&_C_ID);
    eval 'sub _C_CLASS () {ord(\'#\');}' unless defined(&_C_CLASS);
    eval 'sub _C_SEL () {ord(\':\');}' unless defined(&_C_SEL);
    eval 'sub _C_CHR () {ord(\'c\');}' unless defined(&_C_CHR);
    eval 'sub _C_UCHR () {ord(\'C\');}' unless defined(&_C_UCHR);
    eval 'sub _C_SHT () {ord(\'s\');}' unless defined(&_C_SHT);
    eval 'sub _C_USHT () {ord(\'S\');}' unless defined(&_C_USHT);
    eval 'sub _C_INT () {ord(\'i\');}' unless defined(&_C_INT);
    eval 'sub _C_UINT () {ord(\'I\');}' unless defined(&_C_UINT);
    eval 'sub _C_LNG () {ord(\'l\');}' unless defined(&_C_LNG);
    eval 'sub _C_ULNG () {ord(\'L\');}' unless defined(&_C_ULNG);
    eval 'sub _C_LNG_LNG () {ord(\'q\');}' unless defined(&_C_LNG_LNG);
    eval 'sub _C_ULNG_LNG () {ord(\'Q\');}' unless defined(&_C_ULNG_LNG);
    eval 'sub _C_FLT () {ord(\'f\');}' unless defined(&_C_FLT);
    eval 'sub _C_DBL () {ord(\'d\');}' unless defined(&_C_DBL);
    eval 'sub _C_BFLD () {ord(\'b\');}' unless defined(&_C_BFLD);
    eval 'sub _C_VOID () {ord(\'v\');}' unless defined(&_C_VOID);
    eval 'sub _C_UNDEF () {ord(\'?\');}' unless defined(&_C_UNDEF);
    eval 'sub _C_PTR () {ord(\'^\');}' unless defined(&_C_PTR);
    eval 'sub _C_CHARPTR () {ord(\'*\');}' unless defined(&_C_CHARPTR);
    eval 'sub _C_ATOM () {ord(\'%\');}' unless defined(&_C_ATOM);
    eval 'sub _C_ARY_B () {ord(\'[\');}' unless defined(&_C_ARY_B);
    eval 'sub _C_ARY_E () {ord(\']\');}' unless defined(&_C_ARY_E);
    eval 'sub _C_UNION_B () {ord(\'(\');}' unless defined(&_C_UNION_B);
    eval 'sub _C_UNION_E () {ord(\')\');}' unless defined(&_C_UNION_E);
    eval 'sub _C_STRUCT_B () {ord(\'{\');}' unless defined(&_C_STRUCT_B);
    eval 'sub _C_STRUCT_E () {ord(\'}\');}' unless defined(&_C_STRUCT_E);
    eval 'sub _C_VECTOR () {ord(\'!\');}' unless defined(&_C_VECTOR);
    eval 'sub OBJC_ERR_UNKNOWN () {0;}' unless defined(&OBJC_ERR_UNKNOWN);
    eval 'sub OBJC_ERR_OBJC_VERSION () {1;}' unless defined(&OBJC_ERR_OBJC_VERSION);
    eval 'sub OBJC_ERR_GCC_VERSION () {2;}' unless defined(&OBJC_ERR_GCC_VERSION);
    eval 'sub OBJC_ERR_MODULE_SIZE () {3;}' unless defined(&OBJC_ERR_MODULE_SIZE);
    eval 'sub OBJC_ERR_PROTOCOL_VERSION () {4;}' unless defined(&OBJC_ERR_PROTOCOL_VERSION);
    eval 'sub OBJC_ERR_MEMORY () {10;}' unless defined(&OBJC_ERR_MEMORY);
    eval 'sub OBJC_ERR_RECURSE_ROOT () {20;}' unless defined(&OBJC_ERR_RECURSE_ROOT);
    eval 'sub OBJC_ERR_BAD_DATA () {21;}' unless defined(&OBJC_ERR_BAD_DATA);
    eval 'sub OBJC_ERR_BAD_KEY () {22;}' unless defined(&OBJC_ERR_BAD_KEY);
    eval 'sub OBJC_ERR_BAD_CLASS () {23;}' unless defined(&OBJC_ERR_BAD_CLASS);
    eval 'sub OBJC_ERR_BAD_TYPE () {24;}' unless defined(&OBJC_ERR_BAD_TYPE);
    eval 'sub OBJC_ERR_NO_READ () {25;}' unless defined(&OBJC_ERR_NO_READ);
    eval 'sub OBJC_ERR_NO_WRITE () {26;}' unless defined(&OBJC_ERR_NO_WRITE);
    eval 'sub OBJC_ERR_STREAM_VERSION () {27;}' unless defined(&OBJC_ERR_STREAM_VERSION);
    eval 'sub OBJC_ERR_BAD_OPCODE () {28;}' unless defined(&OBJC_ERR_BAD_OPCODE);
    eval 'sub OBJC_ERR_UNIMPLEMENTED () {30;}' unless defined(&OBJC_ERR_UNIMPLEMENTED);
    eval 'sub OBJC_ERR_BAD_STATE () {40;}' unless defined(&OBJC_ERR_BAD_STATE);
    unless(defined(&HOST_BITS_PER_LONG)) {
	eval 'sub HOST_BITS_PER_LONG () {($sizeof{\'long\'}*8);}' unless defined(&HOST_BITS_PER_LONG);
    }
    eval 'sub __CLS_INFO {
        my($cls) = @_;
	    eval q((($cls)-> &info));
    }' unless defined(&__CLS_INFO);
    eval 'sub __CLS_ISINFO {
        my($cls, $mask) = @_;
	    eval q((( &__CLS_INFO($cls)$mask)==$mask));
    }' unless defined(&__CLS_ISINFO);
    eval 'sub __CLS_SETINFO {
        my($cls, $mask) = @_;
	    eval q(( &__CLS_INFO($cls) |= $mask));
    }' unless defined(&__CLS_SETINFO);
    eval 'sub _CLS_META () {0x2;}' unless defined(&_CLS_META);
    eval 'sub CLS_ISMETA {
        my($cls) = @_;
	    eval q((($cls) && &__CLS_ISINFO($cls,  &_CLS_META)));
    }' unless defined(&CLS_ISMETA);
    eval 'sub _CLS_CLASS () {0x1;}' unless defined(&_CLS_CLASS);
    eval 'sub CLS_ISCLASS {
        my($cls) = @_;
	    eval q((($cls) && &__CLS_ISINFO($cls,  &_CLS_CLASS)));
    }' unless defined(&CLS_ISCLASS);
    eval 'sub _CLS_RESOLV () {0x8;}' unless defined(&_CLS_RESOLV);
    eval 'sub CLS_ISRESOLV {
        my($cls) = @_;
	    eval q( &__CLS_ISINFO($cls,  &_CLS_RESOLV));
    }' unless defined(&CLS_ISRESOLV);
    eval 'sub CLS_SETRESOLV {
        my($cls) = @_;
	    eval q( &__CLS_SETINFO($cls,  &_CLS_RESOLV));
    }' unless defined(&CLS_SETRESOLV);
    eval 'sub _CLS_INITIALIZED () {0x4;}' unless defined(&_CLS_INITIALIZED);
    eval 'sub CLS_ISINITIALIZED {
        my($cls) = @_;
	    eval q( &__CLS_ISINFO($cls,  &_CLS_INITIALIZED));
    }' unless defined(&CLS_ISINITIALIZED);
    eval 'sub CLS_SETINITIALIZED {
        my($cls) = @_;
	    eval q( &__CLS_SETINFO($cls,  &_CLS_INITIALIZED));
    }' unless defined(&CLS_SETINITIALIZED);
    eval 'sub CLS_GETNUMBER {
        my($cls) = @_;
	    eval q(( &__CLS_INFO($cls) >> ( &HOST_BITS_PER_LONG/2)));
    }' unless defined(&CLS_GETNUMBER);
    eval 'sub CLS_SETNUMBER {
        my($cls, $num) = @_;
	    eval q(({ -> &info <<= ( &HOST_BITS_PER_LONG/2); -> &info >>= ( &HOST_BITS_PER_LONG/2);  &__CLS_SETINFO($cls, (($num) << ( &HOST_BITS_PER_LONG/2))); }));
    }' unless defined(&CLS_SETNUMBER);
    if(defined(&__NeXT__)) {
	eval 'sub object_copy () { &gnu_object_copy;}' unless defined(&object_copy);
	eval 'sub object_dispose () { &gnu_object_dispose;}' unless defined(&object_dispose);
    }
}
1;
