From: Sam Ruby Date: Sun, 20 Feb 2000 12:09:34 +0000 (+0000) Subject: Added support for arrays X-Git-Tag: php-4.0b4~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e7b5172ea13cff0dd52e5baa79b775592da0580;p=php Added support for arrays Better support for instances of non-public classes (based on a suggestion by Patrick Beard of NetScape) --- diff --git a/ext/java/java.c b/ext/java/java.c index 0cdd8ad8cb..f1f5cb17d7 100644 --- a/ext/java/java.c +++ b/ext/java/java.c @@ -513,6 +513,22 @@ JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromObject &handle, sizeof(pval *), NULL); } +JNIEXPORT void JNICALL Java_net_php_reflect_setResultFromArray + (JNIEnv *jenv, jclass self, jlong result) +{ + array_init( (pval*)(long)result ); +} + +JNIEXPORT jlong JNICALL Java_net_php_reflect_nextElement + (JNIEnv *jenv, jclass self, jlong array) +{ + pval *result; + pval *handle = (pval*)(long)array; + ALLOC_ZVAL(result); + zend_hash_next_index_insert(handle->value.ht, &result, sizeof(zval *), NULL); + return (jlong)(long)result; +} + JNIEXPORT void JNICALL Java_net_php_reflect_setException (JNIEnv *jenv, jclass self, jlong result, jstring value) { diff --git a/ext/java/reflect.java b/ext/java/reflect.java index 52d39857db..3dafcf719a 100644 --- a/ext/java/reflect.java +++ b/ext/java/reflect.java @@ -43,6 +43,8 @@ class reflect { private static native void setResultFromDouble(long result, double value); private static native void setResultFromBoolean(long result, boolean value); private static native void setResultFromObject(long result, Object value); + private static native void setResultFromArray(long result); + private static native long nextElement(long array); private static native void setException(long result, String value); public static native void setEnv(); @@ -71,6 +73,14 @@ class reflect { setResultFromBoolean(result, ((Boolean)value).booleanValue()); + } else if (value.getClass().isArray()) { + + long length = Array.getLength(value); + setResultFromArray(result); + for (int i=0; i0;) { + if (Modifier.isPublic(interfaces[i].getModifiers())) { + jclass=interfaces[i]; + } + } + } Method methods[] = jclass.getMethods(); for (int i=0; ivalue.ht, &result, sizeof(zval *), NULL); + return (jlong)(long)result; +} + JNIEXPORT void JNICALL Java_net_php_reflect_setException (JNIEnv *jenv, jclass self, jlong result, jstring value) { diff --git a/ext/rpc/java/reflect.java b/ext/rpc/java/reflect.java index 52d39857db..3dafcf719a 100644 --- a/ext/rpc/java/reflect.java +++ b/ext/rpc/java/reflect.java @@ -43,6 +43,8 @@ class reflect { private static native void setResultFromDouble(long result, double value); private static native void setResultFromBoolean(long result, boolean value); private static native void setResultFromObject(long result, Object value); + private static native void setResultFromArray(long result); + private static native long nextElement(long array); private static native void setException(long result, String value); public static native void setEnv(); @@ -71,6 +73,14 @@ class reflect { setResultFromBoolean(result, ((Boolean)value).booleanValue()); + } else if (value.getClass().isArray()) { + + long length = Array.getLength(value); + setResultFromArray(result); + for (int i=0; i0;) { + if (Modifier.isPublic(interfaces[i].getModifiers())) { + jclass=interfaces[i]; + } + } + } Method methods[] = jclass.getMethods(); for (int i=0; i