/* DO NOT EDIT THIS FILE - it is machine generated (JCGO_116) */

#ifdef JCGO_SEPARATED
#define JCGO_116
#include "jcgortl.h"
#include "Main.h"
#endif

#ifdef JCGO_116

#ifdef CHKALL_java_net_VMInetAddress
#include "jcgobchk.h"
#endif

JCGO_NOSEP_INLINE jint CFASTCALL
java_net_VMInetAddress__lookupInaddrAny0__( void )
{
#ifdef NOJAVA_java_net_VMInetAddress_lookupInaddrAny0
 jcgo_jniNoNativeFunc();
 return (jint)0;
#else
 jint jcgo_retval;
 JCGO_JNI_BLOCK(0)
 jcgo_retval= JCGO_JNI_FUNC(Java_java_net_VMInetAddress_lookupInaddrAny0)(jcgo_pJniEnv,
  (jclass)JCGO_JNI_TOLOCALREF(0, JCGO_CLASSREF_OF(java_net_VMInetAddress__class)));
 jcgo_jniLeave(jcgo_pJniEnv, NULL);
 return jcgo_retval;
#endif
}

JCGO_NOSEP_INLINE jbyteArr CFASTCALL
java_net_VMInetAddress__atonIPv6__Ls( java_lang_String address )
{
 {
  jbyteArr addr;
  jint len;
  jint pos;
  jint firstPos;
  jint j;
  jint value;
  jint zerosIndex;
  jboolean hasDigits;
  len= (JCGO_CALL_FINALF(address) java_lang_String__length__(
   address));
  if (len <= (jint)1)
  {
   return (jbyteArr)jnull;
  }
  pos= (java_lang_String__indexOf__II(
   address, (jchar)37/*'%'*/, 0));
  if (pos >= 0)
  {
   if (len - (jint)1 == pos)
   {
    return (jbyteArr)jnull;
   }
   len= pos;
  }
  pos= 0;
  if ((java_lang_String__charAt__I(
   address, 0)) == (jchar)58/*':'*/)
  {
   if ((java_lang_String__charAt__I(
    address, (jint)1)) != (jchar)58/*':'*/)
   {
    return (jbyteArr)jnull;
   }
   pos= (jint)1;
  }
  addr= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte), 0,
   (jint)16);
  firstPos= pos;
  j= 0;
  value= 0;
  zerosIndex= (-(jint)1);
  hasDigits= jfalse;
  while (pos < len)
  {
   jint digit;
   jchar ch;
   ch= (java_lang_String__charAt__I(
    address, pos++));
   digit= ch >= (jchar)48/*'0'*/ && ch <= (jchar)57/*'9'*/? (jint)ch -
    (jchar)48/*'0'*/ : ch >= (jchar)65/*'A'*/ && ch <= (jchar)70/*'F'*/?
    ch - ((jchar)65/*'A'*/ - (jint)10) : ch >= (jchar)97/*'a'*/ &&
    ch <= (jchar)102/*'f'*/? ch - ((jchar)97/*'a'*/ - (jint)10) : (-(jint)1);
   if (digit != (-(jint)1))
   {
    if (value > (jint)4095)
    {
     return (jbyteArr)jnull;
    }
    value= JCGO_SHL_F(value, (jint)4) | digit;
    hasDigits= (jboolean)jtrue;
   }
   else
   {
    if (ch != (jchar)58/*':'*/)
    {
     jbyteArr addrIPv4;
     if (ch != (jchar)46/*'.'*/ || j > (jint)12)
     {
      return (jbyteArr)jnull;
     }
     pos= (java_lang_String__indexOf__II(
      address, (jchar)46/*'.'*/, pos + (jint)1));
     if (pos < 0 || (pos= (java_lang_String__indexOf__II(
      address, (jchar)46/*'.'*/, pos + (jint)2))) < 0 || pos >= len)
     {
      return (jbyteArr)jnull;
     }
     addrIPv4= (java_net_VMInetAddress__atonIPv4__LsII(
      address, firstPos, len));
     if (addrIPv4 == jnull)
     {
      return (jbyteArr)jnull;
     }
     (java_lang_System__arraycopy__LoILoII(
      (java_lang_Object)addrIPv4, (java_lang_Object)addr, 0, j, (jint)4));
     hasDigits= (jboolean)jfalse;
     j+= (jint)4;
     break;
    }
    firstPos= pos;
    if (hasDigits)
    {
     if (pos == len || j > (jint)14)
     {
      return (jbyteArr)jnull;
     }
     JCGO_ARRAY_NZBACCESS(addr, j)= ((jbyte)JCGO_SHR_F(value, (jint)8));
     JCGO_ARRAY_NZBACCESS(addr, j + (jint)1)= ((jbyte)value);
     hasDigits= (jboolean)jfalse;
     j+= (jint)2;
     value= 0;
    }
    else
    {
     if (zerosIndex >= 0)
     {
      return (jbyteArr)jnull;
     }
     zerosIndex= j;
    }
   }
  }
  if (hasDigits)
  {
   if (j > (jint)14)
   {
    return (jbyteArr)jnull;
   }
   JCGO_ARRAY_NZBACCESS(addr, j)= ((jbyte)JCGO_SHR_F(value, (jint)8));
   JCGO_ARRAY_NZBACCESS(addr, j + (jint)1)= ((jbyte)value);
   j+= (jint)2;
  }
  if (zerosIndex >= 0)
  {
   if (j == (jint)16)
   {
    return (jbyteArr)jnull;
   }
   j-= zerosIndex;
   if (j > 0)
   {
    (java_lang_System__arraycopy__LoILoII(
     (java_lang_Object)addr, (java_lang_Object)addr, zerosIndex, (jint)16 -
     j, j));
    if (j > (jint)8)
    {
     j= (jint)16 - j;
    }
    while (j-- > 0)
    {
     JCGO_ARRAY_NZBACCESS(addr, zerosIndex++)= (jbyte)0;
    }
   }
  }
  else
  {
   if (j != (jint)16)
   {
    return (jbyteArr)jnull;
   }
  }
  return addr;
 }
}

