You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/13 09:42:52 UTC
svn commit: r764366 [1/2] - in /commons/sandbox/runtime/trunk/src:
main/java/org/apache/commons/runtime/ main/native/ main/native/include/
main/native/include/arch/ main/native/include/arch/darwin/
main/native/include/arch/hpux/ main/native/include/arc...
Author: mturk
Date: Mon Apr 13 07:42:50 2009
New Revision: 764366
URL: http://svn.apache.org/viewvc?rev=764366&view=rev
Log:
Various initail code and some API changes
Added:
commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h (with props)
commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h (with props)
commons/sandbox/runtime/trunk/src/main/native/include/arch/
commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/
commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h (with props)
commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/
commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h (with props)
commons/sandbox/runtime/trunk/src/main/native/include/arch/linux/
commons/sandbox/runtime/trunk/src/main/native/include/arch/linux/acr_arch_private.h (with props)
commons/sandbox/runtime/trunk/src/main/native/include/arch/solaris/
commons/sandbox/runtime/trunk/src/main/native/include/arch/solaris/acr_arch_private.h (with props)
commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/
commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h (with props)
commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/
commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h (with props)
commons/sandbox/runtime/trunk/src/main/native/os/hpux/
commons/sandbox/runtime/trunk/src/main/native/shared/buildmark.c (with props)
commons/sandbox/runtime/trunk/src/main/native/shared/buildmark.o (with props)
commons/sandbox/runtime/trunk/src/main/native/shared/dbb.o (with props)
commons/sandbox/runtime/trunk/src/main/native/shared/error.o (with props)
commons/sandbox/runtime/trunk/src/main/native/shared/memory.c (with props)
commons/sandbox/runtime/trunk/src/main/native/shared/memory.o (with props)
commons/sandbox/runtime/trunk/src/main/native/shared/string.o (with props)
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestDirectByteBuffer.java (with props)
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java (with props)
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java
commons/sandbox/runtime/trunk/src/main/native/Makefile.in
commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
commons/sandbox/runtime/trunk/src/main/native/configure
commons/sandbox/runtime/trunk/src/main/native/include/acr.h
commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h
commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
commons/sandbox/runtime/trunk/src/main/native/include/acr_types.h
commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h
commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/main.rc
commons/sandbox/runtime/trunk/src/main/native/os/win32/os.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c
commons/sandbox/runtime/trunk/src/main/native/shared/dbb.c
commons/sandbox/runtime/trunk/src/main/native/shared/error.c
commons/sandbox/runtime/trunk/src/main/native/shared/string.c
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestAll.java
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java Mon Apr 13 07:42:50 2009
@@ -18,44 +18,93 @@
import java.nio.ByteBuffer;
-/** DirectByteBuffer.
- *
+/** DirectByteBuffer
+ * <br/>
+ * <b>Warning</b>: Using this class impropery may crash the running JVM.
+ * Any method call after free method was called might write or read from
+ * the memory location that has been already allocated for
+ * something else.
* @author Mladen Turk
*/
public final class DirectByteBuffer {
+ private DirectByteBuffer()
+ {
+ // No class instance
+ }
+
+ private static native ByteBuffer alloc0(int size)
+ throws OutOfMemoryError, IllegalArgumentException;
+
+ private static native ByteBuffer alloc1(int size)
+ throws OutOfMemoryError, IllegalArgumentException;
+
+ private static native ByteBuffer attach(long mem, int offset, int size)
+ throws NullPointerException, IllegalArgumentException;
+
+ public static native void copy0(ByteBuffer src, int srcPos, ByteBuffer dst,
+ int dstPos, int count)
+ throws NullPointerException, IllegalArgumentException,
+ IndexOutOfBoundsException;
+
/**
* Allocate a new ByteBuffer from memory
* @param size The amount of memory to allocate
* @return The ByteBuffer with allocated memory
*/
- public static native ByteBuffer malloc(int size);
+ public static ByteBuffer allocate(int size)
+ throws OutOfMemoryError, IllegalArgumentException
+ {
+ return alloc0(size);
+ }
/**
* Allocate a new ByteBuffer from memory and set all of the memory to 0
- * @param num Number of elements.
* @param size Length in bytes of each element.
* @return The ByteBuffer with allocated memory
*/
- public static native ByteBuffer calloc(int num, int size);
+ public static ByteBuffer allocateAndInitToZero(int size)
+ throws OutOfMemoryError, IllegalArgumentException
+ {
+ return alloc1(size);
+ }
/**
* Allocate a new ByteBuffer from already allocated memory.
* <br />Allocated memory must be provided from call to the
* Stdlib.alloc or Stdlib.calloc methods.
* @param mem The memory to use
+ * @param offset Offset from the memory to use
+ * @param size The amount of memory to use
+ * @return The ByteBuffer with attached memory
+ */
+ public static ByteBuffer allocate(long mem, int offset, int size)
+ throws NullPointerException, IllegalArgumentException
+ {
+ return attach(mem, offset, size);
+ }
+
+ /**
+ * Allocate a new ByteBuffer from already allocated ByteBuffer.
+ * @param b The ByteBuffer whos memory to use
+ * @param offset Offset from the memory to use
* @param size The amount of memory to use
* @return The ByteBuffer with attached memory
*/
- public static native ByteBuffer create(long mem, int size);
+ public static ByteBuffer allocate(ByteBuffer b, int offset, int size)
+ throws NullPointerException, IllegalArgumentException
+ {
+ return attach(address(b), offset, size);
+ }
/**
* Deallocates or frees a memory block used by ByteBuffer
* <br /><b>Warning :</b> Call this method only on ByteBuffers
- * that were created by calling Buffer.alloc or Buffer.calloc.
+ * that were created by calling allocate.
* @param buf Previously allocated ByteBuffer to be freed.
*/
- public static native void free(ByteBuffer buf);
+ public static native void free(ByteBuffer buf)
+ throws NullPointerException;
/**
* Returns the memory address of the ByteBuffer.
@@ -69,4 +118,29 @@
*/
public static native long size(ByteBuffer buf);
+ /**
+ * Set ByteBuffer to specified character.
+ * @param b The ByteBuffer to use
+ * @param c The character to set
+ * @param count Number of characters
+ */
+ public static native void set(ByteBuffer b, int c, int count)
+ throws NullPointerException, IllegalArgumentException,
+ IndexOutOfBoundsException;
+
+ public static void copy(ByteBuffer src, ByteBuffer dst, int length)
+ throws NullPointerException, IllegalArgumentException,
+ IndexOutOfBoundsException
+ {
+ copy0(src, 0, dst, 0, length);
+ }
+
+ public static void copy(ByteBuffer src, int srcPos, ByteBuffer dst,
+ int dstPos, int length)
+ throws NullPointerException, IllegalArgumentException,
+ IndexOutOfBoundsException
+ {
+ copy0(src, srcPos, dst, dstPos, length);
+ }
+
}
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/OS.java Mon Apr 13 07:42:50 2009
@@ -23,6 +23,11 @@
*/
public final class OS {
+ private OS()
+ {
+ // No class instance
+ }
+
/* OS Enums */
private static final int WINDOWS = 0x1000;
private static final int WIN64 = 0x1001;
Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Mon Apr 13 07:42:50 2009
@@ -16,7 +16,7 @@
# ====================================================================
#
# Apache Commons Runtime Makefile
-#
+#
# XXX: Do not use GNU make extensions
# because it breaks the Solaris build.
#
@@ -38,7 +38,7 @@
TOPDIR=@topdir@
CPP=@cpp@
CXX=@cxx@
-CFLAGS=@ccflags@ -DACR_DECLARE_EXPORT -DACR_CORE_PRIVATE
+CFLAGS=@ccflags@
CPPFLAGS=@cppopts@
CXXFLAGS=@cxxopts@
LDFLAGS=@ldflags@
@@ -50,7 +50,6 @@
SHAREDLIB=lib$(NAME)$(SO)
SRCDIR=$(TOPDIR)
-INCDIR=$(TOPDIR)/include
BLDDIR=$(TOPDIR)/.libs
PWDDIR=$(PWD)
@@ -61,11 +60,14 @@
$(SRCDIR)/os/darwin \
$(SRCDIR)/os/hpux \
$(SRCDIR)/os/unix \
- $(SRCDIR)/os/win32
-
+ $(SRCDIR)/os/win32 \
+ $(SRCDIR)/test
+
COMMON_OBJS=\
+ $(SRCDIR)/shared/buildmark.$(OBJ) \
$(SRCDIR)/shared/dbb.$(OBJ) \
$(SRCDIR)/shared/error.$(OBJ) \
+ $(SRCDIR)/shared/memory.$(OBJ) \
$(SRCDIR)/shared/string.$(OBJ)
LINUX_OBJS= \
@@ -84,6 +86,10 @@
$(SRCDIR)/os/unix/main.$(OBJ) \
$(SRCDIR)/os/hpux/os.$(OBJ)
+TEST_OBJS= \
+ $(SRCDIR)/test/testcase.$(OBJ)
+
+
all: setup $(SHAREDLIB)
.c.$(OBJ):
@@ -92,8 +98,8 @@
.cpp.$(OBJ):
$(CXX) $(CFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
-$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS)
- $(CC) $(SHFLAGS) $(LDFLAGS) -o $(BLDDIR)/$@ $(COMMON_OBJS) $(@platform@_OBJS)
+$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@
+ $(CC) $(SHFLAGS) $(LDFLAGS) -o $(BLDDIR)/$@ $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@
setup:
@mkdir -p $(BLDDIR)
Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Mon Apr 13 07:42:50 2009
@@ -16,7 +16,7 @@
# ====================================================================
#
# Apache Commons Runtime Windows Makefile
-#
+#
#
# ====================================================================
#
@@ -36,7 +36,7 @@
TOPDIR=@topdir@
CPP=@cpp@
CXX=@cxx@
-CFLAGS=@ccflags@ -DACR_DECLARE_EXPORT -DACR_CORE_PRIVATE
+CFLAGS=@ccflags@ -DACR_DECLARE_EXPORT
CPPFLAGS=@cppopts@
CXXFLAGS=@cxxopts@
LDFLAGS=@ldflags@
@@ -58,15 +58,20 @@
PWDDIR=$(PWD)
COMMON_OBJS=\
+ $(SRCDIR)/shared/buildmark.$(OBJ) \
$(SRCDIR)/shared/dbb.$(OBJ) \
$(SRCDIR)/shared/error.$(OBJ) \
+ $(SRCDIR)/shared/memory.$(OBJ) \
$(SRCDIR)/shared/string.$(OBJ)
WINDOWS_OBJS= \
- $(SRCDIR)/os/win32/main.res \
$(SRCDIR)/os/win32/main.$(OBJ) \
$(SRCDIR)/os/win32/os.$(OBJ) \
- $(SRCDIR)/os/win32/syslog.$(OBJ)
+ $(SRCDIR)/os/win32/syslog.$(OBJ) \
+ $(SRCDIR)/os/win32/main.res
+
+TEST_OBJS= \
+ $(SRCDIR)/test/testcase.$(OBJ)
all: setup $(SHAREDLIB)
@@ -79,14 +84,14 @@
.rc.res:
$(RC) /l 0x409 /d "NDEBUG" /i "$(SRCDIR)\include" /fo $@ $<
-$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS)
- $(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS $(COMMON_OBJS) $(WINDOWS_OBJS) /pdb:$(BLDDIR)\$(LIBNAME).pdb /out:$(BLDDIR)\$@
+$(SHAREDLIB): $(COMMON_OBJS) $(@platform@_OBJS) @testobjs@
+ $(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS $(COMMON_OBJS) $(WINDOWS_OBJS) @testobjs@ /pdb:$(BLDDIR)\$(LIBNAME).pdb /out:$(BLDDIR)\$@
IF EXIST $(BLDDIR)\$(SHAREDLIB).manifest \
- mt -nologo -manifest $(BLDDIR)\$(SHAREDLIB).manifest -outputresource:$(BLDDIR)\$(SHAREDLIB);2
+ mt -nologo -manifest $(BLDDIR)\$(SHAREDLIB).manifest -outputresource:$(BLDDIR)\$(SHAREDLIB);2
@copy /Y $(BLDDIR)\$(SHAREDLIB) $(BLDDIR)\$(SONAME)
setup:
- @if not exist "$(BLDDIR)\$(NULL)" mkdir "$(BLDDIR)"
+ @if not exist "$(BLDDIR)\$(NULL)" mkdir "$(BLDDIR)"
clean:
-@del /Q $(SRCDIR)\shared\*.$(OBJ) 2>NUL
@@ -97,8 +102,8 @@
distclean: clean
-@del /Q $(TOPDIR)\Makefile 2>NUL
-@del /Q $(SRCDIR)\include\ccconfig.h 2>NUL
- @if exist "$(BLDDIR)\$(NULL)" rd /s /q $(BLDDIR)
+ @if exist "$(BLDDIR)\$(NULL)" rd /s /q $(BLDDIR)
install: all
- @if not exist "$(DESTDIR)\include\$(NULL)" mkdir "$(DESTDIR)\include"
- @if not exist "$(DESTDIR)\$(LIBDIR)\$(NULL)" mkdir "$(DESTDIR)\$(LIBDIR)"
+ @if not exist "$(DESTDIR)\include\$(NULL)" mkdir "$(DESTDIR)\include"
+ @if not exist "$(DESTDIR)\$(LIBDIR)\$(NULL)" mkdir "$(DESTDIR)\$(LIBDIR)"
Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Mon Apr 13 07:42:50 2009
@@ -65,6 +65,8 @@
has_dso_test=false
has_jni=false
has_64_bit=false
+has_test=false
+is_unix=true
for o
do
@@ -208,8 +210,6 @@
echo "\`$java_home' is not valid JAVA_HOME directory"
fi
-varadds includes "-I$java_home/include"
-
mach=`(uname -m) 2>/dev/null` || mach="unknown"
host=`(uname -s) 2>/dev/null` || host="unknown"
host=`tolower "$host"`
@@ -260,7 +260,7 @@
linux-gcc )
varadds cppopts "-DLINUX=2 -D_GNU_SOURCE"
varadds ccflags "-fPIC -O3 -Wall -g"
- varadds ldflags "-lrt -lpthread -ldl"
+ varadds ldflags "-lrt -lpthread -ldl -laio"
varadds shflags "-shared -fPIC -Wl,-soname -Wl,lib$name$so"
if [ ".$java_pinc" = . ]; then java_pinc=linux; fi
;;
@@ -276,7 +276,7 @@
r="`uname -r | sed 's/5.//'`"
varadds ccflags "-fast -O -Xa -KPIC"
varadds cppopts "-D_POSIX_PTHREAD_SEMANTICS -DSOLARIS2=$r"
- varadds ldflags "-lrt -lthread -lsocket -lnsl -ldl"
+ varadds ldflags "-lrt -lthread -lsocket -lnsl -ldl -laio"
varadds shflags "-G -KPIC -dy"
if [ ".$java_pinc" = . ]; then java_pinc=solaris; fi
;;
@@ -298,6 +298,7 @@
varadds ldflags "ole32.lib shell32.lib rpcrt4.lib user32.lib gdi32.lib"
varadds ldflags "psapi.lib shlwapi.lib wldap32.lib netapi32.lib iphlpapi.lib"
varadds shflags "/NOLOGO /OPT:REF"
+ is_unix=false
so=".dll"
exe=".exe"
obj="obj"
@@ -329,8 +330,26 @@
;;
esac
-varadds includes "-I$topdir/include/arch/$host"
+if [ ".$bits" = ".64" ]; then
+ varadds cppopts "-D_COMPILE64BIT_SOURCE"
+fi
+if [ -d "$topdir/include/arch/$host" ]; then
+ varadds includes "-I$topdir/include/arch/$host"
+fi
+if $is_unix; then
+ varadds includes "-I$topdir/include/arch/unix"
+ varadds cppopts "-D_REENTRANT -D_LARGEFILE64_SOURCE"
+fi
+
+if $has_test; then
+ varadds cppopts "-DACR_ENABLE_TEST"
+ testobjs=' $(TEST_OBJS)'
+else
+ testobjs=""
+fi
+
+varadds includes "-I$java_home/include"
if [ -n "$java_pinc" ]; then
if [ -d "$java_home/include/$java_pinc" ]; then
varadds includes "-I$java_home/include/$java_pinc"
@@ -340,8 +359,6 @@
fi
fi
-varadds cppopts "-D_REENTRANT -D_LARGEFILE64_SOURCE"
-
test=ctest$$
if $has_dso_test; then
@@ -415,7 +432,7 @@
#
cat > $topdir/include/ccconfig.h << EOF
/*
- * AUTOMATICALY GENERATED -- DO NOT EDIT
+ * AUTOMATICALLY GENERATED BY CONFIGURE SCRIPT -- DO NOT EDIT
*/
#ifndef _CCCONFIG_H
#define _CCCONFIG_H
@@ -431,6 +448,8 @@
#define HAVE_INTTYPES_H `have_include inttypes`
#define HAVE_DLFCN_H `have_include dlfcn`
#define HAVE_LINK_H `have_include link`
+#define HAVE_FCNTL_H `have_include fcntl`
+#define HAVE_SYS_FILE_H `have_include sys/file`
#define HAVE_SYS_TYPES_H `have_include sys/types`
#define HAVE_SYS_CDEFS_H `have_include sys/cdefs`
#define HAVE_SYS_RESOURCE_H `have_include sys/resource`
@@ -438,15 +457,18 @@
#define HAVE_SYS_WAIT_H `have_include sys/wait`
#define HAVE_SYS_SYSLIMITS_H `have_include sys/syslimits`
#define HAVE_LIMITS_H `have_include limits`
+#define HAVE_CTYPE_H `have_include ctype`
#define HAVE_WCHAR_H `have_include wchar`
#define HAVE_WTYPE_H `have_include wctype`
+#define HAVE_AIO_H `have_include aio`
+#define HAVE_NETDB_H `have_include netdb`
#define HAS_BIG_ENDIAN $bige
#define CC_SIZEOF_INT `test_csizeof int`
#define CC_SIZEOF_LONG `test_csizeof long`
-#define CC_SIZEOF_LONG_LONG `test_csizeof "long long"`
-#define CC_SIZEOF_VOIDP `test_csizeof "void *"`
+#define CC_SIZEOF_LONG_LONG `test_csizeof 'long long'`
+#define CC_SIZEOF_VOIDP `test_csizeof 'void *'`
#define CC_SIZEOF_SIZE_T `test_csizeof size_t`
#define CC_SIZEOF_OFF64_T `test_csizeof off64_t`
@@ -502,6 +524,7 @@
-e "s;=@mach@;=$mach;g" \
-e "s;=@bits@;=$bits;g" \
-e "s;@platform@;$platform;g" \
+ -e "s;@testobjs@;$testobjs;g" \
-e "s;=@ranlib@;=$ranlib;g" \
-e "s;=@prefix@;=$prefix;g" \
-e "s;=@libdir@;=$libdir;g" \
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr.h?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr.h Mon Apr 13 07:42:50 2009
@@ -74,9 +74,13 @@
#include <mswsock.h>
#include <ws2tcpip.h>
#include <psapi.h>
-
-/* Define synonims for some common posix functions */
-#define snprintf _snprintf
+#include <tlhelp32.h>
+#include <aclapi.h>
+#include <lm.h>
+#include <sddl.h>
+#include <iphlpapi.h>
+#include <userenv.h>
+#include <shellapi.h>
#endif /* HAVE_WINDOWS_H */
@@ -90,6 +94,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <stddef.h>
+#include <errno.h>
#if HAVE_UNISTD_H
#include <unistd.h>
@@ -109,6 +114,12 @@
#if HAVE_LINK_H
#include <link.h>
#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
@@ -126,12 +137,28 @@
#include <sys/syslimits.h>
#endif
#endif
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#endif
#if HAVE_WCHAR_H
#include <wchar.h>
#endif
#if HAVE_WCTYPE_H
#include <wctype.h>
#endif
+#if HAVE_AIO_H
+#include <aio.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#if defined(_DEBUG) || defined(DEBUG)
+#include <assert.h>
+#define ACR_ASSERT(x) assert((x))
+#else
+#define ACR_ASSERT(x) (void)0
+#endif
/* JNI header */
#include <jni.h>
@@ -156,8 +183,17 @@
typedef unsigned int acr_uint32_t;
typedef unsigned long apr_ino_t;
typedef size_t acr_size_t;
+typedef jchar acr_wchar_t;
+typedef jint acr_int_t;
+typedef jlong acr_long_t;
#if defined(_MSC_VER)
+
+/* Define synonims for some common posix functions */
+#define snprintf _snprintf
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+
typedef ptrdiff_t acr_ssize_t;
typedef __int64 acr_int64_t;
typedef unsigned __int64 acr_uint64_t;
@@ -167,7 +203,7 @@
typedef ssize_t acr_ssize_t;
typedef long long acr_int64_t;
typedef unsigned long long acr_uint64_t;
-#if CC_SIZEOF_OFF64_T
+#if CC_SIZEOF_OFF64_T
typedef off64_t acr_off_t;
#else
typedef int64_t acr_off_t;
@@ -194,39 +230,16 @@
* conventions at compile time.
*/
-#if !defined(_WIN32)
-/**
- * The public ACR functions are declared with ACR_DECLARE(), so they may
- * use the most appropriate calling convention. Public ACR functions with
- * variable arguments must use ACR_DECLARE_NONSTD().
- *
- * @deffunc ACR_DECLARE(rettype) apr_func(args);
- */
-#define ACR_DECLARE(type) type
-/**
- * The public ACR functions using variable arguments are declared with
- * ACR_DECLARE_NONSTD(), as they must use the C language calling convention.
- *
- * @deffunc ACR_DECLARE_NONSTD(rettype) apr_func(args, ...);
- */
-#define ACR_DECLARE_NONSTD(type) type
-/**
- * The public ACR variables are declared with ACR_DECLARE_DATA.
- * This assures the appropriate indirection is invoked at compile time.
- *
- * @deffunc ACR_DECLARE_DATA type apr_variable;
- * @tip extern ACR_DECLARE_DATA type apr_variable; syntax is required for
- * declarations within headers to properly import the variable.
- */
-#define ACR_DECLARE_DATA
-#elif defined(ACR_DECLARE_STATIC)
-#define ACR_DECLARE(type) type __stdcall
-#define ACR_DECLARE_NONSTD(type) type
+#if defined(_WIN32)
+
+#if defined(ACR_DECLARE_STATIC)
+#define ACR_DECLARE(type) type __stdcall
+#define ACR_DECLARE_NONSTD(type) type
#define ACR_DECLARE_DATA
#elif defined(ACR_DECLARE_EXPORT)
-#define ACR_DECLARE(type) __declspec(dllexport) type __stdcall
-#define ACR_DECLARE_NONSTD(type) __declspec(dllexport) type
-#define ACR_DECLARE_DATA __declspec(dllexport)
+#define ACR_DECLARE(type) __declspec(dllexport) type __stdcall
+#define ACR_DECLARE_NONSTD(type) __declspec(dllexport) type
+#define ACR_DECLARE_DATA __declspec(dllexport)
#else
/**
* The public ACR functions are declared with ACR_DECLARE(), so they may
@@ -234,13 +247,13 @@
* variable arguments must use ACR_DECLARE_NONSTD().
*
*/
-#define ACR_DECLARE(type) __declspec(dllimport) type __stdcall
+#define ACR_DECLARE(type) __declspec(dllimport) type __stdcall
/**
* The public ACR functions using variable arguments are declared with
* ACR_DECLARE_NONSTD(), as they must use the C language calling convention.
*
*/
-#define ACR_DECLARE_NONSTD(type) __declspec(dllimport) type
+#define ACR_DECLARE_NONSTD(type) __declspec(dllimport) type
/**
* The public ACR variables are declared with ACR_DECLARE_DATA.
* This assures the appropriate indirection is invoked at compile time.
@@ -248,10 +261,10 @@
* @remark extern ACR_DECLARE_DATA type apr_variable; syntax is required for
* declarations within headers to properly import the variable.
*/
-#define ACR_DECLARE_DATA __declspec(dllimport)
+#define ACR_DECLARE_DATA __declspec(dllimport)
#endif
-#if !defined(_WIN32) || defined(ACR_MODULE_DECLARE_STATIC)
+#if defined(ACR_MODULE_DECLARE_STATIC)
/**
* Declare a dso module's exported module structure as ACR_MODULE_DECLARE_DATA.
*
@@ -261,11 +274,7 @@
* module ACR_MODULE_DECLARE_DATA mod_tag
* @endcode
*/
-#if defined(_WIN32)
#define ACR_MODULE_DECLARE(type) type __stdcall
-#else
-#define ACR_MODULE_DECLARE(type) type
-#endif
#define ACR_MODULE_DECLARE_NONSTD(type) type
#define ACR_MODULE_DECLARE_DATA
#else
@@ -279,11 +288,38 @@
#define ACR_MODULE_DECLARE_DATA __declspec(dllexport)
#endif
+#else /* !_WIN32 */
+
+/**
+ * The public ACR functions are declared with ACR_DECLARE(), so they may
+ * use the most appropriate calling convention. Public ACR functions with
+ * variable arguments must use ACR_DECLARE_NONSTD().
+ *
+ * @deffunc ACR_DECLARE(rettype) apr_func(args);
+ */
+#define ACR_DECLARE(type) type
+/**
+ * The public ACR functions using variable arguments are declared with
+ * ACR_DECLARE_NONSTD(), as they must use the C language calling convention.
+ *
+ * @deffunc ACR_DECLARE_NONSTD(rettype) apr_func(args, ...);
+ */
+#define ACR_DECLARE_NONSTD(type) type
+/**
+ * The public ACR variables are declared with ACR_DECLARE_DATA.
+ * This assures the appropriate indirection is invoked at compile time.
+ *
+ * @deffunc ACR_DECLARE_DATA type apr_variable;
+ * @tip extern ACR_DECLARE_DATA type apr_variable; syntax is required for
+ * declarations within headers to properly import the variable.
+ */
+#define ACR_DECLARE_DATA
-#define ACR_CLASS_PATH "org/apache/commons/runtime/"
-#define ACR_JNI_EXPORT_DECLARE(RT, CL, MN) \
- JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_##CL##_##MN
+#define ACR_MODULE_DECLARE(type) type
+#define ACR_MODULE_DECLARE_NONSTD(type) type
+#define ACR_MODULE_DECLARE_DATA
+#endif
#ifdef __cplusplus
}
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_error.h Mon Apr 13 07:42:50 2009
@@ -55,54 +55,1059 @@
* @param file Source file from where this function was called
* @param line Source file line from where this function was called
*/
- ACR_DECLARE(void) ACR_ThrowClassEx(JNIEnv *env, const char *clazz,
+ ACR_DECLARE(void) ACR_ThrowClassEx(JNIEnv *env,
const char *file, int line,
+ const char *clazz,
const char *msg);
/*
- * Convenience function to help throw an java.lang.Exception.
- * param
+ * Convenience function to help throw any class with
+ * file and line number from where the exception was called.
* @param env JNI Environment
- * @param msg The message used to construct the Exception object.
- */
-ACR_DECLARE(void) ACR_ThrowException(JNIEnv *env, const char *msg);
-
-/*
- * Convenience function to help throw an java.io.IOException.
- * @param env JNI Environment
- * @param msg The message used to construct the IOException oject.
- */
-ACR_DECLARE(void) ACR_ThrowIOException(JNIEnv *env, const char *msg);
-
-/*
- * Convenience function to help throw an java.lang.OutOfMemoryError.
- * @param env JNI Environment
- * @param msg The message used to construct the OutOfMemoryError object.
* @param file Source file from where this function was called
* @param line Source file line from where this function was called
+ * @param clazz Java class to throw.
+ * @param msg The message used to construct the Throwable object.
*/
-ACR_DECLARE(void) ACR_ThrowMemoryException(JNIEnv *env, const char *file,
- int line, const char *msg);
+ACR_DECLARE(void) ACR_ThrowExceptionA(JNIEnv *env,
+ const char *file, int line,
+ acr_trowclass_e clazz, const char *msg);
/*
- * Convenience function to help throw an java.lang.NullPointerException.
+ * Convenience function to help throw any class with
+ * file and line number from where the exception was called.
* @param env JNI Environment
- * @param msg The message used to construct the NullPointerException object.
* @param file Source file from where this function was called
* @param line Source file line from where this function was called
+ * @param clazz Java class to throw.
+ * @param err Error number.
+ */
+ACR_DECLARE(void) ACR_ThrowException(JNIEnv *env,
+ const char *file, int line,
+ acr_trowclass_e clazz, int err);
+
+/**
+ * @defgroup apr_errno Error Codes
+ * @ingroup ACR
+ * @{
+ */
+
+/**
+ * Return a human readable string describing the specified error.
+ * @param statcode The error code the get a string for.
+ * @param buf A buffer to hold the error string.
+ * @param bufsize Size of the buffer to hold the string.
+ */
+ACR_DECLARE(char *) ACR_GetErrorString(int statcode, char *buf,
+ acr_size_t bufsize);
+
+#if defined(DOXYGEN)
+/**
+ * @def ACR_FROM_OS_ERROR(os_err_type syserr)
+ * Fold a platform specific error into an apr_status_t code.
+ * @return apr_status_t
+ * @param e The platform os error code.
+ * @warning macro implementation; the syserr argument may be evaluated
+ * multiple times.
+ */
+#define ACR_FROM_OS_ERROR(e) (e == 0 ? ACR_SUCCESS : e + ACR_OS_START_SYSERR)
+
+/**
+ * @def ACR_TO_OS_ERROR(apr_status_t statcode)
+ * @return os_err_type
+ * Fold an apr_status_t code back to the native platform defined error.
+ * @param e The apr_status_t folded platform os error code.
+ * @warning macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or ACR_FROM_OS_ERROR, the results are undefined.
+ */
+#define ACR_TO_OS_ERROR(e) (e == 0 ? ACR_SUCCESS : e - ACR_OS_START_SYSERR)
+
+/** @def apr_get_os_error()
+ * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
+ * @remark This retrieves errno, or calls a GetLastError() style function, and
+ * folds it with ACR_FROM_OS_ERROR. Some platforms (such as OS2) have no
+ * such mechanism, so this call may be unsupported. Do NOT use this
+ * call for socket errors from socket, send, recv etc!
+ */
+
+/** @def apr_set_os_error(e)
+ * Reset the last platform error, unfolded from an apr_status_t, on some platforms
+ * @param e The OS error folded in a prior call to ACR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or ACR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a SetLastError() style function, unfolding statcode
+ * with ACR_TO_OS_ERROR. Some platforms (such as OS2) have no such
+ * mechanism, so this call may be unsupported.
+ */
+
+/** @def apr_get_netos_error()
+ * Return the last socket error, folded into apr_status_t, on all platforms
+ * @remark This retrieves errno or calls a GetLastSocketError() style function,
+ * and folds it with ACR_FROM_OS_ERROR.
+ */
+
+/** @def apr_set_netos_error(e)
+ * Reset the last socket error, unfolded from an apr_status_t
+ * @param e The socket error folded in a prior call to ACR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or ACR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a WSASetLastError() style function, unfolding
+ * socketcode with ACR_TO_OS_ERROR.
+ */
+
+#endif /* defined(DOXYGEN) */
+
+/**
+ * ACR_OS_START_ERROR is where the ACR specific error values start.
+ */
+#define ACR_OS_START_ERROR 20000
+/**
+ * ACR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
+ * into one of the error/status ranges below -- except for
+ * ACR_OS_START_USERERR, which see.
+ */
+#define ACR_OS_ERRSPACE_SIZE 50000
+/**
+ * ACR_UTIL_ERRSPACE_SIZE is the size of the space that is reserved for
+ * use within apr-util. This space is reserved above that used by ACR
+ * internally.
+ * @note This number MUST be smaller than ACR_OS_ERRSPACE_SIZE by a
+ * large enough amount that ACR has sufficient room for it's
+ * codes.
+ */
+#define ACR_UTIL_ERRSPACE_SIZE 20000
+/**
+ * ACR_OS_START_STATUS is where the ACR specific status codes start.
+ */
+#define ACR_OS_START_STATUS (ACR_OS_START_ERROR + ACR_OS_ERRSPACE_SIZE)
+/**
+ * ACR_UTIL_START_STATUS is where ACR-Util starts defining it's
+ * status codes.
+ */
+#define ACR_UTIL_START_STATUS (ACR_OS_START_STATUS + \
+ (ACR_OS_ERRSPACE_SIZE - ACR_UTIL_ERRSPACE_SIZE))
+/**
+ * ACR_OS_START_USERERR are reserved for applications that use ACR that
+ * layer their own error codes along with ACR's. Note that the
+ * error immediately following this one is set ten times farther
+ * away than usual, so that users of apr have a lot of room in
+ * which to declare custom error codes.
+ *
+ * In general applications should try and create unique error codes. To try
+ * and assist in finding suitable ranges of numbers to use, the following
+ * ranges are known to be used by the listed applications. If your
+ * application defines error codes please advise the range of numbers it
+ * uses to dev@apr.apache.org for inclusion in this list.
+ *
+ * Ranges shown are in relation to ACR_OS_START_USERERR
+ *
+ * Subversion - Defined ranges, of less than 100, at intervals of 5000
+ * starting at an offset of 5000, e.g.
+ * +5000 to 5100, +10000 to 10100
+ */
+#define ACR_OS_START_USERERR (ACR_OS_START_STATUS + ACR_OS_ERRSPACE_SIZE)
+/**
+ * ACR_OS_START_USEERR is obsolete, defined for compatibility only.
+ * Use ACR_OS_START_USERERR instead.
+ */
+#define ACR_OS_START_USEERR ACR_OS_START_USERERR
+/**
+ * ACR_OS_START_CANONERR is where ACR versions of errno values are defined
+ * on systems which don't have the corresponding errno.
+ */
+#define ACR_OS_START_CANONERR (ACR_OS_START_USERERR \
+ + (ACR_OS_ERRSPACE_SIZE * 10))
+/**
+ * ACR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
+ * apr_status_t values.
+ */
+#define ACR_OS_START_EAIERR (ACR_OS_START_CANONERR + ACR_OS_ERRSPACE_SIZE)
+/**
+ * ACR_OS_START_SYSERR folds platform-specific system error values into
+ * apr_status_t values.
+ */
+#define ACR_OS_START_SYSERR (ACR_OS_START_EAIERR + ACR_OS_ERRSPACE_SIZE)
+
+/**
+ * @defgroup ACR_ERROR_map ACR Error Space
+ * <PRE>
+ * The following attempts to show the relation of the various constants
+ * used for mapping ACR Status codes.
+ *
+ * 0
+ *
+ * 20,000 ACR_OS_START_ERROR
+ *
+ * + ACR_OS_ERRSPACE_SIZE (50,000)
+ *
+ * 70,000 ACR_OS_START_STATUS
+ *
+ * + ACR_OS_ERRSPACE_SIZE - ACR_UTIL_ERRSPACE_SIZE (30,000)
+ *
+ * 100,000 ACR_UTIL_START_STATUS
+ *
+ * + ACR_UTIL_ERRSPACE_SIZE (20,000)
+ *
+ * 120,000 ACR_OS_START_USERERR
+ *
+ * + 10 x ACR_OS_ERRSPACE_SIZE (50,000 * 10)
+ *
+ * 620,000 ACR_OS_START_CANONERR
+ *
+ * + ACR_OS_ERRSPACE_SIZE (50,000)
+ *
+ * 670,000 ACR_OS_START_EAIERR
+ *
+ * + ACR_OS_ERRSPACE_SIZE (50,000)
+ *
+ * 720,000 ACR_OS_START_SYSERR
+ *
+ * </PRE>
+ */
+
+/** no error. */
+#define ACR_SUCCESS 0
+
+/**
+ * @defgroup ACR_Error ACR Error Values
+ * <PRE>
+ * <b>ACR ERROR VALUES</b>
+ * ACR_ENOSTAT ACR was unable to perform a stat on the file
+ * ACR_ENOPOOL ACR was not provided a pool with which to allocate memory
+ * ACR_EBADDATE ACR was given an invalid date
+ * ACR_EINVALSOCK ACR was given an invalid socket
+ * ACR_ENOPROC ACR was not given a process structure
+ * ACR_ENOTIME ACR was not given a time structure
+ * ACR_ENODIR ACR was not given a directory structure
+ * ACR_ENOLOCK ACR was not given a lock structure
+ * ACR_ENOPOLL ACR was not given a poll structure
+ * ACR_ENOSOCKET ACR was not given a socket
+ * ACR_ENOTHREAD ACR was not given a thread structure
+ * ACR_ENOTHDKEY ACR was not given a thread key structure
+ * ACR_ENOSHMAVAIL There is no more shared memory available
+ * ACR_EDSOOPEN ACR was unable to open the dso object. For more
+ * information call apr_dso_error().
+ * ACR_EGENERAL General failure (specific information not available)
+ * ACR_EBADIP The specified IP address is invalid
+ * ACR_EBADMASK The specified netmask is invalid
+ * ACR_ESYMNOTFOUND Could not find the requested symbol
+ * ACR_ENOTENOUGHENTROPY Not enough entropy to continue
+ * </PRE>
+ *
+ * <PRE>
+ * <b>ACR STATUS VALUES</b>
+ * ACR_INCHILD Program is currently executing in the child
+ * ACR_INPARENT Program is currently executing in the parent
+ * ACR_DETACH The thread is detached
+ * ACR_NOTDETACH The thread is not detached
+ * ACR_CHILD_DONE The child has finished executing
+ * ACR_CHILD_NOTDONE The child has not finished executing
+ * ACR_TIMEUP The operation did not finish before the timeout
+ * ACR_INCOMPLETE The operation was incomplete although some processing
+ * was performed and the results are partially valid
+ * ACR_BADCH Getopt found an option not in the option string
+ * ACR_BADARG Getopt found an option that is missing an argument
+ * and an argument was specified in the option string
+ * ACR_EOF ACR has encountered the end of the file
+ * ACR_NOTFOUND ACR was unable to find the socket in the poll structure
+ * ACR_ANONYMOUS ACR is using anonymous shared memory
+ * ACR_FILEBASED ACR is using a file name as the key to the shared memory
+ * ACR_KEYBASED ACR is using a shared key as the key to the shared memory
+ * ACR_EINIT Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * ACR_ENOTIMPL The ACR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * ACR_EMISMATCH Two passwords do not match.
+ * ACR_EABSOLUTE The given path was absolute.
+ * ACR_ERELATIVE The given path was relative.
+ * ACR_EINCOMPLETE The given path was neither relative nor absolute.
+ * ACR_EABOVEROOT The given path was above the root path.
+ * ACR_EBUSY The given lock was busy.
+ * ACR_EPROC_UNKNOWN The given process wasn't recognized by ACR
+ * </PRE>
+ * @{
+ */
+/** @see ACR_STATUS_IS_ENOSTAT */
+#define ACR_ENOSTAT (ACR_OS_START_ERROR + 1)
+/** @see ACR_STATUS_IS_ENOPOOL */
+#define ACR_ENOPOOL (ACR_OS_START_ERROR + 2)
+/* empty slot: +3 */
+/** @see ACR_STATUS_IS_EBADDATE */
+#define ACR_EBADDATE (ACR_OS_START_ERROR + 4)
+/** @see ACR_STATUS_IS_EINVALSOCK */
+#define ACR_EINVALSOCK (ACR_OS_START_ERROR + 5)
+/** @see ACR_STATUS_IS_ENOPROC */
+#define ACR_ENOPROC (ACR_OS_START_ERROR + 6)
+/** @see ACR_STATUS_IS_ENOTIME */
+#define ACR_ENOTIME (ACR_OS_START_ERROR + 7)
+/** @see ACR_STATUS_IS_ENODIR */
+#define ACR_ENODIR (ACR_OS_START_ERROR + 8)
+/** @see ACR_STATUS_IS_ENOLOCK */
+#define ACR_ENOLOCK (ACR_OS_START_ERROR + 9)
+/** @see ACR_STATUS_IS_ENOPOLL */
+#define ACR_ENOPOLL (ACR_OS_START_ERROR + 10)
+/** @see ACR_STATUS_IS_ENOSOCKET */
+#define ACR_ENOSOCKET (ACR_OS_START_ERROR + 11)
+/** @see ACR_STATUS_IS_ENOTHREAD */
+#define ACR_ENOTHREAD (ACR_OS_START_ERROR + 12)
+/** @see ACR_STATUS_IS_ENOTHDKEY */
+#define ACR_ENOTHDKEY (ACR_OS_START_ERROR + 13)
+/** @see ACR_STATUS_IS_EGENERAL */
+#define ACR_EGENERAL (ACR_OS_START_ERROR + 14)
+/** @see ACR_STATUS_IS_ENOSHMAVAIL */
+#define ACR_ENOSHMAVAIL (ACR_OS_START_ERROR + 15)
+/** @see ACR_STATUS_IS_EBADIP */
+#define ACR_EBADIP (ACR_OS_START_ERROR + 16)
+/** @see ACR_STATUS_IS_EBADMASK */
+#define ACR_EBADMASK (ACR_OS_START_ERROR + 17)
+/* empty slot: +18 */
+/** @see ACR_STATUS_IS_EDSOPEN */
+#define ACR_EDSOOPEN (ACR_OS_START_ERROR + 19)
+/** @see ACR_STATUS_IS_EABSOLUTE */
+#define ACR_EABSOLUTE (ACR_OS_START_ERROR + 20)
+/** @see ACR_STATUS_IS_ERELATIVE */
+#define ACR_ERELATIVE (ACR_OS_START_ERROR + 21)
+/** @see ACR_STATUS_IS_EINCOMPLETE */
+#define ACR_EINCOMPLETE (ACR_OS_START_ERROR + 22)
+/** @see ACR_STATUS_IS_EABOVEROOT */
+#define ACR_EABOVEROOT (ACR_OS_START_ERROR + 23)
+/** @see ACR_STATUS_IS_EBADPATH */
+#define ACR_EBADPATH (ACR_OS_START_ERROR + 24)
+/** @see ACR_STATUS_IS_EPATHWILD */
+#define ACR_EPATHWILD (ACR_OS_START_ERROR + 25)
+/** @see ACR_STATUS_IS_ESYMNOTFOUND */
+#define ACR_ESYMNOTFOUND (ACR_OS_START_ERROR + 26)
+/** @see ACR_STATUS_IS_EPROC_UNKNOWN */
+#define ACR_EPROC_UNKNOWN (ACR_OS_START_ERROR + 27)
+/** @see ACR_STATUS_IS_ENOTENOUGHENTROPY */
+#define ACR_ENOTENOUGHENTROPY (ACR_OS_START_ERROR + 28)
+/** @} */
+
+#define ACR_EISNULL (ACR_OS_START_ERROR + 29)
+#define ACR_EINVALSIZ (ACR_OS_START_ERROR + 30)
+#define ACR_ERANGE (ACR_OS_START_ERROR + 31)
+
+/**
+ * @defgroup ACR_STATUS_IS Status Value Tests
+ * @warning For any particular error condition, more than one of these tests
+ * may match. This is because platform-specific error codes may not
+ * always match the semantics of the POSIX codes these tests (and the
+ * corresponding ACR error codes) are named after. A notable example
+ * are the ACR_STATUS_IS_ENOENT and ACR_STATUS_IS_ENOTDIR tests on
+ * Win32 platforms. The programmer should always be aware of this and
+ * adjust the order of the tests accordingly.
+ * @{
+ */
+/**
+ * ACR was unable to perform a stat on the file
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_ENOSTAT(s) ((s) == ACR_ENOSTAT)
+/**
+ * ACR was not provided a pool with which to allocate memory
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_ENOPOOL(s) ((s) == ACR_ENOPOOL)
+/** ACR was given an invalid date */
+#define ACR_STATUS_IS_EBADDATE(s) ((s) == ACR_EBADDATE)
+/** ACR was given an invalid socket */
+#define ACR_STATUS_IS_EINVALSOCK(s) ((s) == ACR_EINVALSOCK)
+/** ACR was not given a process structure */
+#define ACR_STATUS_IS_ENOPROC(s) ((s) == ACR_ENOPROC)
+/** ACR was not given a time structure */
+#define ACR_STATUS_IS_ENOTIME(s) ((s) == ACR_ENOTIME)
+/** ACR was not given a directory structure */
+#define ACR_STATUS_IS_ENODIR(s) ((s) == ACR_ENODIR)
+/** ACR was not given a lock structure */
+#define ACR_STATUS_IS_ENOLOCK(s) ((s) == ACR_ENOLOCK)
+/** ACR was not given a poll structure */
+#define ACR_STATUS_IS_ENOPOLL(s) ((s) == ACR_ENOPOLL)
+/** ACR was not given a socket */
+#define ACR_STATUS_IS_ENOSOCKET(s) ((s) == ACR_ENOSOCKET)
+/** ACR was not given a thread structure */
+#define ACR_STATUS_IS_ENOTHREAD(s) ((s) == ACR_ENOTHREAD)
+/** ACR was not given a thread key structure */
+#define ACR_STATUS_IS_ENOTHDKEY(s) ((s) == ACR_ENOTHDKEY)
+/** Generic Error which can not be put into another spot */
+#define ACR_STATUS_IS_EGENERAL(s) ((s) == ACR_EGENERAL)
+/** There is no more shared memory available */
+#define ACR_STATUS_IS_ENOSHMAVAIL(s) ((s) == ACR_ENOSHMAVAIL)
+/** The specified IP address is invalid */
+#define ACR_STATUS_IS_EBADIP(s) ((s) == ACR_EBADIP)
+/** The specified netmask is invalid */
+#define ACR_STATUS_IS_EBADMASK(s) ((s) == ACR_EBADMASK)
+/* empty slot: +18 */
+/**
+ * ACR was unable to open the dso object.
+ * For more information call apr_dso_error().
+ */
+#if defined(WIN32)
+#define ACR_STATUS_IS_EDSOOPEN(s) ((s) == ACR_EDSOOPEN \
+ || ACR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND)
+#else
+#define ACR_STATUS_IS_EDSOOPEN(s) ((s) == ACR_EDSOOPEN)
+#endif
+/** The given path was absolute. */
+#define ACR_STATUS_IS_EABSOLUTE(s) ((s) == ACR_EABSOLUTE)
+/** The given path was relative. */
+#define ACR_STATUS_IS_ERELATIVE(s) ((s) == ACR_ERELATIVE)
+/** The given path was neither relative nor absolute. */
+#define ACR_STATUS_IS_EINCOMPLETE(s) ((s) == ACR_EINCOMPLETE)
+/** The given path was above the root path. */
+#define ACR_STATUS_IS_EABOVEROOT(s) ((s) == ACR_EABOVEROOT)
+/** The given path was bad. */
+#define ACR_STATUS_IS_EBADPATH(s) ((s) == ACR_EBADPATH)
+/** The given path contained wildcards. */
+#define ACR_STATUS_IS_EPATHWILD(s) ((s) == ACR_EPATHWILD)
+/** Could not find the requested symbol.
+ * For more information call apr_dso_error().
+ */
+#if defined(WIN32)
+#define ACR_STATUS_IS_ESYMNOTFOUND(s) ((s) == ACR_ESYMNOTFOUND \
+ || ACR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND)
+#else
+#define ACR_STATUS_IS_ESYMNOTFOUND(s) ((s) == ACR_ESYMNOTFOUND)
+#endif
+/** The given process was not recognized by ACR. */
+#define ACR_STATUS_IS_EPROC_UNKNOWN(s) ((s) == ACR_EPROC_UNKNOWN)
+/** ACR could not gather enough entropy to continue. */
+#define ACR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == ACR_ENOTENOUGHENTROPY)
+
+/** @} */
+
+/**
+ * @addtogroup ACR_Error
+ * @{
+ */
+/** @see ACR_STATUS_IS_INCHILD */
+#define ACR_INCHILD (ACR_OS_START_STATUS + 1)
+/** @see ACR_STATUS_IS_INPARENT */
+#define ACR_INPARENT (ACR_OS_START_STATUS + 2)
+/** @see ACR_STATUS_IS_DETACH */
+#define ACR_DETACH (ACR_OS_START_STATUS + 3)
+/** @see ACR_STATUS_IS_NOTDETACH */
+#define ACR_NOTDETACH (ACR_OS_START_STATUS + 4)
+/** @see ACR_STATUS_IS_CHILD_DONE */
+#define ACR_CHILD_DONE (ACR_OS_START_STATUS + 5)
+/** @see ACR_STATUS_IS_CHILD_NOTDONE */
+#define ACR_CHILD_NOTDONE (ACR_OS_START_STATUS + 6)
+/** @see ACR_STATUS_IS_TIMEUP */
+#define ACR_TIMEUP (ACR_OS_START_STATUS + 7)
+/** @see ACR_STATUS_IS_INCOMPLETE */
+#define ACR_INCOMPLETE (ACR_OS_START_STATUS + 8)
+/* empty slot: +9 */
+/* empty slot: +10 */
+/* empty slot: +11 */
+/** @see ACR_STATUS_IS_BADCH */
+#define ACR_BADCH (ACR_OS_START_STATUS + 12)
+/** @see ACR_STATUS_IS_BADARG */
+#define ACR_BADARG (ACR_OS_START_STATUS + 13)
+/** @see ACR_STATUS_IS_EOF */
+#define ACR_EOF (ACR_OS_START_STATUS + 14)
+/** @see ACR_STATUS_IS_NOTFOUND */
+#define ACR_NOTFOUND (ACR_OS_START_STATUS + 15)
+/* empty slot: +16 */
+/* empty slot: +17 */
+/* empty slot: +18 */
+/** @see ACR_STATUS_IS_ANONYMOUS */
+#define ACR_ANONYMOUS (ACR_OS_START_STATUS + 19)
+/** @see ACR_STATUS_IS_FILEBASED */
+#define ACR_FILEBASED (ACR_OS_START_STATUS + 20)
+/** @see ACR_STATUS_IS_KEYBASED */
+#define ACR_KEYBASED (ACR_OS_START_STATUS + 21)
+/** @see ACR_STATUS_IS_EINIT */
+#define ACR_EINIT (ACR_OS_START_STATUS + 22)
+/** @see ACR_STATUS_IS_ENOTIMPL */
+#define ACR_ENOTIMPL (ACR_OS_START_STATUS + 23)
+/** @see ACR_STATUS_IS_EMISMATCH */
+#define ACR_EMISMATCH (ACR_OS_START_STATUS + 24)
+/** @see ACR_STATUS_IS_EBUSY */
+#define ACR_EBUSY (ACR_OS_START_STATUS + 25)
+/** @} */
+
+/**
+ * @addtogroup ACR_STATUS_IS
+ * @{
+ */
+/**
+ * Program is currently executing in the child
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code */
+#define ACR_STATUS_IS_INCHILD(s) ((s) == ACR_INCHILD)
+/**
+ * Program is currently executing in the parent
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_INPARENT(s) ((s) == ACR_INPARENT)
+/**
+ * The thread is detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_DETACH(s) ((s) == ACR_DETACH)
+/**
+ * The thread is not detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_NOTDETACH(s) ((s) == ACR_NOTDETACH)
+/**
+ * The child has finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_CHILD_DONE(s) ((s) == ACR_CHILD_DONE)
+/**
+ * The child has not finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_CHILD_NOTDONE(s) ((s) == ACR_CHILD_NOTDONE)
+/**
+ * The operation did not finish before the timeout
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_TIMEUP(s) ((s) == ACR_TIMEUP)
+/**
+ * The operation was incomplete although some processing was performed
+ * and the results are partially valid.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_INCOMPLETE(s) ((s) == ACR_INCOMPLETE)
+/* empty slot: +9 */
+/* empty slot: +10 */
+/* empty slot: +11 */
+/**
+ * Getopt found an option not in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_BADCH(s) ((s) == ACR_BADCH)
+/**
+ * Getopt found an option not in the option string and an argument was
+ * specified in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_BADARG(s) ((s) == ACR_BADARG)
+/**
+ * ACR has encountered the end of the file
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_EOF(s) ((s) == ACR_EOF)
+/**
+ * ACR was unable to find the socket in the poll structure
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_NOTFOUND(s) ((s) == ACR_NOTFOUND)
+/* empty slot: +16 */
+/* empty slot: +17 */
+/* empty slot: +18 */
+/**
+ * ACR is using anonymous shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_ANONYMOUS(s) ((s) == ACR_ANONYMOUS)
+/**
+ * ACR is using a file name as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_FILEBASED(s) ((s) == ACR_FILEBASED)
+/**
+ * ACR is using a shared key as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_KEYBASED(s) ((s) == ACR_KEYBASED)
+/**
+ * Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_EINIT(s) ((s) == ACR_EINIT)
+/**
+ * The ACR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_ENOTIMPL(s) ((s) == ACR_ENOTIMPL)
+/**
+ * Two passwords do not match.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_EMISMATCH(s) ((s) == ACR_EMISMATCH)
+/**
+ * The given lock was busy
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ */
+#define ACR_STATUS_IS_EBUSY(s) ((s) == ACR_EBUSY)
+
+/** @} */
+
+/**
+ * @addtogroup ACR_Error ACR Error Values
+ * @{
+ */
+/* ACR CANONICAL ERROR VALUES */
+/** @see ACR_STATUS_IS_EACCES */
+#ifdef EACCES
+#define ACR_EACCES EACCES
+#else
+#define ACR_EACCES (ACR_OS_START_CANONERR + 1)
+#endif
+
+/** @see ACR_STATUS_IS_EEXIST */
+#ifdef EEXIST
+#define ACR_EEXIST EEXIST
+#else
+#define ACR_EEXIST (ACR_OS_START_CANONERR + 2)
+#endif
+
+/** @see ACR_STATUS_IS_ENAMETOOLONG */
+#ifdef ENAMETOOLONG
+#define ACR_ENAMETOOLONG ENAMETOOLONG
+#else
+#define ACR_ENAMETOOLONG (ACR_OS_START_CANONERR + 3)
+#endif
+
+/** @see ACR_STATUS_IS_ENOENT */
+#ifdef ENOENT
+#define ACR_ENOENT ENOENT
+#else
+#define ACR_ENOENT (ACR_OS_START_CANONERR + 4)
+#endif
+
+/** @see ACR_STATUS_IS_ENOTDIR */
+#ifdef ENOTDIR
+#define ACR_ENOTDIR ENOTDIR
+#else
+#define ACR_ENOTDIR (ACR_OS_START_CANONERR + 5)
+#endif
+
+/** @see ACR_STATUS_IS_ENOSPC */
+#ifdef ENOSPC
+#define ACR_ENOSPC ENOSPC
+#else
+#define ACR_ENOSPC (ACR_OS_START_CANONERR + 6)
+#endif
+
+/** @see ACR_STATUS_IS_ENOMEM */
+#ifdef ENOMEM
+#define ACR_ENOMEM ENOMEM
+#else
+#define ACR_ENOMEM (ACR_OS_START_CANONERR + 7)
+#endif
+
+/** @see ACR_STATUS_IS_EMFILE */
+#ifdef EMFILE
+#define ACR_EMFILE EMFILE
+#else
+#define ACR_EMFILE (ACR_OS_START_CANONERR + 8)
+#endif
+
+/** @see ACR_STATUS_IS_ENFILE */
+#ifdef ENFILE
+#define ACR_ENFILE ENFILE
+#else
+#define ACR_ENFILE (ACR_OS_START_CANONERR + 9)
+#endif
+
+/** @see ACR_STATUS_IS_EBADF */
+#ifdef EBADF
+#define ACR_EBADF EBADF
+#else
+#define ACR_EBADF (ACR_OS_START_CANONERR + 10)
+#endif
+
+/** @see ACR_STATUS_IS_EINVAL */
+#ifdef EINVAL
+#define ACR_EINVAL EINVAL
+#else
+#define ACR_EINVAL (ACR_OS_START_CANONERR + 11)
+#endif
+
+/** @see ACR_STATUS_IS_ESPIPE */
+#ifdef ESPIPE
+#define ACR_ESPIPE ESPIPE
+#else
+#define ACR_ESPIPE (ACR_OS_START_CANONERR + 12)
+#endif
+
+/**
+ * @see ACR_STATUS_IS_EAGAIN
+ * @warning use ACR_STATUS_IS_EAGAIN instead of just testing this value
+ */
+#ifdef EAGAIN
+#define ACR_EAGAIN EAGAIN
+#elif defined(EWOULDBLOCK)
+#define ACR_EAGAIN EWOULDBLOCK
+#else
+#define ACR_EAGAIN (ACR_OS_START_CANONERR + 13)
+#endif
+
+/** @see ACR_STATUS_IS_EINTR */
+#ifdef EINTR
+#define ACR_EINTR EINTR
+#else
+#define ACR_EINTR (ACR_OS_START_CANONERR + 14)
+#endif
+
+/** @see ACR_STATUS_IS_ENOTSOCK */
+#ifdef ENOTSOCK
+#define ACR_ENOTSOCK ENOTSOCK
+#else
+#define ACR_ENOTSOCK (ACR_OS_START_CANONERR + 15)
+#endif
+
+/** @see ACR_STATUS_IS_ECONNREFUSED */
+#ifdef ECONNREFUSED
+#define ACR_ECONNREFUSED ECONNREFUSED
+#else
+#define ACR_ECONNREFUSED (ACR_OS_START_CANONERR + 16)
+#endif
+
+/** @see ACR_STATUS_IS_EINPROGRESS */
+#ifdef EINPROGRESS
+#define ACR_EINPROGRESS EINPROGRESS
+#else
+#define ACR_EINPROGRESS (ACR_OS_START_CANONERR + 17)
+#endif
+
+/**
+ * @see ACR_STATUS_IS_ECONNABORTED
+ * @warning use ACR_STATUS_IS_ECONNABORTED instead of just testing this value
*/
-ACR_DECLARE(void) ACR_ThrowNullPointerException(JNIEnv *env, const char *file,
- int line, const char *msg);
+
+#ifdef ECONNABORTED
+#define ACR_ECONNABORTED ECONNABORTED
+#else
+#define ACR_ECONNABORTED (ACR_OS_START_CANONERR + 18)
+#endif
+
+/** @see ACR_STATUS_IS_ECONNRESET */
+#ifdef ECONNRESET
+#define ACR_ECONNRESET ECONNRESET
+#else
+#define ACR_ECONNRESET (ACR_OS_START_CANONERR + 19)
+#endif
+
+/** @see ACR_STATUS_IS_EHOSTUNREACH */
+#ifdef EHOSTUNREACH
+#define ACR_EHOSTUNREACH EHOSTUNREACH
+#else
+#define ACR_EHOSTUNREACH (ACR_OS_START_CANONERR + 21)
+#endif
+
+/** @see ACR_STATUS_IS_ENETUNREACH */
+#ifdef ENETUNREACH
+#define ACR_ENETUNREACH ENETUNREACH
+#else
+#define ACR_ENETUNREACH (ACR_OS_START_CANONERR + 22)
+#endif
+
+/** @see ACR_STATUS_IS_EFTYPE */
+#ifdef EFTYPE
+#define ACR_EFTYPE EFTYPE
+#else
+#define ACR_EFTYPE (ACR_OS_START_CANONERR + 23)
+#endif
+
+/** @see ACR_STATUS_IS_EPIPE */
+#ifdef EPIPE
+#define ACR_EPIPE EPIPE
+#else
+#define ACR_EPIPE (ACR_OS_START_CANONERR + 24)
+#endif
+
+/** @see ACR_STATUS_IS_EXDEV */
+#ifdef EXDEV
+#define ACR_EXDEV EXDEV
+#else
+#define ACR_EXDEV (ACR_OS_START_CANONERR + 25)
+#endif
+
+/** @see ACR_STATUS_IS_ENOTEMPTY */
+#ifdef ENOTEMPTY
+#define ACR_ENOTEMPTY ENOTEMPTY
+#else
+#define ACR_ENOTEMPTY (ACR_OS_START_CANONERR + 26)
+#endif
+
+/** @see ACR_STATUS_IS_EAFNOSUPPORT */
+#ifdef EAFNOSUPPORT
+#define ACR_EAFNOSUPPORT EAFNOSUPPORT
+#else
+#define ACR_EAFNOSUPPORT (ACR_OS_START_CANONERR + 27)
+#endif
+
+/** @} */
+
+#if defined(WIN32) && !defined(DOXYGEN)
+
+#define ACR_FROM_OS_ERROR(e) (e == 0 ? ACR_SUCCESS : e + ACR_OS_START_SYSERR)
+#define ACR_TO_OS_ERROR(e) (e == 0 ? ACR_SUCCESS : e - ACR_OS_START_SYSERR)
+
+#define ACR_GET_OS_ERROR() (ACR_FROM_OS_ERROR(GetLastError()))
+#define ACR_SET_OS_ERROR(e) (SetLastError(ACR_TO_OS_ERROR(e)))
+
+/* A special case, only socket calls require this:
+ */
+#define ACR_GET_NETOS_ERROR() (ACR_FROM_OS_ERROR(WSAGetLastError()))
+#define ACR_SET_NETOS_ERROR(e) (WSASetLastError(ACR_TO_OS_ERROR(e)))
+
+/* ACR CANONICAL ERROR TESTS */
+#define ACR_STATUS_IS_EACCES(s) ((s) == ACR_EACCES \
+ || (s) == ACR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
+ || (s) == ACR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_FAIL_I24 \
+ || (s) == ACR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == ACR_OS_START_SYSERR + ERROR_LOCK_FAILED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NOT_LOCKED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define ACR_STATUS_IS_EEXIST(s) ((s) == ACR_EEXIST \
+ || (s) == ACR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+ || (s) == ACR_OS_START_SYSERR + ERROR_ALREADY_EXISTS)
+#define ACR_STATUS_IS_ENAMETOOLONG(s) ((s) == ACR_ENAMETOOLONG \
+ || (s) == ACR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+ || (s) == ACR_OS_START_SYSERR + WSAENAMETOOLONG)
+#define ACR_STATUS_IS_ENOENT(s) ((s) == ACR_ENOENT \
+ || (s) == ACR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+ || (s) == ACR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == ACR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NO_MORE_FILES)
+#define ACR_STATUS_IS_ENOTDIR(s) ((s) == ACR_ENOTDIR \
+ || (s) == ACR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == ACR_OS_START_SYSERR + ERROR_BAD_NETPATH \
+ || (s) == ACR_OS_START_SYSERR + ERROR_BAD_NET_NAME \
+ || (s) == ACR_OS_START_SYSERR + ERROR_BAD_PATHNAME \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_DRIVE)
+#define ACR_STATUS_IS_ENOSPC(s) ((s) == ACR_ENOSPC \
+ || (s) == ACR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define ACR_STATUS_IS_ENOMEM(s) ((s) == ACR_ENOMEM \
+ || (s) == ACR_OS_START_SYSERR + ERROR_ARENA_TRASHED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_BLOCK \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \
+ || (s) == ACR_OS_START_SYSERR + ERROR_OUTOFMEMORY)
+#define ACR_STATUS_IS_EMFILE(s) ((s) == ACR_EMFILE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define ACR_STATUS_IS_ENFILE(s) ((s) == ACR_ENFILE)
+#define ACR_STATUS_IS_EBADF(s) ((s) == ACR_EBADF \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE)
+#define ACR_STATUS_IS_EINVAL(s) ((s) == ACR_EINVAL \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_ACCESS \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_DATA \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define ACR_STATUS_IS_ESPIPE(s) ((s) == ACR_ESPIPE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define ACR_STATUS_IS_EAGAIN(s) ((s) == ACR_EAGAIN \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NO_DATA \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \
+ || (s) == ACR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == ACR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define ACR_STATUS_IS_EINTR(s) ((s) == ACR_EINTR \
+ || (s) == ACR_OS_START_SYSERR + WSAEINTR)
+#define ACR_STATUS_IS_ENOTSOCK(s) ((s) == ACR_ENOTSOCK \
+ || (s) == ACR_OS_START_SYSERR + WSAENOTSOCK)
+#define ACR_STATUS_IS_ECONNREFUSED(s) ((s) == ACR_ECONNREFUSED \
+ || (s) == ACR_OS_START_SYSERR + WSAECONNREFUSED)
+#define ACR_STATUS_IS_EINPROGRESS(s) ((s) == ACR_EINPROGRESS \
+ || (s) == ACR_OS_START_SYSERR + WSAEINPROGRESS)
+#define ACR_STATUS_IS_ECONNABORTED(s) ((s) == ACR_ECONNABORTED \
+ || (s) == ACR_OS_START_SYSERR + WSAECONNABORTED)
+#define ACR_STATUS_IS_ECONNRESET(s) ((s) == ACR_ECONNRESET \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NETNAME_DELETED \
+ || (s) == ACR_OS_START_SYSERR + WSAECONNRESET)
+/* Include WSA codes in TIMEUP */
+#undef ACR_STATUS_IS_TIMEUP
+#define ACR_STATUS_IS_TIMEUP(s) ((s) == ACR_TIMEUP \
+ || (s) == ACR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == ACR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define ACR_STATUS_IS_EHOSTUNREACH(s) ((s) == ACR_EHOSTUNREACH \
+ || (s) == ACR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define ACR_STATUS_IS_ENETUNREACH(s) ((s) == ACR_ENETUNREACH \
+ || (s) == ACR_OS_START_SYSERR + WSAENETUNREACH)
+#define ACR_STATUS_IS_EFTYPE(s) ((s) == ACR_EFTYPE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_DLL \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \
+ || (s) == ACR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_FILE_CORRUPT \
+ || (s) == ACR_OS_START_SYSERR + ERROR_BAD_FORMAT)
+#define ACR_STATUS_IS_EPIPE(s) ((s) == ACR_EPIPE \
+ || (s) == ACR_OS_START_SYSERR + ERROR_BROKEN_PIPE)
+#define ACR_STATUS_IS_EXDEV(s) ((s) == ACR_EXDEV \
+ || (s) == ACR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define ACR_STATUS_IS_ENOTEMPTY(s) ((s) == ACR_ENOTEMPTY \
+ || (s) == ACR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
+#define ACR_STATUS_IS_EAFNOSUPPORT(s) ((s) == ACR_EAFNOSUPPORT \
+ || (s) == ACR_OS_START_SYSERR + WSAEAFNOSUPPORT)
+
+#else /* !defined(WIN32) */
/*
- * Convenience function to help throw an java.lang.IllegalArgumentException.
- * @param env JNI Environment
- * @param msg The message used to construct the IllegalArgumentException object.
- * @param file Source file from where this function was called
- * @param line Source file line from where this function was called
+ * os error codes are clib error codes
+ */
+#define ACR_FROM_OS_ERROR(e) (e)
+#define ACR_TO_OS_ERROR(e) (e)
+
+#define ACR_GET_OS_ERROR() (errno)
+#define ACR_SET_OS_ERROR(e) (errno = (e))
+
+/* A special case, only socket calls require this:
*/
-ACR_DECLARE(void) ACR_ThrowArgumentException(JNIEnv *env, const char *file,
- int line, const char *msg);
+#define ACR_GET_NETOS_ERROR() (errno)
+#define ACR_SET_NETOS_ERROR(e) (errno = (e))
+
+/**
+ * @addtogroup ACR_STATUS_IS
+ * @{
+ */
+
+/** permission denied */
+#define ACR_STATUS_IS_EACCES(s) ((s) == ACR_EACCES)
+/** file exists */
+#define ACR_STATUS_IS_EEXIST(s) ((s) == ACR_EEXIST)
+/** path name is too long */
+#define ACR_STATUS_IS_ENAMETOOLONG(s) ((s) == ACR_ENAMETOOLONG)
+/**
+ * no such file or directory
+ * @remark
+ * EMVSCATLG can be returned by the automounter on z/OS for
+ * paths which do not exist.
+ */
+#ifdef EMVSCATLG
+#define ACR_STATUS_IS_ENOENT(s) ((s) == ACR_ENOENT \
+ || (s) == EMVSCATLG)
+#else
+#define ACR_STATUS_IS_ENOENT(s) ((s) == ACR_ENOENT)
+#endif
+/** not a directory */
+#define ACR_STATUS_IS_ENOTDIR(s) ((s) == ACR_ENOTDIR)
+/** no space left on device */
+#ifdef EDQUOT
+#define ACR_STATUS_IS_ENOSPC(s) ((s) == ACR_ENOSPC \
+ || (s) == EDQUOT)
+#else
+#define ACR_STATUS_IS_ENOSPC(s) ((s) == ACR_ENOSPC)
+#endif
+/** not enough memory */
+#define ACR_STATUS_IS_ENOMEM(s) ((s) == ACR_ENOMEM)
+/** too many open files */
+#define ACR_STATUS_IS_EMFILE(s) ((s) == ACR_EMFILE)
+/** file table overflow */
+#define ACR_STATUS_IS_ENFILE(s) ((s) == ACR_ENFILE)
+/** bad file # */
+#define ACR_STATUS_IS_EBADF(s) ((s) == ACR_EBADF)
+/** invalid argument */
+#define ACR_STATUS_IS_EINVAL(s) ((s) == ACR_EINVAL)
+/** illegal seek */
+#define ACR_STATUS_IS_ESPIPE(s) ((s) == ACR_ESPIPE)
+
+/** operation would block */
+#if !defined(EWOULDBLOCK) || !defined(EAGAIN)
+#define ACR_STATUS_IS_EAGAIN(s) ((s) == ACR_EAGAIN)
+#elif (EWOULDBLOCK == EAGAIN)
+#define ACR_STATUS_IS_EAGAIN(s) ((s) == ACR_EAGAIN)
+#else
+#define ACR_STATUS_IS_EAGAIN(s) ((s) == ACR_EAGAIN \
+ || (s) == EWOULDBLOCK)
+#endif
+
+/** interrupted system call */
+#define ACR_STATUS_IS_EINTR(s) ((s) == ACR_EINTR)
+/** socket operation on a non-socket */
+#define ACR_STATUS_IS_ENOTSOCK(s) ((s) == ACR_ENOTSOCK)
+/** Connection Refused */
+#define ACR_STATUS_IS_ECONNREFUSED(s) ((s) == ACR_ECONNREFUSED)
+/** operation now in progress */
+#define ACR_STATUS_IS_EINPROGRESS(s) ((s) == ACR_EINPROGRESS)
+
+/**
+ * Software caused connection abort
+ * @remark
+ * EPROTO on certain older kernels really means ECONNABORTED, so we need to
+ * ignore it for them. See discussion in new-httpd archives nh.9701 & nh.9603
+ *
+ * There is potentially a bug in Solaris 2.x x<6, and other boxes that
+ * implement tcp sockets in userland (i.e. on top of STREAMS). On these
+ * systems, EPROTO can actually result in a fatal loop. See PR#981 for
+ * example. It's hard to handle both uses of EPROTO.
+ */
+#ifdef EPROTO
+#define ACR_STATUS_IS_ECONNABORTED(s) ((s) == ACR_ECONNABORTED \
+ || (s) == EPROTO)
+#else
+#define ACR_STATUS_IS_ECONNABORTED(s) ((s) == ACR_ECONNABORTED)
+#endif
+
+/** Connection Reset by peer */
+#define ACR_STATUS_IS_ECONNRESET(s) ((s) == ACR_ECONNRESET)
+/** no route to host */
+#define ACR_STATUS_IS_EHOSTUNREACH(s) ((s) == ACR_EHOSTUNREACH)
+/** network is unreachable */
+#define ACR_STATUS_IS_ENETUNREACH(s) ((s) == ACR_ENETUNREACH)
+/** inappropiate file type or format */
+#define ACR_STATUS_IS_EFTYPE(s) ((s) == ACR_EFTYPE)
+/** broken pipe */
+#define ACR_STATUS_IS_EPIPE(s) ((s) == ACR_EPIPE)
+/** cross device link */
+#define ACR_STATUS_IS_EXDEV(s) ((s) == ACR_EXDEV)
+/** Directory Not Empty */
+#define ACR_STATUS_IS_ENOTEMPTY(s) ((s) == ACR_ENOTEMPTY || \
+ (s) == ACR_EEXIST)
+/** Address Family not supported */
+#define ACR_STATUS_IS_EAFNOSUPPORT(s) ((s) == ACR_EAFNOSUPPORT)
+/** @} */
+
+#endif /* !defined(WIN32) */
#ifdef __cplusplus
}
Added: commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h?rev=764366&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h (added)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h Mon Apr 13 07:42:50 2009
@@ -0,0 +1,133 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _ACR_MEMORY_H
+#define _ACR_MEMORY_H
+
+#include "acr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file acr_memory.h
+ * @brief
+ *
+ * ACR Memory functions
+ *
+ */
+
+/** Opaque Small Block Heap structure */
+typedef struct acr_sbh_t acr_sbh_t;
+
+/**
+ * Apache's "replacement" for the malloc() function that throws
+ * thejava.lang.OutOfMemoryError in case of failure.
+ * @param env Current JNI environment.
+ * @param size Allocation size
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ * @return Pointer to allocated memory.
+ */
+ACR_DECLARE(void *) ACR_Malloc(JNIEnv *env, const char *file, int line,
+ acr_size_t size);
+
+
+/**
+ * Apache's "replacement" for the calloc() function that throws
+ * thejava.lang.OutOfMemoryError in case of failure.
+ * @param env Current JNI environment.
+ * @param size Allocation size
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ * @return Pointer to allocated memory with buffer set to zero.
+ */
+ACR_DECLARE(void *) ACR_Calloc(JNIEnv *env, const char *file, int line,
+ acr_size_t size);
+
+/**
+ * Apache's "replacement" for the free() function that throws
+ * the java.lang.NullPointerException in case of memory is NULL.
+ * @param env Current JNI environment.
+ * @param mem Memory location to free
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ */
+ACR_DECLARE(void) ACR_Free(JNIEnv *_E, const char *file, int line,
+ void *mem);
+
+/**
+ * Create Small Block Heap
+ * @param env Current JNI environment.
+ * @param buff Optional memory buffer to use. It has be larger then
+ * 128 bytes.
+ * @param size Size of the small block heap or the size of the buffer
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ */
+ACR_DECLARE(acr_sbh_t *) ACR_SbhCreate(JNIEnv *_E, const char *file, int line,
+ void *buff, acr_size_t size);
+
+/**
+ * Reset Small Block Heap
+ * @param env Current JNI environment.
+ * @param sbh Heap to reset.
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ */
+ACR_DECLARE(void ) ACR_SbhReset(JNIEnv *_E, const char *file, int line,
+ acr_sbh_t *sbh);
+
+/**
+ * Destroy Small Block Heap
+ * @param env Current JNI environment.
+ * @param sbh Heap to destroy.
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ */
+ACR_DECLARE(void ) ACR_SbhDestroy(JNIEnv *_E, const char *file, int line,
+ acr_sbh_t *sbh);
+
+/**
+ * Allocate the memory from the heap.
+ * @param env Current JNI environment.
+ * @param sbh Heap to use.
+ * @param size Allocation size
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ * @return Pointer to allocated memory.
+ */
+ACR_DECLARE(void *) ACR_SbhMalloc(JNIEnv *_E, const char *file, int line,
+ acr_sbh_t *sbh, acr_size_t size);
+
+/**
+ * Allocate the memory from the heap and set its value to zero.
+ * @param env Current JNI environment.
+ * @param sbh Heap to use.
+ * @param size Allocation size
+ * @param file Source file where the function was called
+ * @param line Source file line where the function was called
+ * @return Pointer to allocated memory.
+ */
+ACR_DECLARE(void *) ACR_SbhCalloc(JNIEnv *_E, const char *file, int line,
+ acr_sbh_t *sbh, acr_size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ACR_STRING_H */
Propchange: commons/sandbox/runtime/trunk/src/main/native/include/acr_memory.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_private.h Mon Apr 13 07:42:50 2009
@@ -31,6 +31,10 @@
*
*/
+#define ACR_CLASS_PATH "org/apache/commons/runtime/"
+#define ACR_JNI_EXPORT_DECLARE(RT, CL, MN) \
+ JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_##CL##_##MN
+
/* ACR_ALIGN() is only to be used to align on a power of 2 boundary */
#define ACR_ALIGN(size, boundary) \
(((size) + ((boundary) - 1)) & ~((boundary) - 1))
@@ -50,50 +54,52 @@
#define ACR_MAX(a, b) ((a) > (b) ? (a) : (b))
/* Default buffer sizes */
-#define ACR_SBUFFER_SIZ 512
-#define ACR_SBUFFER_LEN (ACR_SBUFFER_SIZ - 1)
+#define ACR_SBUFF_SIZ 512
+#define ACR_SBUFF_LEN (ACR_SBUFF_SIZ - 1)
-#define ACR_MBUFFER_SIZ 1024
-#define ACR_MBUFFER_LEN (ACR_MBUFFER_SIZ - 1)
+#define ACR_MBUFF_SIZ 1024
+#define ACR_MBUFF_LEN (ACR_MBUFF_SIZ - 1)
-#define ACR_HBUFFER_SIZ 8192
-#define ACR_HBUFFER_LEN (ACR_HBUFFER_SIZ - 1)
+#define ACR_HBUFF_SIZ 8192
+#define ACR_HBUFF_LEN (ACR_HBUFF_SIZ - 1)
-#define ACR_KBS(N) ((N) * 1024)
-#define ACR_KB (1024)
-#define ACR_MB (ACR_KB * ACR_KB)
-#define ACR_GB (ACR_MB * ACR_KB)
-#define ACR_TB (ACR_GB * ACR_KB)
+#define ACR_MAX_PROCESSES 65536
+
+#define ACR_KBS(N) ((N) * 1024)
+#define ACR_KB (1024)
+#define ACR_MB (ACR_KB * ACR_KB)
+#define ACR_GB (ACR_MB * ACR_KB)
+#define ACR_TB (ACR_GB * ACR_KB)
#define CSTR_TO_JSTRING(V) (*_E)->NewStringUTF(_E, (char *)(V))
-#define WSTR_TO_JSTRING(V) (*_E)->NewString(_E, (jchar *)(V), (jsize)wcslen((jchar *)(V)))
+#define WSTR_TO_JSTRING(V) (*_E)->NewString(_E, (jchar *)(V), (jsize)wcslen((wchar_t *)(V)))
#define ZSTR_TO_JSTRING(V, L) (*_E)->NewString(_E, (jchar *)(V), (L))
#define CSTR_GETCHAR(V) \
- const char *c##V = V ? (const char *)((*_E)->GetStringUTFChars(_E, V, 0)) : NULL
+ const char *_c##V = V ? (const char *)((*_E)->GetStringUTFChars(_E, V, 0)) : NULL
-#define CSTR_RELEASE(V) \
- if (c##V) (*_E)->ReleaseStringUTFChars(_E, V, c##V)
+#define CSTR_RELEASE(V) \
+ if (_c##V) (*_E)->ReleaseStringUTFChars(_E, V, _c##V)
#define WSTR_GETCHAR(V) \
- jsize wl##V = (*_E)->GetStringLength(_E, V); \
- const jchar *ws##V = V ? (const jchar *)((*_E)->GetStringChars(_E, V, 0)) : NULL; \
- jchar *w##V = NULL
-
-#define WSTR_DOALLOC(V) \
- w##V = (jchar *)malloc((wl##V + 1) * sizeof(jchar)); \
- wcsncpy(w##V, ws##V, wl##V); \
- w##V[wl##V] = 0
-
-#define WSTR_RELEASE(V) \
- if (ws##V) (*_E)->ReleaseStringChars(_E, V, ws##V); \
- if (ws##V) free (w##V)
+ jsize _wl##V = V ? (*_E)->GetStringLength(_E, V) : 0; \
+ const jchar *_ws##V = V ? (const jchar *)((*_E)->GetStringChars(_E, V, 0)) : NULL; \
+ wchar_t *_w##V = NULL
+
+#define WSTR_DOALLOC(V) \
+ _w##V = (wchar_t *)malloc((_wl##V + 1) * sizeof(wchar_t)); \
+ if (_wl##V) wcsncpy(_w##V, (const wchar_t *)_ws##V, _wl##V); \
+ _w##V[_wl##V] = 0
+
+#define WSTR_RELEASE(V) \
+ if (_ws##V) (*_E)->ReleaseStringChars(_E, V, _ws##V); \
+ if (_w##V) free (_w##V)
-#define RETURN_JCSTR(V) \
+#define RETURN_JCSTR(V) \
if ((V)) return (*_E)->NewStringUTF((_E), (V)); \
else return NULL
-#define RETURN_JWSTR(V) \
+#define RETURN_JWSTR(V) \
if ((V)) return (*_E)->NewString((_E), (V), wcslen((V))); \
else return NULL
@@ -204,11 +210,21 @@
#define ACR_JNISTDARGS JNIEnv *_E, jobject _O
#define P2J(P) ((jlong)LLT(P))
#define J2P(P, T) ((T)LLT((jlong)P))
-#define V2P(T, V) ((T)((T)0 + (V)))
+#define V2P(T, V) ((T)((char *)0 + (V)))
#define V2Z(V) ((V) ? JNI_TRUE : JNI_FALSE)
-#define J2W(V) w##V
-#define J2S(V) c##V
-
+#define J2W(V) _w##V
+#define J2S(V) _c##V
+#define W2L(V) _wl##V
+
+#if CC_SIZEOF_VOIDP == 8
+typedef jlong jniptr;
+#define P2N(P) ((jlong)LLT(P))
+#define N2P(P, T) ((T)LLT((jlong)P))
+#else
+typedef jint jniptr;
+#define P2N(P) ((jint)LLT(P))
+#define N2P(P, T) ((T)LLT((jint)P))
+#endif
#define IS_JOBJECT_NULL(E, O) \
(!(O) || ((*(E))->IsSameObject((E), (O), NULL) == JNI_TRUE))
@@ -221,7 +237,7 @@
int acr_class_##CL##_load(JNIEnv *_E)
#define ACR_CLASS_UDEF(CL) \
- void sight_class_##CL##_unload(JNIEnv *_E)
+ void acr_class_##CL##_unload(JNIEnv *_E)
#define ACR_CLASS_LDEC(CL) \
extern int acr_class_##CL##_load(JNIEnv *); \
Added: commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h?rev=764366&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h (added)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h Mon Apr 13 07:42:50 2009
@@ -0,0 +1,70 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _ACR_STRING_H
+#define _ACR_STRING_H
+
+#include "acr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file acr_string.h
+ * @brief
+ *
+ * ACR String functions
+ *
+ */
+
+/**
+ * Apache's "replacement" for the strncpy() function that nul terminates
+ * the string.
+ * @param dst Destination pointer
+ * @param src String to copy
+ * @param dsize Destination size
+ * @return Pointer to the terminating \0.
+ */
+ACR_DECLARE(char *) ACR_CopyStrn(char *dst, const char *src, acr_size_t dsize);
+
+/** Return the final element of the pathname.
+ * @param pathname Absolute or relative pathname using '\\' or '/' as
+ * separators.
+ */
+ACR_DECLARE(const char *) ACR_FilePathNameGet(const char *pathname);
+
+/** Convert JNI integer value to string
+ * @param n Number to convert.
+ * @remark The function allocates the string from memory, so it must
+ * be released after use.
+ */
+ACR_DECLARE(char *) ACR_Itoa(acr_int_t n);
+
+
+/** Convert JNI long value to string
+ * @param n Number to convert.
+ * @remark The function allocates the string from memory, so it must
+ * be released after use.
+ */
+ACR_DECLARE(char *) ACR_Ltoa(acr_long_t n);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ACR_STRING_H */
Propchange: commons/sandbox/runtime/trunk/src/main/native/include/acr_string.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_types.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_types.h?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_types.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_types.h Mon Apr 13 07:42:50 2009
@@ -32,18 +32,6 @@
*
*/
-/* Default buffer sizes */
-#define ACR_STYPE_SIZ 512
-#define ACR_STYPE_LEN (ACR_STYPE_SIZ - 1)
-
-#define ACR_MTYPE_SIZ 1024
-#define ACR_MTYPE_LEN (ACR_MTYPE_SIZ - 1)
-
-#define ACR_HTYPE_SIZ 8192
-#define ACR_HTYPE_LEN (ACR_HTYPE_SIZ - 1)
-
-#define ACR_MAX_PROCESSES 65536
-
typedef struct JAVA_C_ID {
jclass i;
jclass a;
@@ -107,6 +95,58 @@
/* XXX : BSD has more */
} acr_procstate_e;
+typedef enum {
+ ACR_EX_EGENERAL = 0, /* java/lang/Exception */
+ ACR_EX_ERUNTIME, /* java/lang/RuntimeException */
+ ACR_EX_ENOMEM, /* java/lang/OutOfMemoryError */
+ ACR_EX_ENULL, /* java/lang/NullPointerException */
+ ACR_EX_EINVAL, /* java/lang/IllegalArgumentException */
+ ACR_EX_EINDEX, /* java/lang/IndexOutOfBoundsException */
+ ACR_EX_EIO, /* java/io/IOException */
+ ACR_EX_ESOCK /* java/net/SocketException */
+} acr_trowclass_e;
+
+/**
+ * @defgroup acr_ctype ctype functions
+ * These macros allow correct support of 8-bit characters on systems which
+ * support 8-bit characters. Pretty dumb how the cast is required, but
+ * that's legacy libc for ya. These new macros do not support EOF like
+ * the standard macros do. Tough.
+ * @{
+ */
+/** @see isalnum */
+#define acr_isalnum(c) (isalnum(((unsigned char)(c))))
+/** @see isalpha */
+#define acr_isalpha(c) (isalpha(((unsigned char)(c))))
+/** @see iscntrl */
+#define acr_iscntrl(c) (iscntrl(((unsigned char)(c))))
+/** @see isdigit */
+#define acr_isdigit(c) (isdigit(((unsigned char)(c))))
+/** @see isgraph */
+#define acr_isgraph(c) (isgraph(((unsigned char)(c))))
+/** @see islower*/
+#define acr_islower(c) (islower(((unsigned char)(c))))
+/** @see isascii */
+#ifdef isascii
+#define acr_isascii(c) (isascii(((unsigned char)(c))))
+#else
+#define acr_isascii(c) (((c) & ~0x7f)==0)
+#endif
+/** @see isprint */
+#define acr_isprint(c) (isprint(((unsigned char)(c))))
+/** @see ispunct */
+#define acr_ispunct(c) (ispunct(((unsigned char)(c))))
+/** @see isspace */
+#define acr_isspace(c) (isspace(((unsigned char)(c))))
+/** @see isupper */
+#define apr_isupper(c) (isupper(((unsigned char)(c))))
+/** @see isxdigit */
+#define acr_isxdigit(c) (isxdigit(((unsigned char)(c))))
+/** @see tolower */
+#define acr_tolower(c) (tolower(((unsigned char)(c))))
+/** @see toupper */
+#define acr_toupper(c) (toupper(((unsigned char)(c))))
+
#ifdef __cplusplus
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h?rev=764366&r1=764365&r2=764366&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_version.h Mon Apr 13 07:42:50 2009
@@ -50,16 +50,16 @@
* programs such as structure size changes. No binary compatibility is
* possible across a change in the major version.
*/
-#define ACR_MAJOR_VERSION 1
+#define ACR_MAJOR_VERSION 0
/**
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading ACR_MAJOR_VERSION
*/
-#define ACR_MINOR_VERSION 0
+#define ACR_MINOR_VERSION 9
/** patch level */
-#define ACR_PATCH_VERSION 2
+#define ACR_PATCH_VERSION 3
/**
* This symbol is defined for internal, "development" copies of SIGHT.
@@ -92,6 +92,9 @@
##ACR_MINOR_VERSION ##, \
##ACR_PATCH_VERSION
+/** Return build timestamp
+ */
+ACR_DECLARE(const char *) ACR_GetLibraryBuilt();
#ifdef __cplusplus
}
Added: commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h?rev=764366&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h (added)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h Mon Apr 13 07:42:50 2009
@@ -0,0 +1,41 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _ACR_ARCH_PRIVATE_H
+#define _ACR_ARCH_PRIVATE_H
+
+#include "acr_arch_private.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file acr_arch_private.h
+ * @brief
+ *
+ * ACR Darwin platform private macros and defines
+ *
+ */
+#define ACR_ARCHIMPL_CLASS_PATH ACR_CLASS_PATH "platform/darwin/"
+#define ACR_JNI_ARCHIMPL_DECLARE(RT, CL, FN) \
+ JNIEXPORT RT JNICALL Java_org_apache_commons_runtime_platform_darwin_##CL##_##FN
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ACR_ARCH_PRIVATE_H */
Propchange: commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h
------------------------------------------------------------------------------
svn:eol-style = native