harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r350181 [185/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/nio/OSMemoryWin32.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/OSMemoryWin32.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/OSMemoryWin32.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/OSMemoryWin32.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,62 @@
+/* Copyright 2004 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.
+ */
+
+/*
+ * Common natives supporting the memory system interface.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "OSMemory.h"
+
+JNIEXPORT jboolean JNICALL Java_com_ibm_platform_OSMemory_isLittleEndianImpl
+  (JNIEnv * env, jclass clazz)
+{
+  return JNI_TRUE;
+}
+
+JNIEXPORT jint JNICALL Java_com_ibm_platform_OSMemory_getPointerSizeImpl
+  (JNIEnv * env, jclass clazz)
+{
+#if defined(_WIN64)
+  return 8;
+#else
+  return 4;
+#endif
+
+}
+
+JNIEXPORT jlong JNICALL Java_com_ibm_platform_OSMemory_getAddress
+  (JNIEnv * env, jobject thiz, jlong address)
+{
+#if defined(_WIN64)
+  return *(POINTER_64) address;
+#else
+  return (jlong) * (long *) address;
+#endif
+
+}
+
+JNIEXPORT void JNICALL Java_com_ibm_platform_OSMemory_setAddress
+  (JNIEnv * env, jobject thiz, jlong address, jlong value)
+{
+#if defined(_WIN64)
+  *(POINTER_64) address = value;
+#else
+  *(long *) address = (long) value;
+#endif
+
+}
+

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.def
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.def?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.def (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.def Wed Nov 30 21:29:27 2005
@@ -0,0 +1,38 @@
+LIBRARY	HYNIO
+
+SECTIONS
+	.data	READ WRITE
+	.text	EXECUTE READ
+
+EXPORTS
+	Java_com_ibm_platform_OSFileSystem_readDirectImpl
+	Java_com_ibm_platform_OSFileSystem_writeDirectImpl
+	Java_com_ibm_platform_OSFileSystem_readImpl
+	Java_com_ibm_platform_OSFileSystem_seekImpl
+	Java_com_ibm_platform_OSFileSystem_fflushImpl
+	Java_com_ibm_platform_OSFileSystem_closeImpl
+	Java_com_ibm_platform_OSFileSystem_mmapImpl
+	Java_com_ibm_platform_OSFileSystem_lockImpl
+	Java_com_ibm_platform_OSFileSystem_unlockImpl
+	Java_com_ibm_platform_OSMemory_isLittleEndianImpl
+	Java_com_ibm_platform_OSMemory_getPointerSizeImpl
+	Java_com_ibm_platform_OSMemory_getAddress
+	Java_com_ibm_platform_OSMemory_setAddress
+	Java_com_ibm_platform_OSMemory_malloc
+	Java_com_ibm_platform_OSMemory_free
+	Java_com_ibm_platform_OSMemory_memmove
+	Java_com_ibm_platform_OSMemory_memset
+	Java_com_ibm_platform_OSMemory_getByteArray
+	Java_com_ibm_platform_OSMemory_setByteArray
+	Java_com_ibm_platform_OSMemory_getByte
+	Java_com_ibm_platform_OSMemory_setByte
+	Java_com_ibm_platform_OSMemory_getShort
+	Java_com_ibm_platform_OSMemory_setShort
+	Java_com_ibm_platform_OSMemory_getInt
+	Java_com_ibm_platform_OSMemory_setInt
+	Java_com_ibm_platform_OSMemory_getLong
+	Java_com_ibm_platform_OSMemory_setLong
+	Java_com_ibm_platform_OSMemory_getFloat
+	Java_com_ibm_platform_OSMemory_setFloat
+	Java_com_ibm_platform_OSMemory_getDouble
+	Java_com_ibm_platform_OSMemory_setDouble

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.rc
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.rc?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.rc (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/hynio.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", "NIO native code\0"
+			VALUE "FileVersion", "0.1\0"
+			VALUE "InternalName", "hynio\0"
+			VALUE "LegalCopyright", "(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.\0"
+			VALUE "OriginalFilename", "hynio.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/nio/makefile
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/makefile?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/makefile (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/makefile Wed Nov 30 21:29:27 2005
@@ -0,0 +1,85 @@
+# 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 'nio'
+#
+
+APPVER=4.0
+TARGETOS=WIN95
+SEHMAP = TRUE
+!include <win32.mak>
+
+DLLFILENAME=hynio.dll# declaration
+
+DLLNAME=..\hynio.dll# declaration
+
+LIBNAME=hynio# 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 -Zi -WX  /I..\include /I..\nio /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 -Zi -WX /I..\include /I..\nio /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 = nio_copyright.obj OSFileSystemWin32.obj OSFileSystem.obj OSMemoryWin32.obj OSMemory.obj
+
+VIRTFILES1 = hynio.res
+
+SYSLIBFILES1 = ws2_32.lib Iphlpapi.lib
+
+MDLLIBFILES1 = ..\lib\hysig.lib ..\lib\hycommon.lib
+MDLLIBFILES2 = ..\lib\hyfdlibm.lib ..\lib\hythr.lib ..\lib\vmi.lib
+
+all: \
+	 ..\lib\$(LIBNAME).lib $(DLLNAME)
+	
+BUILDLIB: $(LIBPATH)$(LIBNAME).lib
+
+$(LIBPATH)$(LIBNAME).lib:\
+	$(BUILDFILES1) $(VIRTFILES1) \
+	$(MDLLIBFILES1) $(MDLLIBFILES2) 
+	$(implib) /NOLOGO -subsystem:windows -out:$(LIBPATH)$(LIBNAME).lib -def:$(LIBNAME).def -machine:$(CPU) \
+	$(BUILDFILES1) $(VIRTFILES1) \
+	$(MDLLIBFILES1) $(MDLLIBFILES2) 
+
+
+$(DLLNAME): $(LIBPATH)$(LIBNAME).lib \
+	$(BUILDFILES1) $(VIRTFILES1) \
+	$(MDLLIBFILES1) $(MDLLIBFILES2) 
+	link $(VMLINK) /debug /opt:icf /opt:ref /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup@12 -dll /BASE:0x13300000 -machine:$(CPU) \
+	/comment:"NIO component native code. (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable." \
+	-subsystem:windows -out:$(DLLNAME) -map:$(LIBNAME).map  \
+	$(BUILDFILES1) $(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/nio/nio_copyright.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/nio_copyright.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/nio_copyright.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/nio/nio_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/pool/DoxygenSupport.txt
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/DoxygenSupport.txt?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/DoxygenSupport.txt (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/DoxygenSupport.txt Wed Nov 30 21:29:27 2005
@@ -0,0 +1,26 @@
+/* Copyright 1998, 2004 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.
+ */
+
+/*
+ * This file provides the group definitions required to create the Doxygen generated
+ * output for compounds.  There is one group per directory (port, pool, thread, etc.).
+ */
+ 
+/**
+ * @defgroup Pool Pool
+ * @brief Provides primitives  for creation, iteration, and deletion of pools of (arbitrary) elements.
+ */
+
+

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/makefile
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/makefile?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/makefile (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/makefile Wed Nov 30 21:29:27 2005
@@ -0,0 +1,48 @@
+# 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 'pool'
+#
+
+APPVER=4.0
+TARGETOS=WIN95
+_WIN32_IE=0x0500
+SEHMAP = TRUE
+!include <win32.mak>
+
+LIBNAME=hypool.lib# declaration
+
+LIBPATH=..\lib\# declaration
+
+BUILDFILES1 = pool.obj pool_cap.obj
+
+.c.obj:
+	$(cc) -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 $(cflags) -D_MT -D_DLL -MD -D_WINSOCKAPI_ -DWIN32 -Ogityb1 -Gs -GF -Zm400 -WX -Zi -Fd$(LIBPATH)hypool.pdb /I..\include  $(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 -Fd$(LIBPATH)hypool.pdb /I..\include  $(VMDEBUG) $*.cpp
+
+.asm.obj:
+	ml /c /Cp /W3 /nologo /coff /Zm /Zd /Zi /Gd $(VMASMDEBUG) -DWIN32  $<
+
+all: $(LIBPATH)$(LIBNAME)
+
+$(LIBPATH)$(LIBNAME): $(BUILDFILES1) 
+	$(implib) /NOLOGO -out:$(LIBPATH)$(LIBNAME) $(BUILDFILES1)
+
+clean:
+	-del *.obj
+	-del $(LIBPATH)$(LIBNAME)
+	-del $(LIBPATH)hypool.pdb

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,586 @@
+/* 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.
+ */
+
+/**
+ * @file
+ * @ingroup Pool
+ * @brief Pool primitives (creation, iteration, deletion, etc.)
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "hypool.h"
+
+#define ROUND_TO(granularity, number) ( (((number) % (granularity)) ? ((number) + (granularity) - ((number) % (granularity))) : (number)))
+
+#define MIN_GRANULARITY	sizeof(UDATA)
+
+#define MALLOC_ALIGNMENT sizeof(UDATA)
+
+/* read this if a port library call becomes available that gives out the OS page size */
+#if 0
+#define OS_PAGE_SIZE (EsGetAddressSpacePageSize())
+#else
+#define OS_PAGE_SIZE 4096
+#endif
+
+/**
+ * @section pool_new
+ * @fn pool_new(U_32 structSize, U_32 minNumberElements, U_32 elementAlignment, UDATA poolFlags, void *(VMCALL * memAlloc) (void *, U_32), void (VMCALL * memFree) (void *, void *), void *userData)
+ *	Returns a handle to a variable sized pool of structures.
+ *	This handle should be passed into all other pool functions.
+ *
+ * @param[in] structSize Size of the pool-elements
+ * @param[in] minNumberElements If zero, will default to 1
+ * @param[in] elementAlignment If zero will default to MIN_GRANULARITY
+ * @param[in] poolFlags
+ * @param[in] memAlloc Allocate function pointer
+ * @param[in] memFree Free function pointer
+ * @param[in] userData
+ *
+ * @return pointer to a new pool
+*/
+HyPool *VMCALL
+pool_new (U_32 structSize, U_32 minNumberElements, U_32 elementAlignment,
+	  UDATA poolFlags, void *(VMCALL * memAlloc) (void *, U_32),
+	  void (VMCALL * memFree) (void *, void *), void *userData)
+{
+  U_64 roundedStructSize, tempAllocSize, finalAllocSize;
+  U_32 finalNumberOfElements, tempNumElems;
+  UDATA freeLocation, *oldFreeLocation;
+  HyPool *newHandle;
+
+  if (minNumberElements == 0)
+    {
+      minNumberElements = 1;
+    }
+
+  if (elementAlignment == 0)
+    {
+      elementAlignment = MIN_GRANULARITY;
+    }
+
+  roundedStructSize = ROUND_TO (elementAlignment, structSize);
+
+  tempAllocSize = roundedStructSize * minNumberElements
+    + ROUND_TO (elementAlignment, sizeof (HyPool))
+    + (elementAlignment - MALLOC_ALIGNMENT);
+  finalAllocSize = ROUND_TO (OS_PAGE_SIZE, tempAllocSize);
+  finalNumberOfElements = minNumberElements;
+  finalNumberOfElements +=
+    (U_32)((finalAllocSize - tempAllocSize) / roundedStructSize);
+
+  /* 
+   * finalAllocSize is a U_64 so that we can detect pool sizes which overflow 32-bits. 
+   */
+  if (finalAllocSize > (U_64) 0xFFFFFFFF)
+    {
+      return NULL;
+    }
+
+  newHandle = memAlloc (userData, (UDATA) finalAllocSize);
+
+  if (newHandle)
+    {
+      memset ((void *) newHandle, 0, (size_t) finalAllocSize);
+      newHandle->elementSize = (UDATA)roundedStructSize;
+      newHandle->alignment = (U_16) elementAlignment;	/* we assume no alignment is > 64k */
+      newHandle->flags = poolFlags | POOL_SORTED;	/* list starts sorted */
+      newHandle->numberOfElements = finalNumberOfElements;
+      newHandle->usedElements = 0;
+      newHandle->firstElementAddress = (void *) ROUND_TO (elementAlignment,
+							  ((UDATA) newHandle)
+							  + sizeof (HyPool));
+      newHandle->firstFreeSlot = (UDATA *) newHandle->firstElementAddress;
+      newHandle->activePuddle = newHandle;
+      newHandle->nextPool = NULL;
+      newHandle->memAlloc = memAlloc;
+      newHandle->memFree = memFree;
+      newHandle->userData = userData;
+
+      /* now stuff the free list pointers in */
+      freeLocation = (UDATA) newHandle->firstElementAddress;
+      tempNumElems = newHandle->numberOfElements;
+      while (tempNumElems--)
+	{
+	  oldFreeLocation = (UDATA *) freeLocation;
+	  freeLocation += (UDATA)roundedStructSize;
+	  *oldFreeLocation = freeLocation;
+	}
+      *oldFreeLocation = 0;	/* end of list */
+    }
+  return newHandle;
+}
+
+/**
+ * @fn pool_kill(HyPool * aPool)
+ *	Deallocates all memory associated with a pool.
+ *
+ * @param[in] aPool Pool to be deallocated
+ *
+ * @return none
+ *
+*/
+void VMCALL
+pool_kill (HyPool * aPool)
+{
+  HyPool *tmpPool;
+
+  while (aPool)
+    {
+      tmpPool = aPool;
+      aPool = aPool->nextPool;
+      tmpPool->memFree (tmpPool->userData, tmpPool);
+    }
+}
+
+/**
+ * @fn pool_newElement (HyPool * aPool)
+ *	Asks for the address of a new pool element.
+ *	If it succeeds, the address returned will have space for
+ *	one element of the correct structure size.
+ *	The contents of the element are undefined.
+ *	If the current pool is full, a new one will be grafted onto the
+ *	end of the pool chain and memory from there will be used.
+ *
+ * @param[in] aPool
+ *
+ * @return NULL on error
+ * @return pointer to a new element otherwise
+ *
+*/
+void *VMCALL
+pool_newElement (HyPool * aPool)
+{
+  void *newElement = NULL;
+  BOOLEAN searchedActive = FALSE;
+  HyPool *head = aPool;
+
+  aPool = head->activePuddle;	/* peek at current active puddle */
+  while (aPool)
+    {
+      if (aPool->firstFreeSlot != NULL)
+	{
+	  newElement = aPool->firstFreeSlot;
+	  aPool->firstFreeSlot = (UDATA *) * ((UDATA *) newElement);
+	  aPool->usedElements += 1;
+	  /* if we were sorted before getting the new element, the free list is still in order afterwards.  If not,
+	     it's unlikely to have become sorted.  Thus, the POOL_SORTED bit should only be flipped in
+	     pool_removeElement. */
+	  head->activePuddle = aPool;	/* sets to most recently active puddle */
+	  break;
+	}
+      else if (!searchedActive)
+	{			/* allocate a new pool to flow into */
+	  searchedActive = TRUE;
+	  aPool = head;		/* no space in active puddle - walk the chain from the head */
+	}
+      else
+	{
+	  if (aPool->nextPool)
+	    {
+	      aPool = aPool->nextPool;
+	    }
+	  else
+	    {
+	      aPool->nextPool =
+		pool_new (aPool->elementSize, aPool->numberOfElements,
+			  aPool->alignment, aPool->flags, aPool->memAlloc,
+			  aPool->memFree, aPool->userData);
+	      if (!(aPool->nextPool))
+		return NULL;
+	      aPool = aPool->nextPool;	/* let the next iteration do the address calc. */
+	    }
+	}
+    }
+  return newElement;
+}
+
+/**
+ * @fn pool_removeElement (HyPool * aPool, void *anElement)
+ *	Deallocates an element from a pool
+ *
+ * It is safe to call pool_removeElement() while looping over
+ * the pool with @ref pool_startDo / @ref pool_nextDo on the element 
+ * returned by those calls.  This is because the free element
+ * is always inserted at either the head of the free list or 
+ * before the nextFree element in the pool_state.
+ *
+ * @param[in] aPool
+ * @param[in] anElement Pointer to the element to be removed
+ *
+ * @return none
+*/
+void VMCALL
+pool_removeElement (HyPool * aPool, void *anElement)
+{
+  UDATA tempHead, tmp2;
+  BOOLEAN foundPool = FALSE;
+  BOOLEAN searchedActive = FALSE;
+  HyPool *oldPool = aPool;
+  HyPool *head = aPool;
+
+  if (!aPool)
+    return;
+
+  /* Peek at active puddle first. If not suitable, walk whole chain. */
+  aPool = head->activePuddle;
+  do
+    {
+      tmp2 =
+	(UDATA) aPool->firstElementAddress +
+	aPool->elementSize * aPool->numberOfElements;
+      if (((UDATA) anElement < tmp2) && ((UDATA) anElement > (UDATA) aPool))
+	{
+	  /* If we've already walked the chain, FOUND. If we're peeking at the active puddle
+	     and there's only one element left, walk the chain from the start. */
+	  if (searchedActive
+	      || (!searchedActive
+		  && (aPool == head || aPool->usedElements > 1)))
+	    {
+	      foundPool = TRUE;
+	      break;		/* this is the right pool */
+	    }
+	}
+      if (!searchedActive)
+	{
+	  searchedActive = TRUE;
+	  aPool = head;		/* start from the beginning */
+	}
+      else
+	{
+	  oldPool = aPool;
+	  aPool = aPool->nextPool;
+	}
+    }
+  while (aPool);
+
+  if (!foundPool)
+    return;			/* this is an error...  we were passed an invalid data pointer. */
+
+  head->activePuddle = aPool;	/* set this pool to the active pool */
+
+  /* we delete from the list differently, depending on if we want to preserve sort order */
+  if (aPool->flags & POOL_ALWAYS_KEEP_SORTED)
+    {
+      /* in this case, we walk the free list, looking for where to insert the newly freed item. */
+      UDATA *lastElem = (UDATA *) & (aPool->firstFreeSlot);
+      UDATA *current = (UDATA *) aPool->firstFreeSlot;
+      while (current && (UDATA) current < (UDATA) anElement)
+	{
+	  lastElem = current;
+	  current = (UDATA *) * current;
+	}
+      *((UDATA *) anElement) = (UDATA) current;
+      *lastElem = (UDATA) anElement;
+      aPool->usedElements -= 1;
+    }
+  else
+    {
+      tempHead = (UDATA) aPool->firstFreeSlot;
+      aPool->firstFreeSlot = (UDATA *) anElement;
+      *((UDATA *) anElement) = tempHead;
+      aPool->usedElements -= 1;
+      aPool->flags &= ~POOL_SORTED;	/* reset sorted flag */
+    }
+
+  if ((oldPool != aPool) && (aPool->usedElements == 0)
+      && !(aPool->flags & POOL_NEVER_FREE_PUDDLES))
+    {
+      oldPool->nextPool = aPool->nextPool;
+      head->activePuddle = oldPool;
+      aPool->memFree (aPool->userData, aPool);
+    }
+}
+
+/**	
+ * @fn pool_do (HyPool * aPool, void (*aFunction) (void *anElement, void *userData), void *userData)
+ *	Calls a user provided function for each element in the list.
+ *
+ * @param[in] aPool The pool to "do" things to
+ * @param[in] aFunction Pointer to function which will "do" things to the elements of aPool
+ * @param[in] userData Pointer to data to be passed to "do" function, along with each pool-element
+ *
+ * @return none
+ *
+ * @see pool_startDo, pool_nextDo
+ *
+ */
+void VMCALL
+pool_do (HyPool * aPool, void (*aFunction) (void *anElement, void *userData),
+	 void *userData)
+{
+  void *anElement;
+  pool_state aState;
+  anElement = pool_startDo (aPool, &aState);
+
+  while (anElement)
+    {
+      (aFunction) (anElement, userData);
+      anElement = pool_nextDo (&aState);
+    }
+}
+
+/**
+ * @fn pool_numElements (HyPool * aPool)
+ *	Returns the number of elements in a given pool.
+ *
+ * @param[in] aPool
+ *
+ * @return 0 on error
+ * @return the number of elements in the pool otherwise
+ *
+*/
+UDATA VMCALL
+pool_numElements (HyPool * aPool)
+{
+  UDATA numElements = 0;
+
+  while (aPool)
+    {
+      numElements += aPool->usedElements;
+      aPool = aPool->nextPool;
+    }
+  return numElements;
+}
+
+/**
+ * @section pool_startDo
+ * @fn pool_startDo (HyPool * aPool, pool_state * lastHandle)
+ *	Start of an iteration set that will return when code is to be executed.
+ *	This is based strongly on pool_sortFreeAndIterateUsed.
+ *	Pass in a pointer to an empty pool_state and it will be filled in.
+ *
+ * @param[in] aPool The pool to "do" things to
+ * @param[in] lastHandle 
+ *
+ * @return NULL
+ * @return pointer to element otherwise
+ *
+ * @see pool_do, pool_nextDo
+ */
+void *VMCALL
+pool_startDo (HyPool * aPool, pool_state * lastHandle)
+{
+  UDATA tmpInc;
+  UDATA *currAddr, **nextFreeAddr;
+
+  if (!aPool)
+    return NULL;
+
+  if (!(aPool->flags & POOL_SORTED))
+    {				/* sort if not pure */
+      pool_sortFree (aPool);
+    }
+
+  if (0 == aPool->usedElements)
+    {				/* this pool is empty */
+      if (aPool->nextPool)
+	{
+	  return pool_startDo (aPool->nextPool, lastHandle);
+	}
+      else
+	{
+	  return NULL;		/* totally empty */
+	}
+    }
+
+  /* walk, iterating. */
+  tmpInc = aPool->elementSize;
+  currAddr = (UDATA *) aPool->firstElementAddress;
+  nextFreeAddr = (UDATA **) aPool->firstFreeSlot;
+
+  while (currAddr == (UDATA *) nextFreeAddr)
+    {
+      nextFreeAddr = (UDATA **) * nextFreeAddr;
+      currAddr = (UDATA *) ((U_8 *) currAddr + tmpInc);
+    }
+
+  lastHandle->currPool = aPool;
+  lastHandle->nextFree = nextFreeAddr;
+  lastHandle->lastAddr = (UDATA *) ((U_8 *) currAddr + tmpInc);	/* set up for next time in. */
+  lastHandle->leftToDo = aPool->usedElements - 1;
+  return (void *) currAddr;
+}
+
+/**
+ * @section pool_nextDo
+ * @fn pool_nextDo (pool_state * lastHandle)
+ *	Continue an iteration based on state passed in by lastHandle.
+ *	It is safe to stop an iteration midway through.
+ *
+ * @param[in] lastHandle pointer for current iteration state
+ *
+ * @return NULL nothing more to be done
+ * @return pointer to next element to be processed otherwise
+ *
+ * @see pool_do, pool_startDo
+ *
+ */
+void *VMCALL
+pool_nextDo (pool_state * lastHandle)
+{
+  UDATA tmpInc;
+  UDATA *currAddr, **nextFreeAddr;
+
+  if (lastHandle->leftToDo == 0)
+    {				/* no more used elements, stop this pool. */
+      if (lastHandle->currPool->nextPool)	/* check the next one. */
+	return pool_startDo (lastHandle->currPool->nextPool, lastHandle);
+      else
+	return NULL;
+    }
+
+  /* there's at least one more used element */
+
+  currAddr = lastHandle->lastAddr;
+  nextFreeAddr = lastHandle->nextFree;
+  tmpInc = lastHandle->currPool->elementSize;
+
+  /* walk, iterating. */
+  while (currAddr == (UDATA *) nextFreeAddr)
+    {
+      nextFreeAddr = (UDATA **) * nextFreeAddr;
+      currAddr = (UDATA *) ((U_8 *) currAddr + tmpInc);
+    }
+
+  lastHandle->nextFree = nextFreeAddr;
+  lastHandle->lastAddr = (UDATA *) ((U_8 *) currAddr + tmpInc);	/* set up for next time in. */
+  lastHandle->leftToDo -= 1;
+
+  return (void *) currAddr;
+}
+
+/**
+ * @fn pool_sortFree (HyPool * aPool)
+ *	Sorts the free list of the current pool.
+ *	(ie: does not follow nextPool pointers...)
+ *	This is a O(n) most of the time.
+ *
+ * @param[in] aPool The pool to be sorted
+ *
+ * @return none
+ */
+void VMCALL
+pool_sortFree (HyPool * aPool)
+{
+  BOOLEAN done = FALSE, conflict;
+  UDATA *currAddr, *tmpAddr, **nextFreeAddr;
+  UDATA tmpInc, x, numElements;
+  U_32 flagVal = 0xDEADBEEE;
+
+  tmpInc = aPool->elementSize;
+  numElements = aPool->numberOfElements;
+
+  currAddr = (UDATA *) aPool->firstElementAddress;
+  while (!done)
+    {
+      conflict = FALSE;
+      for (x = 0; x < numElements; x++)
+	{
+	  if (*currAddr == flagVal)
+	    {
+	      conflict = TRUE;
+	      flagVal -= 1;
+	      break;
+	    }
+	  currAddr = (UDATA *) ((U_8 *) currAddr + tmpInc);
+	}
+      if (!conflict)
+	{
+	  done = TRUE;
+	}
+    }
+  /* now walk, slamming pointers as I go */
+  currAddr = aPool->firstFreeSlot;
+  while (currAddr)
+    {
+      tmpAddr = (UDATA *) * currAddr;
+      *currAddr = flagVal;
+      currAddr = tmpAddr;
+    }
+  /* walk, fixing pointers and iterating. */
+  currAddr = (UDATA *) aPool->firstElementAddress;
+  nextFreeAddr = (UDATA **) & (aPool->firstFreeSlot);
+
+  for (x = 0; x < numElements; x++)
+    {
+      if (*currAddr == flagVal)
+	{			/* add to free list being built */
+	  *nextFreeAddr = currAddr;
+	  nextFreeAddr = (UDATA **) currAddr;
+	}
+      currAddr = (UDATA *) ((U_8 *) currAddr + tmpInc);
+    }
+  *nextFreeAddr = NULL;		/* end the free list cleanly */
+  aPool->flags |= POOL_SORTED;	/* set sorted flag */
+}
+
+/**
+ * @fn pool_forPortLib (U_32 structSize, HyPortLibrary * portLibrary)
+ *	Shortcut for @ref pool_new, using the default malloc/free from the portLibrary
+ *
+ * @param[in] structSize size of pool-element
+ * @param[in] portLibrary
+ *
+ * @return pointer to a Pool
+ *
+ * @see pool_new
+*/
+HyPool *VMCALL
+pool_forPortLib (U_32 structSize, HyPortLibrary * portLibrary)
+{
+  return pool_new (structSize, 0, 0, 0, POOL_FOR_PORT (portLibrary));
+}
+
+/**
+ * @fn pool_clear (HyPool * aPool)
+ * Clear the contents of a pool but not delete it
+ *
+ * @note Make no assumptions about the contents of the pool after invoking
+ *       this method (it currently does not zero the memory)
+ *
+ * @param[in] aPool The pool to clear
+ *
+ * @return none
+*/
+void VMCALL
+pool_clear (HyPool * aPool)
+{
+  while (aPool)
+    {
+      UDATA freeLocation, *oldFreeLocation;
+      U_32 tempNumElems;
+
+      aPool->usedElements = 0;
+      aPool->firstElementAddress =
+	(void *) ROUND_TO (aPool->alignment,
+			   ((UDATA) aPool) + sizeof (HyPool));
+      aPool->firstFreeSlot = (UDATA *) aPool->firstElementAddress;
+      freeLocation = (UDATA) aPool->firstElementAddress;
+      tempNumElems = aPool->numberOfElements;
+      while (tempNumElems--)
+	{
+	  oldFreeLocation = (UDATA *) freeLocation;
+	  freeLocation += aPool->elementSize;
+	  *oldFreeLocation = freeLocation;
+	}
+      *oldFreeLocation = 0;	/* end of list */
+      aPool->flags |= POOL_SORTED;	/* an empty list is sorted */
+      aPool = aPool->nextPool;
+    }
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool_cap.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool_cap.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool_cap.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/pool/pool_cap.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,104 @@
+/* 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.
+ */
+
+/**
+ * @file
+ * @ingroup Pool
+ * @brief Pool-capacity functions
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "hypool.h"
+
+#define ROUND_TO(granularity, number) ( (((number) % (granularity)) ? ((number) + (granularity) - ((number) % (granularity))) : (number)))
+
+#define MIN_GRANULARITY		sizeof(UDATA)
+
+#define MALLOC_ALIGNMENT sizeof(UDATA)
+
+/* read this if a port library call becomes available that gives out the OS page size */
+#if 0
+#define OS_PAGE_SIZE		(EsGetAddressSpacePageSize())
+#else
+#define OS_PAGE_SIZE		4096
+#endif
+
+/**
+ * Ensures that the pool is large enough for newCapacity elements.
+ * This has the side effect of setting the POOL_NEVER_FREE_PUDDLES flag.
+ * Without this, the pool could shrink back down to its original size.
+ * Note that this does not take into account the number of elements already
+ * used in the pool.
+ *
+ * @param[in] aPool The pool
+ * @param[in] newCapacity The desired new-size of the pool
+ *
+ * @return 0 on success
+ * @return -1 on failure
+ */
+UDATA VMCALL
+pool_ensureCapacity (HyPool * aPool, UDATA newCapacity)
+{
+  UDATA numElements = pool_capacity (aPool);
+
+  /* find the last pool and mark each pool as POOL_NEVER_FREE_PUDDLES */
+  for (;;)
+    {
+      aPool->flags |= POOL_NEVER_FREE_PUDDLES;
+      if (aPool->nextPool == NULL)
+	break;
+      aPool = aPool->nextPool;
+    }
+
+  if (newCapacity > numElements)
+    {
+      UDATA newSize = newCapacity - numElements;
+      if (newSize < aPool->numberOfElements)
+	{
+	  newSize = aPool->numberOfElements;
+	}
+
+      aPool->nextPool =
+	pool_new (aPool->elementSize, newSize, aPool->alignment, aPool->flags,
+		  aPool->memAlloc, aPool->memFree, aPool->userData);
+      if (aPool->nextPool == NULL)
+	return -1;
+    }
+
+  return 0;
+}
+
+/**
+ * Returns the total capacity of a pool
+ *
+ * @param[in] aPool The pool
+ *
+ * @return 0 on error
+ * @return numElements in aPool otherwise
+ */
+UDATA VMCALL
+pool_capacity (HyPool * aPool)
+{
+  UDATA numElements = 0;
+  while (aPool)
+    {
+      numElements += aPool->numberOfElements;
+      aPool = aPool->nextPool;
+    }
+  return numElements;
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/DoxygenSupport.txt
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/DoxygenSupport.txt?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/DoxygenSupport.txt (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/DoxygenSupport.txt Wed Nov 30 21:29:27 2005
@@ -0,0 +1,162 @@
+/* Copyright 2004 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.
+ */
+/*
+ * This file provides the group definitions required to create the Doxygen generated
+ * output for compounds.  There is one group per directory (port, pool, thread, etc.).
+ */
+ 
+/**
+ * @defgroup Port Port
+ *
+@section Part1 Introduction
+
+The port library interacts with the native operating system to provide the Java virtual machine a platform independent 
+interface to operating system functionality.  Functionality such as file, socket and memory operations are incorporated 
+in the port library.  By utilizing the port library the Java virtual machine isolates all platform specific knowledge to one area, 
+thus allowing for rapid development of new platforms while promoting a large common code base between these platforms.
+
+The port library is implemented as a table of function pointers.  One advantage of a function pointer based table is the ability 
+to replace any functionality without recompiling the entire Java virtual machine.  For example if an application is experiencing
+a memory leak, the memory management functions of the port library can be replaced to help determine the root cause of this
+leak. Alternatively applications wishing to control all memory allocation can provide their own routines to override the platform
+specific allocation and deallocation of memory.
+
+Various implementations of the port library may choose not to implement all functionality contained in the port library table. 
+If a platform does not support sockets, and thus the Java virtual machine does not utilize sockets, the port library does not need
+to provide a valid socket behavior.  The port library contains @ref PortVersionControl "version control information" that enables applications 
+to determine if required functionality is supported.  In addition the version control information allows applications to determine if the 
+port library provided is compatible with the one which they were compiled against.
+
+
+@section CreatePortLib Creating a port library
+
+The port library is either allocated on the stack or allocated in a memory space via platform specific operations such as malloc.
+Since the size of the area allocated is dependent on the size of the structure compiled against, the port library provides 
+@ref PortVersionControl "version control information"  that applications use to request the 
+specific version they compiled against.  Backward compatibility between versions of the port library is maintained where possible,
+but the application must ensure they check this compatibility prior to invoking any port library functionality.  Failure to do so could
+result in catastrophic failure as application code accesses random port library functionality.
+
+Applications may use the port library with no modifications as follows.  In this example a port library is declared on the stack.
+Of course, the stack allocated data must remain valid for the duration of the port library usage. All utility functions and data
+structures related to the port library are defined in the header file @ref hyport.h "hyport.h".
+
+@code
+{
+    int rc;
+    HyPortLibrary hyportLibrary;
+    HyPortLibraryVersion portLibraryVersion;
+
+    // Use portlibrary version which we compiled against, and have allocated space
+    // for on the stack.  This version may be different from the one in the linked DLL.
+    HYPORT_SET_VERSION(&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+
+    // Initialize and start the port library 
+    rc = hyport_init_library(&hyportLibrary, &portLibraryVersion, sizeof(HyPortLibrary));
+    if (0 != rc) {
+        // handle error condition 
+    }
+
+    ...
+}
+@endcode
+
+Applications wishing to override port library functionality can do so by first allocating the port library table, then initializing it with
+the default values.  They can then override specific function pointers as required and then finally start the port library.
+
+@code
+{
+    int rc;
+    HyPortLibrary hyportLibrary;
+    HyPortLibraryVersion portLibraryVersion;
+
+    // Use portlibrary version which we compiled against, and have allocated space
+    // for on the stack.  This version may be different from the one in the linked DLL.
+    HYPORT_SET_VERSION(&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+
+    // Initializes the port library with the default functions for the specified version 
+    rc = hyport_create_library(hyportLibrary, &portLibraryVersion, sizeof(HyPortLibrary));
+    if (0 != rc) {
+        // handle error condition 
+    }
+
+    // override the file_write operation, store the old one so we can restore it later 
+    old_write = hyportLibrary->file_write;
+    hyportLibrary->file_write = dbg_write;
+
+    // Now start the port library 
+    rc = hyport_startup_library(hyportLibrary);
+    if (0 != rc) {
+        // handle error condition 
+    }
+}
+@endcode
+
+If the application wishes to dynamically allocate memory for the port library they need to first determine the size required.
+@code
+{
+    int rc;
+    int hyportLibrarySize;
+    HyPortLibrary* hyportLibrary;
+    HyPortLibraryVersion portLibraryVersion;
+
+    // Use portlibrary version which we compiled against, and have allocated space
+    // for on the stack.  This version may be different from the one in the linked DLL.
+    HYPORT_SET_VERSION(&portLibraryVersion, HYPORT_CAPABILITY_MASK);
+
+    // Allocate space for the port library 
+    hyportLibrarySize = (int) hyport_getsize(&portLibraryVersion);
+    if (0 == hyportLibrarySize) {
+        // handle error condition
+    }
+
+    hyportLibrary = (HyPortLibrary*)malloc(hyportLibrarySize);
+    if (NULL == hyportLibrary) {
+        // handle error condition 
+    }
+
+    // Initialize and start the port library 
+    rc = hyport_init_library(hyportLibrary, &portLibraryVersion, hyportLibrarySize);
+    if (0 != rc) {
+        // handle error condition 
+    }
+
+    ...
+}
+@endcode
+Functions are also provided to determine @ref PortVersionControl "compatibility" with a running port library, as well as determine 
+the version of a running port library.
+
+
+@section UsePortLib Using the port library
+
+Access to the port library can either be by directly reaching into the port library table, or by using macros to access 
+port library functionality.
+
+@code
+void *internalAllocateMemory(JNIEnv *jniEnv)
+{
+    PORT_ACCESS_FROM_ENV(jniEnv);
+    return hymem_allocate_memory(1024);
+}
+
+void *internalAllocateMemory(HyPortLibrary *portLibrary)
+{
+    return portLibrary->mem_allocate_memory(portLibrary, 1024);
+}
+@endcode
+ */
+
+

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hycpu.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hycpu.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hycpu.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hycpu.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,90 @@
+/* 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.
+ */
+
+#define CDEV_CURRENT_FUNCTION _comment_
+
+/**
+ * @file
+ * @ingroup Port
+ * @brief CPU Control.
+ *
+ * Functions setting CPU attributes.
+ */
+
+#undef CDEV_CURRENT_FUNCTION
+
+#include <windows.h>
+#include "hyport.h"
+
+#define CDEV_CURRENT_FUNCTION hycpu_startup
+/**
+ * PortLibrary startup.
+ *
+ * This function is called during startup of the portLibrary.  Any resources that are required for
+ * the exit operations may be created here.  All resources created here should be destroyed
+ * in @ref hycpu_shutdown.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @return 0 on success, negative error code on failure.  Error code values returned are
+ * \arg HYPORT_ERROR_STARTUP_CPU
+ *
+ * @note Most implementations will simply return success.
+ */
+I_32 VMCALL
+hycpu_startup (struct HyPortLibrary *portLibrary)
+{
+  return 0;
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hycpu_shutdown
+/**
+ * PortLibrary shutdown.
+ *
+ * This function is called during shutdown of the portLibrary.  Any resources that were created by @ref hycpu_startup
+ * should be destroyed here.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @note Most implementations will be empty.
+ */
+void VMCALL
+hycpu_shutdown (struct HyPortLibrary *portLibrary)
+{
+  /* empty */
+}
+
+#undef CDEV_CURRENT_FUNCTION
+
+#define CDEV_CURRENT_FUNCTION hycpu_flush_icache
+/**
+ * @brief CPU Control operations.
+ *
+ * Flush the instruction cache to memory.
+ *
+ * @param[in] portLibrary The port library
+ * @param[in] memoryPointer The base address of memory to flush.
+ * @param[in] byteAmount Number of bytes to flush.
+ */
+void VMCALL
+hycpu_flush_icache (struct HyPortLibrary *portLibrary, void *memoryPointer,
+		    UDATA byteAmount)
+{
+  FlushInstructionCache (GetCurrentProcess (), memoryPointer, byteAmount);
+}
+
+#undef CDEV_CURRENT_FUNCTION

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerror.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerror.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerror.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerror.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,325 @@
+/* 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.
+ */
+
+/**
+ * @file 
+ * @ingroup Port
+ * @brief Error Handling
+ *
+ * If an OS system call fails the error code reported by the OS needs to be saved for future reference.
+ * The OS error code as well as the corresponding portable error code are stored in the per thread
+ * buffers @ref hyportptb.h via a call the @ref hyerror_set_last_error or @ref hyerror_set_last_error_with_message.
+ * These functions are meant for private use by the port library, to set the error related to a system call failure.
+ * They are in the port library table as people overriding port library functions may need to set the error
+ * message accordingly.
+ *
+ * The majority of applications are not interested in the human readable error message corresponding to
+ * the error.  As a result the error message is not stored at time of the reported error, but can be looked
+ * up at a later time.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "portpriv.h"
+#include "portnls.h"
+#include "hyportptb.h"
+
+static const char *
+swapMessageBuffer (PortlibPTBuffers_t ptBuffers, const char *message)
+{
+  char *tempBuffer = ptBuffers->reportedMessageBuffer;
+  U_32 tempBufferSize = ptBuffers->reportedMessageBufferSize;
+
+  if (message == NULL)
+    {
+      return "";
+    }
+
+  /* Can't swap unknown message buffer */
+  if (message != ptBuffers->errorMessageBuffer)
+    {
+      return message;
+    }
+
+  /* Save reported information */
+  ptBuffers->reportedErrorCode = ptBuffers->portableErrorCode;
+  ptBuffers->reportedMessageBuffer = ptBuffers->errorMessageBuffer;
+  ptBuffers->reportedMessageBufferSize = ptBuffers->errorMessageBufferSize;
+
+  if (tempBufferSize > 0)
+    {
+      tempBuffer[0] = '\0';
+    }
+
+  /* Clear pending fields ready for next error */
+  ptBuffers->portableErrorCode = 0;
+  ptBuffers->errorMessageBuffer = tempBuffer;
+  ptBuffers->errorMessageBufferSize = tempBufferSize;
+
+  return ptBuffers->reportedMessageBuffer;
+}
+
+/**
+ * PortLibrary startup.
+ *
+ * This function is called during startup of the portLibrary.  Any resources that are required for
+ * the error handling operations may be created here.  All resources created here should be destroyed
+ * in @ref hyerror_shutdown.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @return 0 on success, negative error code on failure.  Error code values returned are
+ * \arg HYPORT_ERROR_STARTUP_ERROR
+ *
+ * @note Most implementations will simply return success.
+ */
+I_32 VMCALL
+hyerror_startup (struct HyPortLibrary * portLibrary)
+{
+  return 0;
+}
+
+/**
+ * PortLibrary shutdown.
+ *
+ * This function is called during shutdown of the portLibrary.  Any resources that were created
+ * by @ref hyerror_startup should be destroyed here.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @note Most implementations will be empty.
+ */
+void VMCALL
+hyerror_shutdown (struct HyPortLibrary *portLibrary)
+{
+  /* empty */
+}
+
+/**
+ *  @brief Error Handling
+ *
+ * Return the error message as reported by the OS for the last saved error.
+ * If no error has been saved then an empty message is returned.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @return The error message for the last OS failure, empty message on failure.
+ */
+const char *VMCALL
+hyerror_last_error_message (struct HyPortLibrary *portLibrary)
+{
+  PortlibPTBuffers_t ptBuffers;
+
+  /* Was an error saved ? */
+  ptBuffers = hyport_tls_peek (portLibrary);
+  if (NULL == ptBuffers)
+    {
+      return "";
+    }
+
+  /* New error ? */
+  if (ptBuffers->portableErrorCode != 0)
+    {
+      const char *message = NULL;
+
+      /* Customized message stored ? */
+      if (ptBuffers->errorMessageBufferSize > 0)
+	{
+	  if ('\0' != ptBuffers->errorMessageBuffer[0])
+	    {
+	      message = ptBuffers->errorMessageBuffer;
+	    }
+	}
+
+      /* Call a helper to get the last message from the OS.  */
+      if (message == NULL)
+	{
+	  message = errorMessage (portLibrary, ptBuffers->platformErrorCode);
+	}
+
+      /* Avoid overwrite by internal portlib errors */
+      return swapMessageBuffer (ptBuffers, message);
+    }
+
+  /* Previous message stored ? */
+  if (ptBuffers->reportedMessageBufferSize > 0)
+    {
+      if ('\0' != ptBuffers->reportedMessageBuffer[0])
+	{
+	  return ptBuffers->reportedMessageBuffer;
+	}
+    }
+
+  /* No error.  */
+  return "";
+}
+
+/**
+ * @brief Error Handling
+ *
+ * Look up the reason for the last stored failure.  If no error code has been
+ * stored then failure is returned.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @return The negative portable error code on success, 0 on failure.
+ *
+ * @note Does not clear the reason for the last failure.
+ */
+I_32 VMCALL
+hyerror_last_error_number (struct HyPortLibrary * portLibrary)
+{
+  PortlibPTBuffers_t ptBuffers;
+
+  /* get the buffers, return failure if not present */
+  ptBuffers = hyport_tls_peek (portLibrary);
+  if (NULL == ptBuffers)
+    {
+      return 0;
+    }
+
+  /* New error ? */
+  if (ptBuffers->portableErrorCode != 0)
+    {
+      return ptBuffers->portableErrorCode;
+    }
+  else
+    {
+      return ptBuffers->reportedErrorCode;
+    }
+}
+
+/**
+ * @brief Error Handling
+ *
+ * Save the platform specific error code and the portable error code for future reference.  Once stored an 
+ * application may obtain the error message describing the last stored error by calling hyerror_last_error_message.  
+ * Likewise the last portable error code can be obtained by calling hyerror_last_error_number. 
+ *
+ * @param[in] portLibrary The port library
+ * @param[in] platformCode The error code reported by the OS
+ * @param[in] portableCode The corresponding portable error code as determined by the caller
+ *
+ * @return portable error code
+ *
+ * @note There is no way to access the last platform specific error code.
+ *
+ * @note If per thread buffers @see hyportptb.h are not available the error code is not stored.
+ * This event would only occur if the per thread buffers could not be allocated, which is highly unlikely.  In this 
+ * case an application will receive a generic message/errorCode when querying for the last stored values.
+ */
+I_32 VMCALL
+hyerror_set_last_error (struct HyPortLibrary * portLibrary, I_32 platformCode,
+			I_32 portableCode)
+{
+  PortlibPTBuffers_t ptBuffers;
+
+  /* get the buffers, allocate if necessary.
+   * Silently return if not present, what else would the caller do anyway? 
+   */
+  ptBuffers = hyport_tls_get (portLibrary);
+  if (NULL == ptBuffers)
+    {
+      return portableCode;
+    }
+
+  /* Save the last error */
+  ptBuffers->platformErrorCode = platformCode;
+  ptBuffers->portableErrorCode = portableCode;
+
+  /* Overwrite any customized messages stored */
+  if (ptBuffers->errorMessageBufferSize > 0)
+    {
+      ptBuffers->errorMessageBuffer[0] = '\0';
+    }
+
+  return portableCode;
+}
+
+/**
+ * @brief Error Handling
+ *
+ * Save the platform specific error code and the portable error code for future reference.  Once stored an 
+ * application may obtain the error message describing the last stored error by calling hyerror_last_error_message.  
+ * Likewise the last portable error code can be obtained by calling hyerror_last_error_number. 
+ *
+ * @param[in] portLibrary The port library
+ * @param[in] portableCode The corresponding portable error code as determined by the caller
+ * @param[in] errorMessage The customized error message to be stored
+ *
+ * @return portable error code
+ *
+ * @note There is no way to access the last platform specific error code.
+ *
+ * @note If per thread buffers @see hyportptb.h are not available the error code is not stored.
+ * This event would only occur if the per thread buffers could not be allocated, which is highly unlikely.  In this 
+ * case an application will receive a generic message/errorCode when querying for the last stored values.
+ */
+I_32 VMCALL
+hyerror_set_last_error_with_message (struct HyPortLibrary * portLibrary,
+				     I_32 portableCode,
+				     const char *errorMessage)
+{
+  PortlibPTBuffers_t ptBuffers;
+  U_32 requiredSize;
+
+  /* get the buffers, allocate if necessary.
+   * Silently return if not present, what else would the caller do anyway? 
+   */
+  ptBuffers = hyport_tls_get (portLibrary);
+  if (NULL == ptBuffers)
+    {
+      return portableCode;
+    }
+
+  /* Save the last error */
+  ptBuffers->platformErrorCode = -1;
+  ptBuffers->portableErrorCode = portableCode;
+
+  /* Store the message, allocate a bigger buffer if required.  Keep the old buffer around
+   * just in case memory can not be allocated
+   */
+  requiredSize = strlen (errorMessage) + 1;
+  requiredSize =
+    requiredSize <
+    HYERROR_DEFAULT_BUFFER_SIZE ? HYERROR_DEFAULT_BUFFER_SIZE : requiredSize;
+  if (requiredSize > ptBuffers->errorMessageBufferSize)
+    {
+      char *newBuffer =
+	portLibrary->mem_allocate_memory (portLibrary, requiredSize);
+      if (NULL != newBuffer)
+	{
+	  if (ptBuffers->errorMessageBuffer != NULL)
+	    {
+	      portLibrary->mem_free_memory (portLibrary,
+					    ptBuffers->errorMessageBuffer);
+	    }
+	  ptBuffers->errorMessageBuffer = newBuffer;
+	  ptBuffers->errorMessageBufferSize = requiredSize;
+	}
+    }
+
+  /* Save the message */
+  if (ptBuffers->errorMessageBufferSize > 0)
+    {
+      portLibrary->str_printf (portLibrary, ptBuffers->errorMessageBuffer,
+			       ptBuffers->errorMessageBufferSize,
+			       errorMessage);
+      ptBuffers->errorMessageBuffer[ptBuffers->errorMessageBufferSize - 1] =
+	'\0';
+    }
+
+  return portableCode;
+}

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerrorhelpers.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerrorhelpers.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerrorhelpers.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyerrorhelpers.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,166 @@
+/* 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.
+ */
+
+#define CDEV_CURRENT_FUNCTION _comment_
+/**
+ * @internal 
+ * @file
+ * @ingroup Port
+ * @brief Error Handling
+ *
+ * Helper utilities for @ref hyerror.c.  This file reduces the amount of code duplication as formatting of messages
+ * from the OS is the only part of error handling that can not be handled in a generic manner.
+ *
+ * These functions are not accessible via the port library function table.
+ */
+#undef CDEV_CURRENT_FUNCTION
+
+#include <string.h>
+#include "portpriv.h"
+#include "portnls.h"
+#include "hyportptb.h"
+
+#define CDEV_CURRENT_FUNCTION errorMessage
+/**
+ * @internal
+ * @brief Error Handling
+ *
+ * Given an error code save the OS error message to the ptBuffers and return
+ * a reference to the saved message.
+ *
+ * @param[in] portLibrary The port library
+ * @param[in] errorCode The platform specific error code to look up.
+ *
+ * @note By the time this function is called it is known that ptBuffers are
+ *       not NULL.  It is possible, however, that the
+ *       buffer to hold the error message has not yet been allocated.
+ *
+ * @note Buffer is managed by the port library, do not free
+ */
+const char *VMCALL
+errorMessage (struct HyPortLibrary *portLibrary, I_32 errorCode)
+{
+  PortlibPTBuffers_t ptBuffers;
+  char *message;
+  int rc = 0, i, out;
+  WCHAR ubuffer[HYERROR_DEFAULT_BUFFER_SIZE];
+#if defined(UNICODE)
+#define buffer ubuffer
+#else
+  char buffer[HYERROR_DEFAULT_BUFFER_SIZE];
+#endif
+
+  ptBuffers = hyport_tls_peek (portLibrary);
+  if (0 == ptBuffers->errorMessageBufferSize)
+    {
+      ptBuffers->errorMessageBuffer =
+	portLibrary->mem_allocate_memory (portLibrary,
+					  HYERROR_DEFAULT_BUFFER_SIZE);
+      if (NULL == ptBuffers->errorMessageBuffer)
+	{
+	  return "";
+	}
+      ptBuffers->errorMessageBufferSize = HYERROR_DEFAULT_BUFFER_SIZE;
+    }
+  message = ptBuffers->errorMessageBuffer;
+
+  rc =
+    FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+		   NULL, errorCode, 0, (LPTSTR) buffer,
+		   HYERROR_DEFAULT_BUFFER_SIZE, NULL);
+  if (rc == 0)
+    {
+      const char *format;
+      format = portLibrary->nls_lookup_message (portLibrary,
+						HYNLS_DO_NOT_PRINT_MESSAGE_TAG
+						| HYNLS_DO_NOT_APPEND_NEWLINE,
+						HYNLS_PORT_ERROR_OPERATION_FAILED,
+						"Operation Failed: %d (%s failed: %d)");
+      portLibrary->str_printf (portLibrary, message,
+			       ptBuffers->errorMessageBufferSize, format,
+			       errorCode, "FormatMessage", GetLastError ());
+      message[ptBuffers->errorMessageBufferSize - 1] = '\0';
+      return message;
+    }
+#if !defined(UNICODE)
+  rc =
+    MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, buffer, -1, ubuffer,
+			 HYERROR_DEFAULT_BUFFER_SIZE);
+  if (rc == 0)
+    {
+      const char *format;
+      format = portLibrary->nls_lookup_message (portLibrary,
+						HYNLS_DO_NOT_PRINT_MESSAGE_TAG
+						| HYNLS_DO_NOT_APPEND_NEWLINE,
+						HYNLS_PORT_ERROR_OPERATION_FAILED,
+						"Operation Failed: %d (%s failed: %d)");
+      portLibrary->str_printf (portLibrary, message,
+			       ptBuffers->errorMessageBufferSize, format,
+			       errorCode, "MultiByteToWideChar",
+			       GetLastError ());
+      message[ptBuffers->errorMessageBufferSize - 1] = '\0';
+      return message;
+    }
+#else
+#undef buffer
+#endif
+
+  out = sprintf (message, "(%d) ", errorCode);
+  for (i = 0; i < rc; i++)
+    {
+      UDATA ch = ubuffer[i];
+      if (ch == '\r')
+	{			/* Strip CR */
+	  continue;
+	}
+      if (ch == '\n')
+	{			/* Convert LF to space */
+	  ch = ' ';
+	}
+      if (ch < 0x80)
+	{
+	  if ((out + 2) >= HYERROR_DEFAULT_BUFFER_SIZE)
+	    break;
+	  message[out++] = (char) ch;
+	}
+      else if (ch < 0x800)
+	{
+	  if ((out + 3) >= HYERROR_DEFAULT_BUFFER_SIZE)
+	    break;
+	  message[out++] = (char) (0x80 | (ch & 0x3f));
+	  message[out++] = (char) (0xc0 | (ch >> 6));
+	}
+      else
+	{
+	  if ((out + 4) >= HYERROR_DEFAULT_BUFFER_SIZE)
+	    break;
+	  message[out++] = (char) (0x80 | (ch & 0x3f));
+	  message[out++] = (char) (0x80 | ((ch >> 6) & 0x3f));
+	  message[out++] = (char) (0xe0 | (ch >> 12));
+	}
+    }
+  message[out] = '\0';
+
+  /* There may be extra spaces at the end of the message, due to stripping of the LF
+   * it is replaced by a space.  Multi-line OS messages are thus one long continuous line for us
+   */
+  while (iswspace (message[out]) || (message[out] == '\0'))
+    {
+      message[out--] = '\0';
+    }
+  return message;
+}
+
+#undef CDEV_CURRENT_FUNCTION

Added: incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyexit.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyexit.c?rev=350181&view=auto
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyexit.c (added)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/ibm_core/native-src/win.IA32/port/hyexit.c Wed Nov 30 21:29:27 2005
@@ -0,0 +1,95 @@
+/* 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.
+ */
+
+/**
+ * @file
+ * @ingroup Port
+ * @brief Process shutdown.
+ */
+#include <stdlib.h>
+
+#include "hyport.h"
+
+extern void VMCALL hysig_chain_at_shutdown_and_exit (struct HyPortLibrary
+						     *portLibrary);
+
+/**
+ * Block until the portlibary has been exited and return the error code.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @return exit code.
+ * @note Most implementations will be empty.
+ */
+I_32 VMCALL
+hyexit_get_exit_code (struct HyPortLibrary *portLibrary)
+{
+  return 0;
+}
+
+/**
+ * Terminate a process.
+ *
+ * Perform any shutdown which is absolutely necessary before terminating the process,
+ * and terminate the process.  Unblock any callers to @ref hyexit_get_exit_code
+ *
+ * @param[in] portLibrary The port library
+ * @param[in] exitCode The exit code to be used to terminate the process.
+ */
+void VMCALL
+hyexit_shutdown_and_exit (struct HyPortLibrary *portLibrary, I_32 exitCode)
+{
+#if !defined(WIN32)
+  hysig_chain_at_shutdown_and_exit (portLibrary);
+#endif
+
+  exit ((int) exitCode);
+}
+
+/**
+ * PortLibrary shutdown.
+ *
+ * This function is called during shutdown of the portLibrary.  Any resources that
+ * were created by @ref hyexit_startup should be destroyed here.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @note Most implementations will be empty.
+ */
+void VMCALL
+hyexit_shutdown (struct HyPortLibrary *portLibrary)
+{
+  /* empty */
+}
+
+/**
+ * PortLibrary startup.
+ *
+ * This function is called during startup of the portLibrary.  Any resources that are required for
+ * the exit operations may be created here.  All resources created here should be destroyed
+ * in @ref hyexit_shutdown.
+ *
+ * @param[in] portLibrary The port library
+ *
+ * @return 0 on success, negative error code on failure.  Error code values returned are
+ * \arg HYPORT_ERROR_STARTUP_EXIT
+ *
+ * @note Most implementations will simply return success.
+ */
+I_32 VMCALL
+hyexit_startup (struct HyPortLibrary *portLibrary)
+{
+  return 0;
+}



Mime
View raw message