JCGO_NOSEP_INLINE jint CFASTCALL
java_net_VMInetAddress__getHostNeedsSync0__( void )
{
#ifdef NOJAVA_java_net_VMInetAddress_getHostNeedsSync0
 jcgo_jniNoNativeFunc();
 return (jint)0;
#else
 jint jcgo_retval;
 JCGO_JNI_BLOCK(0)
 jcgo_retval= JCGO_JNI_FUNC(Java_java_net_VMInetAddress_getHostNeedsSync0)(jcgo_pJniEnv,
  (jclass)JCGO_JNI_TOLOCALREF(0, JCGO_CLASSREF_OF(java_net_VMInetAddress__class)));
 jcgo_jniLeave(jcgo_pJniEnv, NULL);
 return jcgo_retval;
#endif
}

JCGO_NOSEP_FRWINL jbyteArr CFASTCALL
java_net_VMInetAddress__lookupInaddrAny__( void )
{
 {
  jint address;
  jObject jcgo_rcvrL1;
  address= (java_net_VMInetAddress__lookupInaddrAny0__());
  return (jcgo_rcvrL1= jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
   0, 4),
   JCGO_ARR_INTERNALACC(jbyte, (jbyteArr)jcgo_rcvrL1, 0)= (jbyte)JCGO_SHR_F(address,
   (jint)24),
   JCGO_ARR_INTERNALACC(jbyte, (jbyteArr)jcgo_rcvrL1, 1)= (jbyte)JCGO_SHR_F(address,
   (jint)16),
   JCGO_ARR_INTERNALACC(jbyte, (jbyteArr)jcgo_rcvrL1, 2)= (jbyte)JCGO_SHR_F(address,
   (jint)8),
   JCGO_ARR_INTERNALACC(jbyte, (jbyteArr)jcgo_rcvrL1, 3)= (jbyte)address,
   (jbyteArr)jcgo_rcvrL1);
 }
}

JCGO_NOSEP_INLINE java_lang_String CFASTCALL
java_net_VMInetAddress__getHostByAddr__BA( jbyteArr ip )
{
 {
  java_lang_String hostname;
  if (ip == jnull)
  {
   JCGO_THROW_EXC(java_lang_NullPointerException__new__());
  }
  (java_net_VMInetAddress__initialize__());
  if (java_net_VMInetAddress__getHostLock != jnull)
  {
   {
    JCGO_SYNC_BLOCK(java_net_VMInetAddress__getHostLock)
    {
     hostname= (java_net_VMInetAddress__getHostByAddr0__BAI(
      ip, JCGO_ARRAY_NZLENGTH(ip)));
    }
    JCGO_SYNC_END
   }
  }
  else
  {
   hostname= (java_net_VMInetAddress__getHostByAddr0__BAI(
    ip, JCGO_ARRAY_NZLENGTH(ip)));
  }
  if (hostname == jnull || (java_lang_String__length__(
   hostname)) == 0)
  {
   JCGO_THROW_EXC(java_net_UnknownHostException__new__());
  }
  return hostname;
 }
}

