Added: commons/sandbox/runtime/trunk/src/main/native/shared/observer.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/observer.c?rev=1085784&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/observer.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/observer.c Sat Mar 26
18:56:55 2011
@@ -0,0 +1,71 @@
+/* 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.
+ */
+
+/*
+ *
+ * @author Mladen Turk
+ */
+
+#include "acr/observer.h"
+#include "acr/clazz.h"
+#include "acr/memory.h"
+
+J_DECLARE_CLAZZ = {
+ 0,
+ 0,
+ 0,
+ 0,
+ "java/util/Observer"
+};
+
+J_DECLARE_M_ID(0000) = {
+ NULL,
+ "update",
+ "(Ljava/util/Observable;Ljava/lang/Object;)V"
+};
+
+ACR_CLASS_CTOR(Observer)
+{
+ int rv;
+
+ if ((rv = AcrLoadClass(_E, &_clazzn, 0)) != 0)
+ return rv;
+ J_LOAD_METHOD(0000);
+
+ return 0;
+}
+
+ACR_CLASS_DTOR(Observer)
+{
+ AcrUnloadClass(_E, &_clazzn);
+}
+
+int
+AcrObserverUpdate(JNI_STDARGS, jobject o, jobject arg)
+{
+ if (_O == 0)
+ return ACR_EINVAL;
+ if (_E == 0)
+ _E = AcrGetJNIEnv();
+ if (IS_INVALID_HANDLE(_E))
+ return ACR_ENOJNIENV;
+ CALL_VMETHOD2(0000, _O, o, arg);
+ if ((*_E)->ExceptionCheck(_E) == JNI_TRUE) {
+ (*_E)->ExceptionClear(_E);
+ return ACR_EGENERAL;
+ }
+ return 0;
+}
Propchange: commons/sandbox/runtime/trunk/src/main/native/shared/observer.c
------------------------------------------------------------------------------
svn:eol-style = native