harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r350181 [179/198] - in /incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core: ./ depends/ depends/files/ depends/jars/ depends/libs/ depends/libs/linux.IA32/ depends/libs/win.IA32/ depends/oss/ depends/oss/linux.IA32/ depends/oss/win....
Date Thu, 01 Dec 2005 06:04:00 GMT
Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/helpers.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/helpers.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/helpers.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/helpers.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,35 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(helpers_h)
+#define helpers_h
+int platformReadLink (char *link);
+jbyteArray getPlatformPath (JNIEnv * env, jbyteArray path);
+void setDefaultServerSocketOptions (JNIEnv * env, hysocket_t socketP);
+jint getPlatformDatagramNominalSize (JNIEnv * env, hysocket_t socketP);
+I_32 getPlatformRoots (char *rootStrings);
+jstring getCustomTimeZoneInfo (JNIEnv * env, jintArray tzinfo,
+             jbooleanArray isCustomTimeZone);
+I_32 getPlatformIsHidden (JNIEnv * env, char *path);
+jint getPlatformDatagramMaxSize (JNIEnv * env, hysocket_t socketP);
+char *getCommports (JNIEnv * env);
+I_32 getPlatformIsWriteOnly (JNIEnv * env, char *path);
+I_32 setPlatformFileLength (JNIEnv * env, IDATA descriptor, jlong newLength);
+void platformCanonicalPath (char *pathCopy);
+I_32 getPlatformIsReadOnly (JNIEnv * env, char *path);
+void setPlatformBindOptions (JNIEnv * env, hysocket_t socketP);
+I_32 setPlatformLastModified (JNIEnv * env, char *path, I_64 time);
+I_32 setPlatformReadOnly (JNIEnv * env, char *path);
+#endif /* helpers_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.def
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.def?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.def (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.def Wed Nov 30 21:29:27 2005
@@ -0,0 +1,187 @@
+LIBRARY	HYLUNI
+
+SECTIONS
+	.data	READ WRITE
+	.text	EXECUTE READ
+
+EXPORTS
+	Java_com_ibm_oti_lang_ProcessInputStream_availableImpl
+	Java_com_ibm_oti_lang_ProcessInputStream_closeImpl
+	Java_com_ibm_oti_lang_ProcessInputStream_oneTimeInitialization
+	Java_com_ibm_oti_lang_ProcessInputStream_readImpl
+	Java_com_ibm_oti_lang_ProcessInputStream_setFDImpl
+	Java_com_ibm_oti_lang_ProcessOutputStream_closeImpl
+	Java_com_ibm_oti_lang_ProcessOutputStream_oneTimeInitialization
+	Java_com_ibm_oti_lang_ProcessOutputStream_setFDImpl
+	Java_com_ibm_oti_lang_ProcessOutputStream_writeImpl
+	Java_com_ibm_oti_lang_SystemProcess_closeImpl
+	Java_com_ibm_oti_lang_SystemProcess_createImpl
+	Java_com_ibm_oti_lang_SystemProcess_destroyImpl
+	Java_com_ibm_oti_lang_SystemProcess_oneTimeInitialization
+	Java_com_ibm_oti_lang_SystemProcess_waitForCompletionImpl
+	Java_com_ibm_oti_util_math_BigInteger_addImpl
+	Java_com_ibm_oti_util_math_BigInteger_compImpl
+	Java_com_ibm_oti_util_math_BigInteger_divImpl
+	Java_com_ibm_oti_util_math_BigInteger_mulImpl
+	Java_com_ibm_oti_util_math_BigInteger_negImpl
+	Java_com_ibm_oti_util_math_BigInteger_remImpl
+	Java_com_ibm_oti_util_math_BigInteger_shlImpl
+	Java_com_ibm_oti_util_math_BigInteger_subImpl
+	Java_java_io_File_deleteDirImpl
+	Java_java_io_File_deleteFileImpl
+	Java_java_io_File_existsImpl
+	Java_java_io_File_getCanonImpl
+	Java_java_io_File_getLinkImpl
+	Java_java_io_File_isAbsoluteImpl
+	Java_java_io_File_isCaseSensitiveImpl
+	Java_java_io_File_isDirectoryImpl
+	Java_java_io_File_isFileImpl
+	Java_java_io_File_isHiddenImpl
+	Java_java_io_File_isReadOnlyImpl
+	Java_java_io_File_isWriteOnlyImpl
+	Java_java_io_File_lastModifiedImpl
+	Java_java_io_File_lengthImpl
+	Java_java_io_File_listImpl
+	Java_java_io_File_mkdirImpl
+	Java_java_io_File_newFileImpl
+	Java_java_io_File_oneTimeInitialization
+	Java_java_io_File_properPathImpl
+	Java_java_io_File_renameToImpl
+	Java_java_io_File_rootsImpl
+	Java_java_io_File_setLastModifiedImpl
+	Java_java_io_File_setReadOnlyImpl
+	Java_java_io_FileDescriptor_oneTimeInitialization
+	Java_java_io_FileDescriptor_sync
+	Java_java_io_FileDescriptor_valid
+	Java_java_io_FileInputStream_available
+	Java_java_io_FileInputStream_closeImpl
+	Java_java_io_FileInputStream_oneTimeInitialization
+	Java_java_io_FileInputStream_openImpl
+	Java_java_io_FileInputStream_readByteImpl
+	Java_java_io_FileInputStream_readImpl
+	Java_java_io_FileInputStream_skip
+	Java_java_io_FileOutputStream_closeImpl
+	Java_java_io_FileOutputStream_oneTimeInitialization
+	Java_java_io_FileOutputStream_openImpl
+	Java_java_io_FileOutputStream_writeByteImpl
+	Java_java_io_FileOutputStream_writeImpl
+	Java_java_io_ObjectInputStream_newInstance
+	Java_java_io_ObjectInputStream_objSetField
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2B
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2C
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2D
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2F
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2I
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2J
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2S
+	Java_java_io_ObjectInputStream_setField__Ljava_lang_Object_2Ljava_lang_Class_2Ljava_lang_String_2Z
+	Java_java_io_ObjectOutputStream_getFieldBool
+	Java_java_io_ObjectOutputStream_getFieldByte
+	Java_java_io_ObjectOutputStream_getFieldChar
+	Java_java_io_ObjectOutputStream_getFieldDouble
+	Java_java_io_ObjectOutputStream_getFieldFloat
+	Java_java_io_ObjectOutputStream_getFieldInt
+	Java_java_io_ObjectOutputStream_getFieldLong
+	Java_java_io_ObjectOutputStream_getFieldObj
+	Java_java_io_ObjectOutputStream_getFieldShort
+	Java_java_io_ObjectStreamClass_getConstructorSignature
+	Java_java_io_ObjectStreamClass_getFieldSignature
+	Java_java_io_ObjectStreamClass_getMethodSignature
+	Java_java_io_ObjectStreamClass_hasClinit
+	Java_java_io_ObjectStreamClass_oneTimeInitialization
+	Java_java_io_RandomAccessFile_closeImpl
+	Java_java_io_RandomAccessFile_getFilePointer
+	Java_java_io_RandomAccessFile_length
+	Java_java_io_RandomAccessFile_oneTimeInitialization
+	Java_java_io_RandomAccessFile_openImpl
+	Java_java_io_RandomAccessFile_readByteImpl
+	Java_java_io_RandomAccessFile_readImpl
+	Java_java_io_RandomAccessFile_seek
+	Java_java_io_RandomAccessFile_setLengthImpl
+	Java_java_io_RandomAccessFile_writeByteImpl
+	Java_java_io_RandomAccessFile_writeImpl
+	Java_java_lang_Double_doubleToLongBits
+	Java_java_lang_Double_doubleToRawLongBits
+	Java_java_lang_Double_longBitsToDouble
+	Java_java_lang_Float_floatToIntBits
+	Java_java_lang_Float_floatToRawIntBits
+	Java_java_lang_Float_intBitsToFloat
+	Java_java_lang_Math_acos
+	Java_java_lang_Math_asin
+	Java_java_lang_Math_atan
+	Java_java_lang_Math_atan2
+	Java_java_lang_Math_ceil
+	Java_java_lang_Math_cos
+	Java_java_lang_Math_exp
+	Java_java_lang_Math_floor
+	Java_java_lang_Math_IEEEremainder
+	Java_java_lang_Math_log
+	Java_java_lang_Math_pow
+	Java_java_lang_Math_rint
+	Java_java_lang_Math_sin
+	Java_java_lang_Math_sqrt
+	Java_java_lang_Math_tan
+	Java_java_lang_reflect_Proxy_defineClassImpl
+	Java_java_lang_StrictMath_acos
+	Java_java_lang_StrictMath_asin
+	Java_java_lang_StrictMath_atan
+	Java_java_lang_StrictMath_atan2
+	Java_java_lang_StrictMath_ceil
+	Java_java_lang_StrictMath_cos
+	Java_java_lang_StrictMath_exp
+	Java_java_lang_StrictMath_floor
+	Java_java_lang_StrictMath_IEEEremainder
+	Java_java_lang_StrictMath_log
+	Java_java_lang_StrictMath_pow
+	Java_java_lang_StrictMath_rint
+	Java_java_lang_StrictMath_sin
+	Java_java_lang_StrictMath_sqrt
+	Java_java_lang_StrictMath_tan
+	Java_java_net_InetAddress_getAliasesByNameImpl
+	Java_java_net_InetAddress_getHostByAddrImpl
+	Java_java_net_InetAddress_getHostByNameImpl
+	Java_java_net_InetAddress_getHostNameImpl
+	Java_java_net_InetAddress_inetAddrImpl
+	Java_java_net_InetAddress_inetNtoaImpl
+	Java_java_net_InetAddress_oneTimeInitialization
+	Java_java_net_NetworkInterface_getNetworkInterfacesImpl
+	Java_java_net_PlainDatagramSocketImpl_connectDatagramImpl2
+	Java_java_net_PlainDatagramSocketImpl_createDatagramSocketImpl
+	Java_java_net_PlainDatagramSocketImpl_disconnectDatagramImpl
+	Java_java_net_PlainDatagramSocketImpl_oneTimeInitialization
+	Java_java_net_PlainDatagramSocketImpl_peekDatagramImpl
+	Java_java_net_PlainDatagramSocketImpl_receiveDatagramImpl2
+	Java_java_net_PlainDatagramSocketImpl_recvConnectedDatagramImpl
+	Java_java_net_PlainDatagramSocketImpl_sendConnectedDatagramImpl
+	Java_java_net_PlainDatagramSocketImpl_sendDatagramImpl2
+	Java_java_net_PlainDatagramSocketImpl_socketBindImpl2
+	Java_java_net_PlainMulticastSocketImpl_createMulticastSocketImpl
+	Java_java_net_PlainServerSocketImpl_createServerStreamSocketImpl
+	Java_java_net_PlainSocketImpl2_connectStreamSocketImpl2
+	Java_java_net_PlainSocketImpl2_connectStreamWithTimeoutSocketImpl2
+	Java_java_net_PlainSocketImpl2_createStreamSocketImpl2
+	Java_java_net_PlainSocketImpl2_sendDatagramImpl2
+	Java_java_net_PlainSocketImpl2_socketBindImpl2
+	Java_java_net_Socket_getSocketFlags
+	Java_java_net_Socket_getSocketLocalAddressImpl
+	Java_java_net_Socket_getSocketLocalPortImpl
+	Java_java_net_Socket_getSocketOptionImpl
+	Java_java_net_Socket_oneTimeInitialization
+	Java_java_net_Socket_setSocketOptionImpl
+	Java_java_net_Socket_socketCloseImpl
+	Java_java_net_SocketImpl_acceptStreamSocketImpl
+	Java_java_net_SocketImpl_availableStreamImpl
+	Java_java_net_SocketImpl_createDatagramSocketImpl
+	Java_java_net_SocketImpl_createStreamSocketImpl
+	Java_java_net_SocketImpl_listenStreamSocketImpl
+	Java_java_net_SocketImpl_oneTimeInitialization
+	Java_java_net_SocketImpl_receiveStreamImpl
+	Java_java_net_SocketImpl_sendStreamImpl
+	Java_java_net_SocketImpl_sendUrgentDataImpl
+	Java_java_net_SocketImpl_shutdownInputImpl
+	Java_java_net_SocketImpl_shutdownOutputImpl
+	Java_java_net_SocketImpl_supportsUrgentDataImpl
+	Java_java_util_TimeZone_getCustomTimeZone
+	JNI_OnLoad
+	JNI_OnUnload
+

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.rc
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.rc?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.rc (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/hyluni.rc Wed Nov 30 21:29:27 2005
@@ -0,0 +1,47 @@
+;
+; Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+; 
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+; 
+;     http://www.apache.org/licenses/LICENSE-2.0
+; 
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+
+#include <windows.h>
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,1,0,0
+ PRODUCTVERSION 0,1,0,0
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE 0x0L
+BEGIN
+	BLOCK "StringFileInfo"
+	BEGIN
+		BLOCK "040904b0"
+		BEGIN
+			VALUE "CompanyName", "The Apache Software Foundation.\0"
+			VALUE "FileDescription", "LUNI native code\0"
+			VALUE "FileVersion", "0.1\0"
+			VALUE "InternalName", "luni\0"
+			VALUE "LegalCopyright", "(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.\0"
+			VALUE "OriginalFilename", "hyluni.dll\0"
+			VALUE "ProductName", "Apache Harmony\0"
+			VALUE "ProductVersion", "0.1\0"
+		END
+	END
+	BLOCK "VarFileInfo"
+	BEGIN
+		VALUE "Translation", 0x0409, 1200
+	END
+END

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/inetadds.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/inetadds.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/inetadds.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/inetadds.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,312 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include "jclprots.h"
+#include "nethelp.h"
+#include "portsock.h"
+#include "jclglob.h"
+
+/**
+ * Answer the aliases for the nominated host name.  Useful for multihomed hosts.
+ *
+ * @param env     pointer to the JNI library
+ * @param clazz   the class of the object invoking the JNI function
+ * @param aName   the host name string object
+ *
+ * @return  an array of InetAddress's
+ */
+
+jobjectArray JNICALL
+Java_java_net_InetAddress_getAliasesByNameImpl (JNIEnv * env, jclass clazz,
+            jstring aName)
+{
+  PORT_ACCESS_FROM_ENV (env);
+  jobjectArray aliases;
+  hyaddrinfo_struct addrinfo;
+  hyaddrinfo_t hints;
+  U_32 result;
+
+  const char *str = (*env)->GetStringUTFChars (env, aName, 0);
+  if (NULL == str)
+    {
+      return NULL;
+    }
+
+  if (!preferIPv4Stack (env))
+    {
+      hysock_getaddrinfo_create_hints (&hints, (I_16) HYADDR_FAMILY_UNSPEC, 0,
+               HYPROTOCOL_FAMILY_UNSPEC, 0);
+    }
+  else
+    {
+      hysock_getaddrinfo_create_hints (&hints, (I_16) HYADDR_FAMILY_AFINET4,
+               0, HYPROTOCOL_FAMILY_UNSPEC, 0);
+    }
+  result = hysock_getaddrinfo ((char *) str, hints, &addrinfo);
+  if (result != 0)
+    {
+      (*env)->ReleaseStringUTFChars (env, aName, str);
+      throwJavaNetUnknownHostException (env, result);
+      return NULL;
+    }
+
+  aliases = createAliasArrayFromAddrinfo (env, &addrinfo, (char *) str);
+  hysock_freeaddrinfo (&addrinfo);
+  (*env)->ReleaseStringUTFChars (env, aName, str);
+  return aliases;
+}
+
+/**
+ * Answer the InetAddress for the nominated host, performing a name lookup
+ * to find the name the host is known by in the network.
+ * Note, unlike the unix getHostByAddr call, the addr argument in the function parameter list 
+ * is a 32-bit address value rather than a dotted IP string.
+ *
+ * @param env     pointer to the JNI library
+ * @param clazz   the class of the object invoking the JNI function
+ * @param addr      the host address (integer, in host order)
+ *
+ * @return  the InetAddress representing the host
+ */
+jobject JNICALL
+Java_java_net_InetAddress_getHostByAddrImpl (JNIEnv * env, jclass clazz,
+               jbyteArray addr)
+{
+  PORT_ACCESS_FROM_ENV (env);
+  I_32 result = 0;
+  hysockaddr_struct in_addr;
+  U_32 length;
+  char hostName[OSNIMAXHOST];
+  jbyte ipaddr[HYSOCK_INADDR6_LEN];
+  int address_family = HYADDR_FAMILY_AFINET4;
+  length = (*env)->GetArrayLength (env, addr);
+
+  /* If it's a valid length for an IP address then do the work */
+  if (length == HYSOCK_INADDR6_LEN || length == HYSOCK_INADDR_LEN)
+    {
+      if (length == HYSOCK_INADDR6_LEN)
+        {
+          address_family = HYADDR_FAMILY_AFINET6;
+        }
+
+      (*env)->GetByteArrayRegion (env, addr, 0, length, ipaddr);
+      hysock_sockaddr_init6 (&in_addr, (U_8 *) ipaddr, length,
+        (I_16) address_family, 0, 0, 0, NULL);
+      result =
+        hysock_getnameinfo (&in_addr, sizeof (in_addr.addr), hostName,
+        OSNIMAXHOST, 0);
+      if (0 == result)
+        {
+          return newJavaNetInetAddressGenericBS (env, ipaddr, length,
+            hostName, 0);
+        }
+    }
+
+  throwJavaNetUnknownHostException (env, result);
+  return NULL;
+}
+
+/**
+ * Answer the InetAddress for the nominated host, performing a name lookup
+ * to find the network address.
+ *
+ * @param env     pointer to the JNI library
+ * @param clazz   the class of the object invoking the JNI function
+ * @param aName   the host name
+ * @param preferIPv6Addresses on V4/V6 nodes, a preference as to which address to return for the node
+ * @return  the InetAddress representing the host
+ */
+
+jobject JNICALL
+Java_java_net_InetAddress_getHostByNameImpl (JNIEnv * env, jclass clazz,
+               jstring aName,
+               jboolean preferIPv6Addresses)
+{
+  PORT_ACCESS_FROM_ENV (env);
+  I_32 result;
+  jbyte nipAddr[HYSOCK_INADDR6_LEN];
+  jobject inetA;
+  const char *str = (*env)->GetStringUTFChars (env, aName, 0);
+  hyaddrinfo_struct addrinfo;
+  hyaddrinfo_t hints;
+  U_32 length = 0;
+  I_32 family;
+  U_32 scope_id = 0;
+  I_32 i = 0;
+  I_32 addrLength = 0;
+  BOOLEAN preferIPv4StackValue = preferIPv4Stack (env);
+
+  if (NULL == str)
+    {
+      return NULL;
+    }
+  if (!preferIPv4StackValue)
+    {
+      hysock_getaddrinfo_create_hints (&hints, (I_16) HYADDR_FAMILY_UNSPEC, 0,
+               HYPROTOCOL_FAMILY_UNSPEC, 0);
+    }
+  else
+    {
+      hysock_getaddrinfo_create_hints (&hints, (I_16) HYADDR_FAMILY_AFINET4,
+               0, HYPROTOCOL_FAMILY_UNSPEC, 0);
+    }
+  result = hysock_getaddrinfo ((char *) str, hints, &addrinfo);
+
+  if (result != 0)
+    {
+      (*env)->ReleaseStringUTFChars (env, aName, str);
+      throwJavaNetUnknownHostException (env, result);
+      return NULL;
+    }
+
+  /* now loop through the addresses returned and return the first one that matches the preference indicated */
+  hysock_getaddrinfo_length (&addrinfo, &addrLength);
+  for (i = 0; i < addrLength; i++)
+    {
+      hysock_getaddrinfo_family (&addrinfo, &family, i);
+      if (((family == HYADDR_FAMILY_AFINET4)
+        && ((preferIPv6Addresses == FALSE) || preferIPv4StackValue))
+        || ((family == HYADDR_FAMILY_AFINET6)
+        && (preferIPv6Addresses == TRUE) && (!preferIPv4StackValue)))
+        {
+          /* ok found one that matches the preference so get the required info */
+          hysock_getaddrinfo_address (&addrinfo, (U_8 *) nipAddr, i,
+            &scope_id);
+          break;
+        }
+    }
+
+  /* check if there was no match for the preferIPv6Addresses.  If not just return the first one */
+  if (i == addrLength)
+    {
+      hysock_getaddrinfo_family (&addrinfo, &family, 0);
+      hysock_getaddrinfo_address (&addrinfo, (U_8 *) nipAddr, 0, &scope_id);
+    }
+
+  hysock_freeaddrinfo (&addrinfo);
+
+  length =
+    (family ==
+     HYPROTOCOL_FAMILY_INET4) ? HYSOCK_INADDR_LEN : HYSOCK_INADDR6_LEN;
+
+  inetA =
+    newJavaNetInetAddressGenericBS (env, nipAddr, length, (char *) str,
+            scope_id);
+
+  (*env)->ReleaseStringUTFChars (env, aName, str);
+  return inetA;
+}
+
+/**
+ * Answer the string name for the local host.
+ *
+ * @param env     pointer to the JNI library
+ * @param clazz   the class of the object invoking the JNI function
+ *
+ * @return  the local host name
+ */
+
+jstring JNICALL
+Java_java_net_InetAddress_getHostNameImpl (JNIEnv * env, jclass clazz)
+{
+
+  PORT_ACCESS_FROM_ENV (env);
+  char buf[64];
+  I_32 result = hysock_gethostname (buf, sizeof (buf));
+
+  if (0 != result)
+    {
+      throwJavaNetUnknownHostException (env, result);
+      return NULL;
+    }
+  else
+    {
+      return (*env)->NewStringUTF (env, buf);
+    }
+}
+
+/**
+ * Answer the network address for the nominated dotted ip string.
+ *
+ * @param env     pointer to the JNI library
+ * @param clazz   the class of the object invoking the JNI function
+ * @param host      the dotted ip string to be converted
+ *
+ * @return  the network address
+ */
+
+jint JNICALL
+Java_java_net_InetAddress_inetAddrImpl (JNIEnv * env, jclass clazz,
+          jstring host)
+{
+  PORT_ACCESS_FROM_ENV (env);
+  I_32 result;
+  U_32 nipAddr;
+  const char *strHost = (*env)->GetStringUTFChars (env, host, 0);
+
+  if (NULL == strHost)
+    {
+      return (jint) NULL;
+    }
+  result = hysock_inetaddr ((char *) strHost, &nipAddr);  /* Resolve the dotted ip string to an address */
+  (*env)->ReleaseStringUTFChars (env, host, strHost);
+  if (0 != result)
+    {
+      throwJavaNetUnknownHostException (env, result);
+      return (jint) NULL;
+    }
+  return (jint) hysock_ntohl (nipAddr);
+}
+
+/**
+ * Answer the dotted ip string for the nominated network address.
+ *
+ * @param env     pointer to the JNI library
+ * @param clazz   the class of the object invoking the JNI function
+ * @param hostAddr  the network address to be converted
+ *
+ * @return  the dotted ip string
+ */
+
+jstring JNICALL
+Java_java_net_InetAddress_inetNtoaImpl (JNIEnv * env, jclass clazz,
+          jint hipAddr)
+{
+
+  PORT_ACCESS_FROM_ENV (env);
+  I_32 result;
+  U_32 nipAddr;
+  char *strHost;
+
+  nipAddr = hysock_htonl ((I_32) hipAddr);
+  result = hysock_inetntoa (&strHost, nipAddr);
+  if (0 != result)
+    {
+      throwJavaLangIllegalArgumentException (env, result);
+      return NULL;
+    }
+  else
+    {
+      return (*env)->NewStringUTF (env, strHost);
+    }
+}
+
+void JNICALL
+Java_java_net_InetAddress_oneTimeInitialization (JNIEnv * env, jclass clazz,
+             jboolean ipv6_support)
+{
+  netInitializeIDCaches (env, ipv6_support);
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/jclglob.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/jclglob.h?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/jclglob.h (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/jclglob.h Wed Nov 30 21:29:27 2005
@@ -0,0 +1,79 @@
+/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if !defined(jclglob_h)
+#define jclglob_h
+#include "jcl.h"
+extern void *LUNI_JCL_ID_CACHE;
+#define JCL_ID_CACHE LUNI_JCL_ID_CACHE
+typedef struct LUNIJniIDCache
+{
+
+  jfieldID FID_java_io_RandomAccessFile_fd;
+  jfieldID FID_java_io_FileDescriptor_descriptor;
+  jfieldID FID_java_io_FileInputStream_fd;
+  jfieldID FID_java_io_FileOutputStream_fd;
+  jfieldID FID_com_ibm_oti_lang_ProcessInputStream_handle;
+  jfieldID FID_com_ibm_oti_lang_ProcessInputStream_fd;
+  jfieldID FID_com_ibm_oti_lang_ProcessOutputStream_handle;
+  jfieldID FID_com_ibm_oti_lang_ProcessOutputStream_fd;
+  jfieldID FID_com_ibm_oti_lang_SystemProcess_handle;
+  jfieldID FID_java_net_SocketImpl_address;
+  jfieldID FID_java_net_SocketImpl_port;
+  jfieldID FID_java_net_DatagramPacket_length;
+  jfieldID FID_java_net_DatagramPacket_address;
+  jfieldID FID_java_net_DatagramPacket_port;
+  jfieldID FID_java_lang_ClassLoader_vmRef;
+  jfieldID FID_com_ibm_oti_vm_MemorySpace;
+  /* Used by ObjectStreamClass */
+  jmethodID MID_java_lang_reflect_Field_getSignature;
+  jmethodID MID_java_lang_reflect_Method_getSignature;
+  jmethodID MID_java_lang_reflect_Constructor_getSignature;
+  /* Used by shared net helpers */
+  jmethodID MID_java_lang_Boolean_init;
+  jmethodID MID_java_lang_Byte_init;
+  jmethodID MID_java_lang_Integer_init;
+  jmethodID MID_java_net_InetAddress_init_byteArray;
+  jmethodID MID_java_net_InetAddress_init_byteArrayLjava_lang_String;
+  jmethodID MID_java_lang_Thread_yield;
+  jmethodID MID_java_net_InetAddress_getByAddress_Ljava_lang_String_byteArray;
+  jmethodID MID_java_net_InetAddress_getByAddress_byteArray;
+  jmethodID MID_java_net_InetAddress_preferIPv6Addresses;
+  jmethodID MID_java_net_Socket_preferIPv4Stack;
+  jclass CLS_java_lang_Boolean;
+  jclass CLS_java_lang_Byte;
+  jclass CLS_java_lang_Integer;
+  jclass CLS_java_lang_Thread;
+  jclass CLS_java_net_InetAddress;
+  jclass CLS_java_net_Socket;
+  jfieldID FID_java_lang_Boolean_value;
+  jfieldID FID_java_lang_Byte_value;
+  jfieldID FID_java_lang_Integer_value;
+  jfieldID FID_java_net_InetAddress_address;
+  jclass CLS_array_of_byte;
+  char **realPortArray;
+  char **synthPortArray;
+  int portListLen;
+
+  jboolean jcl_supports_ipv6;
+} LUNIJniIDCache;
+#define JniIDCache LUNIJniIDCache
+/* Now that the module-specific defines are in place, include the shared file */
+#include "libglob.h"
+/* all UNIX platforms */
+#if defined(LINUX)
+#include "hysignal.h"
+#endif /* UNIX */
+#endif /* jclglob_h */

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luni_copyright.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luni_copyright.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luni_copyright.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luni_copyright.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,19 @@
+/* Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* A copyright string included in each DLL and executable */
+
+const char hyCopyright[] =
+  "(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.";

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luniglob.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luniglob.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luniglob.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/luniglob.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,617 @@
+/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include "jcl.h"
+#include "jclglob.h"
+
+static UDATA keyInitCount = 0;
+
+void *JCL_ID_CACHE = NULL;
+
+/* props_file_entry */
+
+#include "hypool.h"
+
+/**
+  * A structure that captures a single key-value setting from the properties file.
+  */
+typedef struct props_file_entry
+{
+  char *key;        /**< The key as it appears in the properties file */
+  char *value;      /**< The value as it appears in the properties file */
+} props_file_entry;
+
+static jint readClassPathFromPropertiesFile (JavaVM * vm);
+static jint decodeProperty (HyPortLibrary * portLibrary, char **scanCursor,
+          HyPool * properties);
+static jint readPropertiesFile (HyPortLibrary * portLibrary, char *filename,
+        HyPool * properties);
+static char *concat (HyPortLibrary * portLibrary, ...);
+static void freeReferences (JNIEnv * env);
+
+/**
+ * This DLL is being loaded, do any initialization required.
+ * This may be called more than once.
+ */
+jint JNICALL
+JNI_OnLoad (JavaVM * vm, void *reserved)
+{
+  JniIDCache *idCache;
+  JNIEnv *env;
+  void *keyInitCountPtr = GLOBAL_DATA (keyInitCount);
+  void **jclIdCache = GLOBAL_DATA (JCL_ID_CACHE);
+  jint rcBpInit;
+
+#if defined(LINUX)
+  /* all UNIX platforms */
+  HySignalHandler previousGpHandler;
+  HySigSet (SIGPIPE, SIG_IGN, previousGpHandler);
+#endif
+
+  if ((*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_2) == JNI_OK)
+    {
+      PORT_ACCESS_FROM_ENV (env);
+
+      if (HY_VMLS_FNTBL (env)->
+        HYVMLSAllocKeys (env, keyInitCountPtr, jclIdCache, NULL))
+        {
+          goto fail;
+        }
+
+      idCache = (JniIDCache *) hymem_allocate_memory (sizeof (JniIDCache));
+      if (!idCache)
+        goto fail2;
+
+      memset (idCache, 0, sizeof (JniIDCache));
+      HY_VMLS_SET (env, *jclIdCache, idCache);
+
+      JCL_CACHE_SET (env, realPortArray, NULL);
+      JCL_CACHE_SET (env, synthPortArray, NULL);
+      JCL_CACHE_SET (env, portListLen, 0);
+
+      /* Attach to the common library */
+      if (JNI_OK != ClearLibAttach (env))
+        {
+          goto fail2;
+        }
+
+      /* Initialize bootstrap classpath */
+      rcBpInit = readClassPathFromPropertiesFile (vm);
+      if (JNI_OK != rcBpInit)
+        {
+          goto fail2;
+        }
+
+      return JNI_VERSION_1_2;
+    }
+
+fail2:
+  HY_VMLS_FNTBL (env)->HYVMLSFreeKeys (env, keyInitCountPtr, jclIdCache, NULL);
+fail:
+  return 0;
+}
+
+/**
+ * This DLL is being unloaded, do any clean up required.
+ * This may be called more than once!!
+ */
+void JNICALL
+JNI_OnUnload (JavaVM * vm, void *reserved)
+{
+  JNIEnv *env;
+  void *keyInitCountPtr = GLOBAL_DATA (keyInitCount);
+  void **jclIdCache = GLOBAL_DATA (JCL_ID_CACHE);
+
+  int i, listlen;
+  char **portArray, **portArray2;
+
+  if ((*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_2) == JNI_OK)
+    {
+      JniIDCache *idCache = (JniIDCache *) HY_VMLS_GET (env, *jclIdCache);
+
+      if (idCache)
+        {
+          PORT_ACCESS_FROM_ENV (env);
+
+          /* Detach from the common library */
+          ClearLibDetach (env);
+
+          /*free the arrays of available portnames */
+          portArray = JCL_CACHE_GET (env, realPortArray);
+          if (portArray != NULL)
+            {
+              portArray2 = JCL_CACHE_GET (env, synthPortArray);
+              listlen = JCL_CACHE_GET (env, portListLen);
+              for (i = 0; i < listlen; i++)
+                {
+                  if (portArray[i] != NULL)
+                    hymem_free_memory (portArray[i]);
+                  if (portArray2[i] != NULL)
+                    hymem_free_memory (portArray2[i]);
+                }
+              hymem_free_memory (portArray);
+              hymem_free_memory (portArray2);
+              JCL_CACHE_SET (env, realPortArray, NULL);
+              JCL_CACHE_SET (env, synthPortArray, NULL);
+              JCL_CACHE_SET (env, portListLen, 0);
+            }
+
+          /* Free any global references */
+          freeReferences (env);
+
+          /* Free VMLS keys */
+          idCache = (JniIDCache *) HY_VMLS_GET (env, *jclIdCache);
+          HY_VMLS_FNTBL (env)->HYVMLSFreeKeys (env, keyInitCountPtr,
+            jclIdCache, NULL);
+          hymem_free_memory (idCache);
+        }
+    }
+}
+
+/**
+ * Concatenates a variable number of null-terminated strings into a single string
+ * using the specified port library to allocate memory.  The variable number of
+ * strings arguments must be terminated by a single NULL value.
+ *
+ * @param portLibrary - The port library used to allocate memory.
+ * @return The concatenated string.
+ */
+
+static char *
+concat (HyPortLibrary * portLibrary, ...)
+{
+  PORT_ACCESS_FROM_PORT (portLibrary);
+  va_list argp;
+  char *concatenated;
+  UDATA concatenatedSize = 0;
+
+  /* Walk the variable arguments once to compute the final size */
+  va_start (argp, portLibrary);
+  while (1)
+    {
+      char *chunk = va_arg (argp, char *);
+      if (chunk)
+        {
+          concatenatedSize += strlen (chunk);
+        }
+      else
+        {
+          break;
+        }
+    }
+  va_end (argp);
+
+  /* Allocate concatenated space */
+  concatenated =
+    hymem_allocate_memory (concatenatedSize + 1 /* for null terminator */ );
+  if (!concatenated)
+    {
+      return NULL;
+    }
+  concatenated[0] = '\0';
+
+  /* Walk again concatenating the pieces */
+  va_start (argp, portLibrary);
+  while (1)
+    {
+      char *chunk = va_arg (argp, char *);
+      if (chunk)
+        {
+          strcat (concatenated, chunk);
+        }
+      else
+        {
+          break;
+        }
+    }
+  va_end (argp);
+
+  return concatenated;
+}
+
+/**
+  * Read the properties file specified by <tt>filename</tt> into the pool of <tt>properties</tt>.
+  *
+  * @param portLibrary - The port library used to interact with the platform.
+  * @param filename - The file from which to read data using hyfile* functions.
+  * @param properties - A pool that will contain property file entries.
+  *
+  * @return JNI_OK on success, or a JNI error code on failure.
+  */
+static jint
+readPropertiesFile (HyPortLibrary * portLibrary, char *filename,
+        HyPool * properties)
+{
+  PORT_ACCESS_FROM_PORT (portLibrary);
+  IDATA propsFD = -1;
+  I_64 seekResult;
+  IDATA fileSize;
+  IDATA bytesRemaining;
+  jint returnCode = JNI_OK;
+  char *fileContents = NULL;
+  char *writeCursor;
+  char *scanCursor, *scanLimit;
+
+  /* Determine the file size, fail if > 2G */
+  seekResult = hyfile_length (filename);
+  if ((seekResult <= 0) || (seekResult > 0x7FFFFFFF))
+    {
+      return JNI_ERR;
+    }
+  fileSize = (IDATA) seekResult;
+
+  /* Open the properties file */
+  propsFD = hyfile_open (filename, (I_32) HyOpenRead, (I_32) 0);
+  if (propsFD == -1)
+    {
+      /* Could not open the file */
+      return JNI_ERR;
+    }
+
+  /* Allocate temporary storage */
+  fileContents = hymem_allocate_memory (fileSize);
+  if (!fileContents)
+    {
+      return JNI_ENOMEM;
+    }
+
+  /* Initialize the read state */
+  bytesRemaining = fileSize;
+  writeCursor = fileContents;
+
+  /* Suck the file into memory */
+  while (bytesRemaining > 0)
+    {
+      IDATA bytesRead = hyfile_read (propsFD, writeCursor, bytesRemaining);
+      if (bytesRead == -1)
+        {
+          /* Read failed */
+          returnCode = JNI_ERR;
+          goto bail;
+        }
+
+      /* Advance the read state */
+      bytesRemaining -= bytesRead;
+      writeCursor += bytesRead;
+    }
+
+  /* Set up scan and limit points */
+  scanCursor = fileContents;
+  scanLimit = fileContents + fileSize;
+
+  /* Now crack the properties */
+  while (scanCursor < scanLimit)
+    {
+      /* Decode a property and advance the scan cursor */
+      int numberDecoded = decodeProperty (PORTLIB, &scanCursor, properties);
+
+      /* Bail if we encounter an error */
+      if (numberDecoded < 0)
+        {
+          returnCode = JNI_ENOMEM;
+          break;
+        }
+    }
+
+bail:
+  if (propsFD != -1)
+    {
+      hyfile_close (propsFD);
+    }
+  if (fileContents)
+    {
+      hymem_free_memory (fileContents);
+    }
+
+  return returnCode;
+}
+
+/**
+   * Scans the buffer specified by scanCursor and attempts to locate the next
+  *  key-value pair separated by the '=' sign, and terminated by the platform line
+  * delimiter.
+  * 
+  * If a key-value pair is located a new props_file_entry structure will be allocated in
+  * the <tt>properties</tt> pool, and the key and value will be copied.  The scanCursor
+  * will be advanced past the entire property entry on success.
+  *
+  *
+  * @param portLibrary - The port library used to interact with the platform.
+  * @param scanCursor - A null-terminated string containing one or more (or partial) properties.
+  * @param properties - A pool from which props_file_entry structures are allocated.
+  *
+  * @return The number of properties read, -1 on error.
+  * @note This function modifies the buffer as properties are consumed.
+  */
+static jint
+decodeProperty (HyPortLibrary * portLibrary, char **scanCursor,
+    HyPool * properties)
+{
+  PORT_ACCESS_FROM_PORT (portLibrary);
+  props_file_entry *property;
+  int keyLength, valueLength;
+  char *equalSign;
+  char *lineDelimiter;
+  char *propertyBuffer = *scanCursor;
+
+  lineDelimiter = strstr (propertyBuffer, PLATFORM_LINE_DELIMITER);
+  if (lineDelimiter)
+    {
+      /* Hammer the line delimiter to be a null */
+      *lineDelimiter = '\0';
+      *scanCursor = lineDelimiter + strlen (PLATFORM_LINE_DELIMITER);
+    }
+  else
+    {
+      /* Assume the entire text is a single token */
+      *scanCursor = propertyBuffer + strlen (propertyBuffer) - 1;
+    }
+
+  /* Now find the '=' character */
+  equalSign = strchr (propertyBuffer, '=');
+  if (!equalSign)
+    {
+      /* Malformed, assume it's a comment and move on */
+      return 0;
+    }
+
+  /* Allocate a new pool entry */
+  property = pool_newElement (properties);
+  if (!property)
+    {
+      return 0;
+    }
+
+  /* Compute the key length and allocate memory */
+  keyLength = equalSign - propertyBuffer;
+  property->key =
+    hymem_allocate_memory (keyLength + 1 /* for null terminator */ );
+  if (!property->key)
+    {
+      goto bail;
+    }
+
+  /* Compute the value length and allocate memory */
+  memcpy (property->key, propertyBuffer, keyLength);
+  property->key[keyLength] = '\0';
+
+  /* Compute the value length and allocate memory */
+  valueLength = strlen (propertyBuffer) - keyLength - 1 /* for equal sign */ ;
+  property->value =
+    hymem_allocate_memory (valueLength + 1 /* for null terminator */ );
+  if (!property->value)
+    {
+      goto bail;
+    }
+
+  /* Compute the value length and allocate memory */
+  memcpy (property->value, equalSign + 1, valueLength);
+  property->value[valueLength] = '\0';
+
+  /* Advance the scan cursor */
+  return 1;
+
+bail:
+  if (property != NULL)
+    {
+      if (property->key)
+        {
+          hymem_free_memory (property->key);
+        }
+      if (property->value)
+        {
+          hymem_free_memory (property->value);
+        }
+      pool_removeElement (properties, property);
+    }
+
+  return -1;
+}
+
+/**
+ * Initializes the bootstrap classpath used by the VM with entries suitable for this
+ * class library configuration.  Stores the result into a system property named
+ * 'com.ibm.oti.system.class.path'.
+ *
+ * Reads the bootclasspath.properties file a line at a time 
+ *
+ * @param vm - The JavaVM from which port library and VMI interfaces can be obtained.
+ *
+ * @return - JNI_OK on success.
+ */
+static jint
+readClassPathFromPropertiesFile (JavaVM * vm)
+{
+  VMInterface *vmInterface;
+  HyPortLibrary *privatePortLibrary;
+  char *javaHome;
+  char bootDirectory[HyMaxPath];
+  char propsFile[HyMaxPath];
+  char cpSeparator[2];
+  char *bootstrapClassPath = NULL;
+  vmiError rcGetProperty;
+  jint returnCode = JNI_OK;
+  IDATA propsFD = -1;
+  HyPool *properties;
+
+  /* Query the VM interface */
+  vmInterface = VMI_GetVMIFromJavaVM (vm);
+  if (!vmInterface)
+    {
+      return JNI_ERR;
+    }
+
+  /* Extract the port library */
+  privatePortLibrary = (*vmInterface)->GetPortLibrary (vmInterface);
+  if (!privatePortLibrary)
+    {
+      return JNI_ERR;
+    }
+
+  /* Make a string version of the CP separator */
+  cpSeparator[0] = (char)hysysinfo_get_classpathSeparator ();
+  cpSeparator[1] = '\0';
+
+  /* Load the java.home system property */
+  rcGetProperty =
+    (*vmInterface)->GetSystemProperty (vmInterface, "java.home", &javaHome);
+  if (VMI_ERROR_NONE != rcGetProperty)
+    {
+      return JNI_ERR;
+    }
+
+  /* Locate the boot directory in ${java.home}\lib\boot */
+  strcpy (bootDirectory, javaHome);
+
+  /* Tack on a trailing separator if needed */
+  if (bootDirectory[strlen (javaHome) - 1] != DIR_SEPARATOR)
+    {
+      strcat (bootDirectory, DIR_SEPARATOR_STR);
+    }
+
+  /* Now tack on the lib/boot portion */
+  strcat (bootDirectory, "lib");
+  strcat (bootDirectory, DIR_SEPARATOR_STR);
+  strcat (bootDirectory, "boot");
+  strcat (bootDirectory, DIR_SEPARATOR_STR);
+
+  /* Build up the location of the properties file relative to java.home */
+  propsFile[0] = '\0';
+  strcat (propsFile, bootDirectory);
+  strcat (propsFile, "bootclasspath.properties");
+
+  /* Create a pool to hold onto properties */
+  properties =
+    pool_new (sizeof (props_file_entry), 0, 0, 0, POOL_FOR_PORT (PORTLIB));
+  if (!properties)
+    {
+      returnCode = JNI_ENOMEM;
+      goto cleanup;
+    }
+
+  /* Pull the properties into the pool */
+  if (JNI_OK == readPropertiesFile (PORTLIB, propsFile, properties))
+    {
+      pool_state poolState;
+
+      props_file_entry *property = pool_startDo (properties, &poolState);
+      while (property)
+        {
+          int digit;
+          int tokensScanned =
+            sscanf (property->key, "bootclasspath.%d", &digit);
+
+          /* Ignore anything except bootclasspath.<digit> */
+          if (tokensScanned == 1)
+            {
+
+              /* The first and subsequent entries are handled slightly differently */
+              if (bootstrapClassPath)
+                {
+                  char *oldPath = bootstrapClassPath;
+                  bootstrapClassPath =
+                    concat (PORTLIB, bootstrapClassPath, cpSeparator,
+                    bootDirectory, property->value, NULL);
+                  hymem_free_memory (oldPath);
+                }
+              else
+                {
+                  bootstrapClassPath =
+                    concat (PORTLIB, "", bootDirectory, property->value,
+                    NULL);
+                }
+
+              if (!bootstrapClassPath)
+                {
+                  returnCode = JNI_ENOMEM;  /* bail - memory allocate must have failed */
+                  break;
+                }
+            }
+
+          /* Advance to next element */
+          property = (props_file_entry *) pool_nextDo (&poolState);
+        }
+    }
+
+cleanup:
+
+  /* Free the properties pool (remember to free structure elements) */
+  if (properties)
+    {
+      pool_state poolState;
+      props_file_entry *property = pool_startDo (properties, &poolState);
+
+      while (property)
+        {
+          if (property->key)
+            {
+              hymem_free_memory (property->key);
+            }
+          if (property->value)
+            {
+              hymem_free_memory (property->value);
+            }
+          property = (props_file_entry *) pool_nextDo (&poolState);
+        }
+      pool_kill (properties);
+    }
+
+  /* Commit the full bootstrap class path into the VMI */
+  if (bootstrapClassPath)
+    {
+      vmiError rcSetProperty = (*vmInterface)->SetSystemProperty (vmInterface,
+        "com.ibm.oti.system.class.path",
+        bootstrapClassPath);
+      if (VMI_ERROR_NONE != rcSetProperty)
+        {
+          returnCode = JNI_ERR;
+        }
+      hymem_free_memory (bootstrapClassPath);
+    }
+
+  return returnCode;
+
+}
+
+/**
+ * @internal
+ */
+static void
+freeReferences (JNIEnv * env)
+{
+  jclass classRef;
+
+  /* clean up class references */
+  classRef = JCL_CACHE_GET (env, CLS_java_lang_Boolean);
+  if (classRef)
+    (*env)->DeleteWeakGlobalRef (env, (jweak) classRef);
+
+  classRef = JCL_CACHE_GET (env, CLS_java_lang_Byte);
+  if (classRef)
+    (*env)->DeleteWeakGlobalRef (env, (jweak) classRef);
+
+  classRef = JCL_CACHE_GET (env, CLS_java_lang_Integer);
+  if (classRef)
+    (*env)->DeleteWeakGlobalRef (env, (jweak) classRef);
+
+  classRef = JCL_CACHE_GET (env, CLS_java_net_InetAddress);
+  if (classRef)
+    (*env)->DeleteWeakGlobalRef (env, (jweak) classRef);
+
+  classRef = JCL_CACHE_GET (env, CLS_array_of_byte);
+  if (classRef)
+    (*env)->DeleteWeakGlobalRef (env, (jweak) classRef);
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/makefile
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/makefile?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/makefile (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/makefile Wed Nov 30 21:29:27 2005
@@ -0,0 +1,91 @@
+# Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Makefile for module 'luni'
+#
+
+APPVER=4.0
+TARGETOS=WIN95
+_WIN32_IE=0x0500
+SEHMAP = TRUE
+!include <win32.mak>
+
+DLLFILENAME=hyluni.dll# declaration
+
+DLLNAME=..\hyluni.dll# declaration
+
+LIBNAME=hyluni# declaration
+
+LIBPATH=..\lib\# declaration
+
+.c.obj:
+	$(cc) -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 $(cflags) -D_MT -D_DLL -MD -D_WINSOCKAPI_ -DWIN32 -Ogityb1 -Gs -GF -Zm400 -WX -Zi  /I..\include /I..\luni /I..\common /I..\zlib /I..\zip /I..\fdlibm  $(VMDEBUG) $*.c
+
+.cpp.obj:
+	$(cc) -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 $(cflags) -D_MT -D_DLL -MD -D_WINSOCKAPI_ -DWIN32 -Ogityb1 -Gs -GF -Zm400 -WX -Zi  /I..\include /I..\luni /I..\common /I..\zlib /I..\zip /I..\fdlibm  $(VMDEBUG) $*.cpp
+
+.asm.obj:
+	ml /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd  $(VMASMDEBUG) -DWIN32  $<
+
+.rc.res:
+	rc -I..\include $<
+
+BUILDFILES1 = luni_copyright.obj file.obj procimpl.obj oos.obj fileis.obj
+BUILDFILES2 = simpl.obj psimpl2.obj nethelp.obj floatbits.obj rafile.obj
+BUILDFILES3 = ois.obj helpers.obj math.obj luniglob.obj proxy.obj
+BUILDFILES4 = netif.obj process.obj bigint.obj osc.obj socket.obj
+BUILDFILES5 = inetadds.obj pssimpl.obj filedesc.obj timezone.obj pmsimpl.obj
+BUILDFILES6 = pdsimpl.obj fileos.obj
+
+VIRTFILES1 = hyluni.res
+
+SYSLIBFILES1 = ws2_32.lib Iphlpapi.lib
+
+MDLLIBFILES1 = ..\lib\hycommon.lib ..\lib\hysig.lib ..\lib\hyzip.lib ..\lib\hyzlib.lib
+MDLLIBFILES2 = ..\lib\hypool.lib ..\lib\hyfdlibm.lib ..\lib\hythr.lib ..\lib\vmi.lib
+
+all: \
+	 ..\lib\$(LIBNAME).lib $(DLLNAME)
+
+BUILDLIB: $(LIBPATH)$(LIBNAME).lib
+
+$(LIBPATH)$(LIBNAME).lib:\
+	$(BUILDFILES1) $(BUILDFILES2) $(BUILDFILES3) $(BUILDFILES4) $(BUILDFILES5) \
+	$(BUILDFILES6) $(VIRTFILES1) $(MDLLIBFILES1) $(MDLLIBFILES2) 
+	$(implib) /NOLOGO -subsystem:windows -out:$(LIBPATH)$(LIBNAME).lib -def:$(LIBNAME).def -machine:$(CPU) \
+	$(BUILDFILES1) $(BUILDFILES2) $(BUILDFILES3) $(BUILDFILES4) $(BUILDFILES5) \
+	$(BUILDFILES6) $(VIRTFILES1) $(MDLLIBFILES1) $(MDLLIBFILES2) 
+
+
+$(DLLNAME): $(LIBPATH)$(LIBNAME).lib \
+	$(BUILDFILES1) $(BUILDFILES2) $(BUILDFILES3) $(BUILDFILES4) $(BUILDFILES5) \
+	$(BUILDFILES6) $(VIRTFILES1) $(MDLLIBFILES1) $(MDLLIBFILES2) 
+	link $(VMLINK) /debug /opt:icf /opt:ref /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup@12 -dll /BASE:0x13200000 -machine:$(CPU) \
+	/comment:"LUNI component native code. (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable." \
+	-subsystem:windows -out:$(DLLNAME) -map:$(LIBNAME).map  \
+	$(BUILDFILES1) $(BUILDFILES2) $(BUILDFILES3) $(BUILDFILES4) $(BUILDFILES5) \
+	$(BUILDFILES6) $(VIRTFILES1) $(MDLLIBFILES1) $(MDLLIBFILES2) $(SYSLIBFILES1)  \
+	kernel32.lib  ws2_32.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib  $(LIBPATH)$(LIBNAME).exp
+
+clean:
+	-del *.map
+	-del *.obj
+	-del *.res
+	-del *.pdb
+	-del ..\lib\$(LIBNAME).lib
+	-del ..\lib\$(LIBNAME).exp
+	-del ..\$(LIBNAME).pdb
+	-del $(DLLNAME)
+	

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/math.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/math.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/math.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/luni/math.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,373 @@
+/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "jni.h"
+/* #include "fltconst.h" */
+#include "fdlibm.h"
+
+jdouble internal_ceil (jdouble arg1);
+jdouble internal_log (jdouble arg1);
+jdouble internal_cos (jdouble arg1);
+jdouble internal_pow (jdouble arg1, jdouble arg2);
+jdouble internal_sqrt (jdouble arg1);
+void traceCall (char *name, double *arg1, double *arg2, double *result);
+jdouble internal_atan (jdouble arg1);
+jdouble internal_atan2 (jdouble arg1, jdouble arg2);
+jdouble internal_asin (jdouble arg1);
+jdouble internal_IEEEremainder (jdouble arg1, jdouble arg2);
+jdouble internal_floor (jdouble arg1);
+jdouble internal_acos (jdouble arg1);
+jdouble internal_exp (jdouble arg1);
+jdouble internal_tan (jdouble arg1);
+jdouble internal_sin (jdouble arg1);
+jdouble internal_rint (jdouble arg1);
+
+extern scaleUpDouble (double *, int);
+
+jdouble
+internal_acos (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_acos (arg1);
+
+  return result;
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_acos (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_acos (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_acos (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_acos (arg1);
+}
+
+jdouble
+internal_asin (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_asin (arg1);
+
+  return result;
+}
+
+jdouble
+internal_atan (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_atan (arg1);
+
+  return result;
+}
+
+jdouble
+internal_atan2 (jdouble arg1, jdouble arg2)
+{
+  jdouble result;
+
+  result = fdlibm_atan2 (arg1, arg2);
+
+  return result;
+}
+
+jdouble
+internal_ceil (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_ceil (arg1);
+
+  return result;
+}
+
+jdouble
+internal_cos (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_cos (arg1);
+
+  return result;
+}
+
+jdouble
+internal_exp (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_exp (arg1);
+
+  return result;
+}
+
+jdouble
+internal_floor (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_floor (arg1);
+
+  return result;
+}
+
+jdouble
+internal_IEEEremainder (jdouble arg1, jdouble arg2)
+{
+  jdouble result;
+
+  result = fdlibm_remainder (arg1, arg2);
+
+  return result;
+}
+
+jdouble
+internal_log (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_log (arg1);
+
+  return result;
+}
+
+jdouble
+internal_pow (jdouble arg1, jdouble arg2)
+{
+  jdouble result;
+
+  result = fdlibm_pow (arg1, arg2);
+
+  return result;
+}
+
+jdouble
+internal_rint (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_rint (arg1);
+
+  return result;
+}
+
+jdouble
+internal_sin (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_sin (arg1);
+
+  return result;
+}
+
+jdouble
+internal_sqrt (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_sqrt (arg1);
+
+  return result;
+}
+
+jdouble
+internal_tan (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_tan (arg1);
+
+  return result;
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_asin (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_asin (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_asin (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_asin (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_atan (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_atan (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_atan (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_atan (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_atan2 (JNIEnv * env, jclass jclazz, jdouble arg1,
+         jdouble arg2)
+{
+  return internal_atan2 (arg1, arg2);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_atan2 (JNIEnv * env, jclass jclazz, jdouble arg1,
+         jdouble arg2)
+{
+  return internal_atan2 (arg1, arg2);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_ceil (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_ceil (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_ceil (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_ceil (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_cos (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_cos (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_cos (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_cos (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_exp (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_exp (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_exp (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_exp (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_floor (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_floor (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_floor (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_floor (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_IEEEremainder (JNIEnv * env, jclass jclazz,
+           jdouble arg1, jdouble arg2)
+{
+  return internal_IEEEremainder (arg1, arg2);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_IEEEremainder (JNIEnv * env, jclass jclazz, jdouble arg1,
+           jdouble arg2)
+{
+  return internal_IEEEremainder (arg1, arg2);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_log (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_log (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_log (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_log (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_pow (JNIEnv * env, jclass jclazz, jdouble arg1,
+             jdouble arg2)
+{
+  return internal_pow (arg1, arg2);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_pow (JNIEnv * env, jclass jclazz, jdouble arg1,
+       jdouble arg2)
+{
+  return internal_pow (arg1, arg2);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_rint (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_rint (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_rint (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_rint (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_sin (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_sin (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_sin (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_sin (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_sqrt (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_sqrt (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_sqrt (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_sqrt (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_StrictMath_tan (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_tan (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_tan (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_tan (arg1);
+}



Mime
View raw message