JCGO_NOSEP_INLINE jObjectArr CFASTCALL
java_net_VMInetAddress__getHostByName__Ls( java_lang_String hostname
 )
{
 {
  jbyteArr ipAddrsBuf;
  jObjectArr addrs;
  jint count;
  jint pos;
  (java_net_VMInetAddress__initialize__());
  if ((JCGO_CALL_FINALF(hostname) java_lang_String__length__(
   hostname)) == 0 || (java_lang_String__charAt__I(
   hostname, 0)) <= (jchar)32/*' '*/)
  {
   JCGO_THROW_EXC((java_net_UnknownHostException__new__Ls(
    hostname)));
  }
  ;
  ipAddrsBuf= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
   0, (jint)40);
  do
  {
   jint res;
   if (java_net_VMInetAddress__getHostLock != jnull)
   {
    {
     JCGO_SYNC_BLOCK(java_net_VMInetAddress__getHostLock)
     {
      res= (java_net_VMInetAddress__getHostByName0__LsBAI(
       hostname, ipAddrsBuf, JCGO_ARRAY_LENGTH(ipAddrsBuf)));
     }
     JCGO_SYNC_END
    }
   }
   else
   {
    res= (java_net_VMInetAddress__getHostByName0__LsBAI(
     hostname, ipAddrsBuf, JCGO_ARRAY_LENGTH(ipAddrsBuf)));
   }
   if (res <= 0)
   {
    JCGO_THROW_EXC((java_net_UnknownHostException__new__Ls(
     hostname)));
   }
   pos= 0;
   for (count= 0; count < res; count++)
   {
    if (JCGO_ARRAY_NZLENGTH(ipAddrsBuf) <= pos)
    {
     break;
    }
    pos= ((jint)((unsigned char)(JCGO_ARRAY_NZBACCESS(ipAddrsBuf, pos)))) +
     pos + (jint)1;
   }
   if (count == res && JCGO_ARRAY_NZLENGTH(ipAddrsBuf) >= pos)
   {
    break;
   }
   ipAddrsBuf= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
    0, JCGO_SHL_F(JCGO_ARRAY_NZLENGTH(ipAddrsBuf), (jint)1));
  }
   while (jtrue);
  addrs= (jObjectArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte),
   1, count);
  pos= 0;
  {
   jint i;
   i= 0;
   for (; i < count; i++)
   {
    jbyteArr ip;
    jint iplen;
    iplen= (jint)((unsigned char)(JCGO_ARRAY_BACCESS(ipAddrsBuf, pos++)));
    ip= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte), 0,
     iplen);
    {
     jint j;
     j= 0;
     for (; j < iplen; j++)
     {
      jObject jcgo_rcvrL1;
      jint jcgo_rcvrI1;
      jbyte jcgo_rcvrB1;
      (jcgo_rcvrL1= (jObject)ip, jcgo_rcvrI1= j, jcgo_rcvrB1= JCGO_ARRAY_NZBACCESS(ipAddrsBuf,
       pos++), JCGO_ARRAY_NZBACCESS((jbyteArr)jcgo_rcvrL1, jcgo_rcvrI1)=
       jcgo_rcvrB1);
     }
    }
    *(jbyteArr*)&JCGO_ARRAY_NZLACCESS(addrs, i)= ip;
   }
  }
  return addrs;
 }
}

JCGO_NOSEP_FRWINL jbyteArr CFASTCALL
java_net_VMInetAddress__aton__Ls( java_lang_String address )
{
 {
  jbyteArr addr;
  jint len;
  addr= (jbyteArr)jnull;
  len= (JCGO_CALL_FINALF(address) java_lang_String__length__(
   address));
  if (len > 0)
  {
   jboolean isIPv6;
   isIPv6= jfalse;
   if ((java_lang_String__charAt__I(
    address, 0)) == (jchar)91/*'['*/)
   {
    if ((java_lang_String__charAt__I(
     address, len - (jint)1)) != (jchar)93/*']'*/)
    {
     return (jbyteArr)jnull;
    }
    address= (java_lang_String__substring__II(
     address, (jint)1, len - (jint)1));
    isIPv6= (jboolean)jtrue;
   }
   if (isIPv6 || (addr= (java_net_VMInetAddress__atonIPv4__LsII(
    address, 0, len))) == jnull)
   {
    addr= (java_net_VMInetAddress__atonIPv6__Ls(
     address));
   }
  }
  return addr;
 }
}

