Author: mturk
Date: Fri Apr 29 14:01:07 2011
New Revision: 1097822

URL: http://svn.apache.org/viewvc?rev=1097822&view=rev
Log:
Use a proper name for OutputStream wrapper

Added:
    commons/sandbox/runtime/trunk/src/main/native/include/acr/ostream.h
      - copied, changed from r1097685, 
commons/sandbox/runtime/trunk/src/main/native/include/acr/baos.h
    commons/sandbox/runtime/trunk/src/main/native/shared/ostream.c
      - copied, changed from r1097804, 
commons/sandbox/runtime/trunk/src/main/native/shared/baos.c
Removed:
    commons/sandbox/runtime/trunk/src/main/native/include/acr/baos.h
    commons/sandbox/runtime/trunk/src/main/native/shared/baos.c
Modified:
    commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
    commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in
    commons/sandbox/runtime/trunk/src/main/native/os/unix/exec.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c
    commons/sandbox/runtime/trunk/src/main/native/shared/clazz.c

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=1097822&r1=1097821&r2=1097822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Fri Apr 29 
14:01:07 2011
@@ -99,7 +99,6 @@ LIBSOURCES=\
        $(TOPDIR)\port\bsdstring.c \
        $(TOPDIR)\port\bsdsys.c \
        $(TOPDIR)\shared\array.c \
-       $(TOPDIR)\shared\baos.c \
        $(TOPDIR)\shared\bzip2.c \
        $(TOPDIR)\shared\callback.c \
        $(TOPDIR)\shared\clazz.c \
@@ -113,6 +112,7 @@ LIBSOURCES=\
        $(TOPDIR)\shared\pointer.c \
        $(TOPDIR)\shared\object.c \
        $(TOPDIR)\shared\observer.c \
+       $(TOPDIR)\shared\ostream.c \
        $(TOPDIR)\shared\reflect.c \
        $(TOPDIR)\shared\sbuf.c \
        $(TOPDIR)\shared\sliceptr.c \

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in?rev=1097822&r1=1097821&r2=1097822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in Fri Apr 29 
14:01:07 2011
@@ -96,7 +96,6 @@ LIBSOURCES=\
        $(TOPDIR)/port/bsdstring.c \
        $(TOPDIR)/port/bsdsys.c \
        $(TOPDIR)/shared/array.c \
-       $(TOPDIR)/shared/baos.c \
        $(TOPDIR)/shared/bzip2.c \
        $(TOPDIR)/shared/callback.c \
        $(TOPDIR)/shared/clazz.c \
@@ -110,6 +109,7 @@ LIBSOURCES=\
        $(TOPDIR)/shared/pointer.c \
        $(TOPDIR)/shared/object.c \
        $(TOPDIR)/shared/observer.c \
+       $(TOPDIR)/shared/ostream.c \
        $(TOPDIR)/shared/reflect.c \
        $(TOPDIR)/shared/sbuf.c \
        $(TOPDIR)/shared/sliceptr.c \

Copied: commons/sandbox/runtime/trunk/src/main/native/include/acr/ostream.h 
(from r1097685, 
commons/sandbox/runtime/trunk/src/main/native/include/acr/baos.h)
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/ostream.h?p2=commons/sandbox/runtime/trunk/src/main/native/include/acr/ostream.h&p1=commons/sandbox/runtime/trunk/src/main/native/include/acr/baos.h&r1=1097685&r2=1097822&rev=1097822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/baos.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/ostream.h Fri Apr 
29 14:01:07 2011
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef _ACR_BAOS_H
-#define _ACR_BAOS_H
+#ifndef _ACR_OSTREAM_H
+#define _ACR_OSTREAM_H
 
 #include "acr/jnitypes.h"
 #include "acr/error.h"