JCGO_NOSEP_STATIC jbyteArr CFASTCALL
java_net_VMInetAddress__atonIPv4__LsII( java_lang_String address,
 jint pos, jint endPos )
{
 {
  jint cnt;
  cnt= 0;
  {
   jint i;
   i= pos - (jint)1;
   for (; (i= (JCGO_CALL_FINALF(address) java_lang_String__indexOf__II(
    address, (jchar)46/*'.'*/, i + (jint)2))) >= 0; cnt++)
   {
    if (i >= endPos)
    {
     break;
    }
   }
  }
  if (cnt <= (jint)3)
  {
   jbyteArr addr;
   addr= (jbyteArr)jcgo_newArray(JCGO_CORECLASS_FOR(OBJT_jbyte), 0,
    (jint)4);
   {
    JCGO_TRY_BLOCK
    {
     {
      jint i;
      i= 0;
      for (; i < cnt; i++)
      {
       jint nextPos;
       jint value;
       nextPos= (java_lang_String__indexOf__II(
        address, (jchar)46/*'.'*/, pos + (jint)1));
       value= (java_net_VMInetAddress__parseUInt__LsII(
        address, pos, nextPos));
       if (JCGO_USHR_F(value, (jint)1) > (jint)127)
       {
#ifndef JCGO_SEHTRY
        jcgo_tryLeave();
#endif
        return (jbyteArr)jnull;
       }
       JCGO_ARRAY_NZBACCESS(addr, i)= ((jbyte)value);
       pos= nextPos + (jint)1;
      }
     }
     if (pos < endPos)
     {
      jint value;
      value= (java_net_VMInetAddress__parseUInt__LsII(
       address, pos, endPos));
      if (JCGO_USHR_F((-(jint)1), (JCGO_SHL_F(cnt, (jint)3) + (jint)1)) >=
       JCGO_USHR_F(value, (jint)1))
      {
       while (cnt < (jint)3)
       {
        JCGO_ARRAY_NZBACCESS(addr, cnt)= ((jbyte)JCGO_SHR_F(value,
         JCGO_SHL_F(((jint)3 - cnt), (jint)3)));
        cnt++;
       }
       JCGO_ARRAY_NZBACCESS(addr, (jint)3)= ((jbyte)value);
#ifndef JCGO_SEHTRY
       jcgo_tryLeave();
#endif
       return addr;
      }
     }
    }
    JCGO_TRY_LEAVE
    JCGO_TRY_CATCHES(1)
    JCGO_TRY_CATCH(OBJT_java_lang_NumberFormatException, MAXT_java_lang_NumberFormatException)
    {
    }
    JCGO_TRY_RETHROW(1)
   }
  }
  return (jbyteArr)jnull;
 }
}

JCGO_NOSEP_STATIC jint CFASTCALL
java_net_VMInetAddress__parseUInt__LsII( java_lang_String str, jint
 pos, jint endPos )
{
 {
  jint value;
  value= 0;
  do
  {
   jchar ch;
   ch= (JCGO_CALL_FINALF(str) java_lang_String__charAt__I(
    str, pos));
   if (ch < (jchar)48/*'0'*/ || ch > (jchar)57/*'9'*/ || value > JCGO_USHR_F((-(jint)1),
    (jint)1) / (jint)5 || ((value= value * (jint)10 + ((jint)ch - (jchar)48/*'0'*/)) >=
    0 && (jint)ch - (jchar)48/*'0'*/ > value))
   {
    JCGO_THROW_EXC(java_lang_NumberFormatException__new__());
   }
  }
   while (++pos < endPos);
  return value;
 }
}

JCGO_NOSEP_STATIC void CFASTCALL
java_net_VMInetAddress__initialize__( void )
{
 {
  if (!JCGO_VLT_FETCHZ(java_net_VMInetAddress__initialized))
  {
   (gnu_java_net_VMAccessorGnuJavaNet__socketsInitVMPlainSocketImpl__());
   if ((java_net_VMInetAddress__getHostNeedsSync0__()) != 0)
   {
    java_lang_Object obj;
    obj= java_lang_Object__new__();
    if (java_net_VMInetAddress__getHostLock == jnull)
    {
     java_net_VMInetAddress__getHostLock= obj;
    }
   }
   JCGO_VLT_STOREZ((&java_net_VMInetAddress__initialized), (jboolean)jtrue);
  }
 }
}

JCGO_NOSEP_STATIC java_lang_String CFASTCALL
java_net_VMInetAddress__getHostByAddr0__BAI( jbyteArr ip, jint iplen
 )
{
#ifdef NOJAVA_java_net_VMInetAddress_getHostByAddr0
 jcgo_jniNoNativeFunc();
 return jnull;
#else
 JCGO_JNI_BLOCK(1)
 return (java_lang_String)jcgo_jniLeave(jcgo_pJniEnv, (jobject)JCGO_JNI_FUNC(Java_java_net_VMInetAddress_getHostByAddr0)(jcgo_pJniEnv,
  (jclass)JCGO_JNI_TOLOCALREF(0, JCGO_CLASSREF_OF(java_net_VMInetAddress__class)),
  (jbyteArray)JCGO_JNI_TOLOCALREF(1, ip), iplen));
#endif
}

JCGO_NOSEP_STATIC jint CFASTCALL
java_net_VMInetAddress__getHostByName0__LsBAI( java_lang_String hostname,
 jbyteArr ipAddrsBuf, jint bufSize )
{
#ifdef NOJAVA_java_net_VMInetAddress_getHostByName0
 jcgo_jniNoNativeFunc();
 return (jint)0;
#else
 jint jcgo_retval;
 JCGO_JNI_BLOCK(2)
 jcgo_retval= JCGO_JNI_FUNC(Java_java_net_VMInetAddress_getHostByName0)(jcgo_pJniEnv,
  (jclass)JCGO_JNI_TOLOCALREF(0, JCGO_CLASSREF_OF(java_net_VMInetAddress__class)),
  (jstring)JCGO_JNI_TOLOCALREF(1, hostname), (jbyteArray)JCGO_JNI_TOLOCALREF(2,
  ipAddrsBuf), bufSize);
 jcgo_jniLeave(jcgo_pJniEnv, NULL);
 return jcgo_retval;
#endif
}

JCGO_NOSEP_DATA CONST struct jcgo_methods_s java_net_VMInetAddress_methods=
{
 JCGO_CLASSREF_OF(java_net_VMInetAddress__class),
 JCGO_GCJDESCR_ZEROINIT
 OBJT_java_net_VMInetAddress,
 0,
 NULL,
 JCGO_CLINIT_INIT(0)
 0
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_net_VMInetAddress_class_s
 java_net_VMInetAddress__class JCGO_THRD_ATTRNONGC=
{
 {
  &java_lang_Class_methods,
  JCGO_MON_INIT
  JCGO_OBJREF_OF(*(java_lang_Object)&java_net_VMInetAddress_methods),
  JCGO_STRREF_OF(jcgo_string1_VMIntAdd),
  JCGO_CLASSREF_OF(java_lang_Object__class),
  ((jObjectArr)JCGO_OBJREF_OF(jcgo_array3_Object)),
  0x10
 }
};

JCGO_NOSEP_GCDATA java_lang_Object java_net_VMInetAddress__getHostLock
 ATTRIBGCBSS= jnull;

JCGO_NOSEP_DATA JCGO_THRD_VOLATILE jboolean java_net_VMInetAddress__initialized=
 (jboolean)0;

JCGO_NOSEP_DATA CONST jcgo_arrtype44_GameShll jcgo_array2_VMIntAdd=
{
 (jvtable)&jbyteArr_methods,
 JCGO_MON_INIT
 22,
 {
  (jbyte)(jchar)106/*'j'*/, (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)118/*'v'*/,
   (jbyte)(jchar)97/*'a'*/, (jbyte)(jchar)46/*'.'*/, (jbyte)(jchar)110/*'n'*/,
   (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)116/*'t'*/, (jbyte)(jchar)46/*'.'*/,
   (jbyte)(jchar)86/*'V'*/, (jbyte)(jchar)77/*'M'*/, (jbyte)(jchar)73/*'I'*/,
   (jbyte)(jchar)110/*'n'*/, (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)116/*'t'*/,
   (jbyte)(jchar)65/*'A'*/, (jbyte)(jchar)100/*'d'*/, (jbyte)(jchar)100/*'d'*/,
   (jbyte)(jchar)114/*'r'*/, (jbyte)(jchar)101/*'e'*/, (jbyte)(jchar)115/*'s'*/,
   (jbyte)(jchar)115/*'s'*/
 }
};

JCGO_NOSEP_DATA JCGO_NOTHR_CONST struct java_lang_String_s jcgo_string1_VMIntAdd
 JCGO_THRD_ATTRNONGC=
{
 &java_lang_String_methods,
 JCGO_MON_INIT
 (java_lang_Object)JCGO_OBJREF_OF(jcgo_array2_VMIntAdd),
 0, 22, (jint)0xff93ea2cL
};

#ifdef CHKALL_java_net_VMInetAddress
#include "jcgochke.h"
#endif

#endif