@@ -27,12 +27,13 @@ extern "C" {
 ACR_CLASS_CTOR(OutputStream);
 ACR_CLASS_DTOR(OutputStream);
 
-int
-AcrWriteToOutputStream(JNI_STDARGS, const char *data, int len);
+int AcrWriteToOutputStream(JNI_STDARGS, const char *data, int len);
+int AcrPutcToOutputStream(JNI_STDARGS, int b);
+int AcrFlushOutputStream(JNI_STDARGS);
 
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* _ACR_BAOS_H */
+#endif /* _ACR_OSTREAM_H */

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/exec.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/exec.c?rev=1097822&r1=1097821&r2=1097822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/exec.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/exec.c Fri Apr 29 
14:01:07 2011
@@ -16,7 +16,7 @@
 
 #include "acr/error.h"
 #include "acr/clazz.h"
-#include "acr/baos.h"
+#include "acr/ostream.h"
 #include "acr/iodefs.h"
 #include "acr/port.h"
 #include "acr/sbuf.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c?rev=1097822&r1=1097821&r2=1097822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/exec.c Fri Apr 29 
14:01:07 2011
@@ -16,7 +16,7 @@
 
 #include "acr/error.h"
 #include "acr/clazz.h"
-#include "acr/baos.h"
+#include "acr/ostream.h"
 #include "acr/iodefs.h"
 #include "acr/port.h"
 #include "acr/sbuf.h"

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/clazz.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/clazz.c?rev=1097822&r1=1097821&r2=1097822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/clazz.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/clazz.c Fri Apr 29 
14:01:07 2011
@@ -17,7 +17,7 @@
 #include "acr/clazz.h"
 #include "acr/misc.h"
 /* Runtime class includes */
-#include "acr/baos.h"
+#include "acr/ostream.h"
 #include "acr/object.h"
 #include "acr/unsafe.h"
 #include "acr/string.h"

Copied: commons/sandbox/runtime/trunk/src/main/native/shared/ostream.c (from 
r1097804, commons/sandbox/runtime/trunk/src/main/native/shared/baos.c)
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/ostream.c?p2=commons/sandbox/runtime/trunk/src/main/native/shared/ostream.c&p1=commons/sandbox/runtime/trunk/src/main/native/shared/baos.c&r1=1097804&r2=1097822&rev=1097822&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/baos.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/ostream.c Fri Apr 29 
14:01:07 2011
@@ -15,7 +15,7 @@
  */
 
 #include "acr/clazz.h"
-#include "acr/baos.h"
+#include "acr/ostream.h"
 #include "acr/string.h"
 
 J_DECLARE_CLAZZ = {
@@ -32,6 +32,18 @@ J_DECLARE_M_ID(0000) = {
     "([B)V"
 };
 
+J_DECLARE_M_ID(0001) = {
+    0,
+    "write",
+    "(I)V"
+};
+
+J_DECLARE_M_ID(0002) = {
+    0,
+    "flush",
+    "()V"
+};
+
 ACR_CLASS_CTOR(OutputStream)
 {
     int rv;
@@ -39,6 +51,8 @@ ACR_CLASS_CTOR(OutputStream)
     if ((rv = AcrLoadClass(env, &_clazzn, 0)) != ACR_SUCCESS)
         return rv;
     J_LOAD_METHOD(0000);
+    J_LOAD_METHOD(0001);
+    J_LOAD_METHOD(0002);
 
     _clazzn.u = 1;
     return 0;
@@ -57,7 +71,7 @@ AcrWriteToOutputStream(JNI_STDARGS, cons
     if (data == 0 || len < 1)
         return 0;
     if (IS_JOBJECT_NULL(obj))
-        return ACR_EINVAL;
+        return ACR_EBADF;
     if (CLAZZ_LOADED) {
         jbyteArray ba = (*env)->NewByteArray(env, len);
         if (ba == 0)
@@ -74,3 +88,41 @@ AcrWriteToOutputStream(JNI_STDARGS, cons
     }
     return rc;
 }
+
+int
+AcrPutcToOutputStream(JNI_STDARGS, int b)
+{
+    int rc = ACR_ENOENT;
+
+    if (IS_JOBJECT_NULL(obj))
+        return ACR_EBADF;
+    if (CLAZZ_LOADED) {
+        CALL_VMETHOD1(0001, obj, b);
+        if (IS_EXCEPTION_PENDING(env)) {
+            (*env)->ExceptionClear(env);
+            rc = ACR_EIO;
+        }
+        else
+            rc = 0;
+    }
+    return rc;
+}
+
+int
+AcrFlushOutputStream(JNI_STDARGS)
+{
+    int rc = ACR_ENOENT;
+
+    if (IS_JOBJECT_NULL(obj))
+        return ACR_EBADF;
+    if (CLAZZ_LOADED) {
+        CALL_VMETHOD0(0002, obj);
+        if (IS_EXCEPTION_PENDING(env)) {
+            (*env)->ExceptionClear(env);
+            rc = ACR_EIO;
+        }
+        else
+            rc = 0;
+    }
+    return rc;
+}


Reply via email to