Paul Sokolovsky
eac22e29a5
all: Consistently update signatures of .make_new and .call methods.
Otherwise, they serve reoccurring source of copy-paste mistakes and
breaking nanbox build.
8 years ago
Damien George
93c4a6a3f7
all: Remove 'name' member from mp_obj_module_t struct.
One can instead lookup __name__ in the modules dict to get the value.
8 years ago
Paul Sokolovsky
5bf1b4e9d9
unix/modjni: array(): Support creation of object arrays.
8 years ago
Paul Sokolovsky
ee324c501e
unix/modjni: Add array() top-level function to create Java array.
Takes element primitive type encoded as a char per standard JNI encoding,
and array size. TODO: Support object arrays.
8 years ago
Paul Sokolovsky
3fea1f014c
unix/modjni: Implement subscription for object arrays.
8 years ago
Paul Sokolovsky
3c7e1b80ac
unix/modjni: Add missing get_jclass_name() function.
9 years ago
Paul Sokolovsky
91f2168dd5
unix/modjni: Actually check argument type when doing method resolution.
This is required to properly select among overloaded methods. It however
relies on java.lang.Object-overloaded method to come last, which appears
to be the case for OpenJDK.
9 years ago
Paul Sokolovsky
9ebd4dabf2
unix/modjni: Don't pass Java object to a method which doesn't expect it.
For example, don't pass Integer to double method. This is still not
selective enough to choose the right overloaded method maong those
taking objects.
9 years ago
Paul Sokolovsky
fe29cc192d
unix/modjni: Add iteration support for Java List objects.
Using generic iteration-via-subscription support (TODO: factor it out for
reuse).
9 years ago
Paul Sokolovsky
41eb705477
unix/modjni: call_method: Check for Java exception after method return.
9 years ago
Paul Sokolovsky
1b586f3a73
py: Rename MP_BOOL() to mp_obj_new_bool() for consistency in naming.
9 years ago
Paul Sokolovsky
7381b7ac71
unix/modjni: py2jvalue: Support bool and None values.
9 years ago
Paul Sokolovsky
02041bf2e0
unix/modjni: jvalue2py() is currently not used.
Not remove so far, may be needed later.
9 years ago
Paul Sokolovsky
216b6a494e
unix/modjni: Allow to access fields of objects.
9 years ago
Paul Sokolovsky
fd38799049
unix/modjni: After Call*Method(), Java exception should always be checked.
OpenJDK seemed to return NULL in case of exception, but Dalvik returns
arbitrary value, so skip such "optimizations".
9 years ago
Paul Sokolovsky
1ea4b77a9a
unix/modjni: jclass.__str__/__repr__: Return Java .toString() value.
9 years ago
Paul Sokolovsky
f22be4ebd9
unix/modjni: jobject.__str__/__repr__: Return Java .toString() value.
9 years ago
Paul Sokolovsky
9e0a3d46b6
unix/modjni: Convert Java's IndexOutOfBoundsException to Python's IndexError.
9 years ago
Paul Sokolovsky
c4489a0543
unix/modjni: Propagate Java exceptions on list access.
9 years ago
Paul Sokolovsky
0eba162ab5
unix/modjni: Fix method argument matching.
9 years ago
Paul Sokolovsky
f3ca8623f7
unix/modjni: Implement len() for objects with java.util.List interface.
9 years ago
Paul Sokolovsky
77020281ae
unix/modjni: call_method: Delete done local references in loop.
To avoid local ref table overflow.
9 years ago
Paul Sokolovsky
0d28a3edb9
unix/modjni: call_method: Better resource release.
9 years ago
Paul Sokolovsky
81d64ab939
unix/modjni: call_method(): If name doesn't match, cleanup via goto next_method.
9 years ago
Paul Sokolovsky
c0a79cc919
unix/modjni: Need to really use per-rettype Call*Method functions.
9 years ago
Paul Sokolovsky
7e18d3b6ff
unix/modjni: new_jobject(): Handle null reference.
9 years ago
Paul Sokolovsky
e632b1fda7
unix/modjni: Factor out is_object_type().
9 years ago
Paul Sokolovsky
ed22e9ba3e
unix/modjni: Move type analysis logic to new_jobject(), for reuse.
9 years ago
Paul Sokolovsky
b2d880d749
unix/modjni: Support for subscripting of Java lists (r/o so far).
9 years ago
Paul Sokolovsky
6196aa45ed
unix/modjni: jvalue2py: Handle boolean.
9 years ago
Paul Sokolovsky
1e9d8e110b
unix/modjni: py2jvalue: Pass jobject's down to Java.
So far, no signature check is done (TODO).
9 years ago
Paul Sokolovsky
011c7f5718
unix/modjni: py2jvalue: Handle both int and long java types (with TODO for long).
9 years ago
Paul Sokolovsky
1cb5de2cd5
unix/modjni: jvalue2py: Handle class-containing jvalues.
9 years ago
Paul Sokolovsky
cb6cf5e257
unix/modjni: Add env() module function.
Useful to load native method libraries not loaded by VM (as happens on
Android).
9 years ago
Paul Sokolovsky
b230a86d33
unix/modjni: Return any object type value as a jobject.
9 years ago
Paul Sokolovsky
5167332131
unix/modjni: Return Java null as Python None.
9 years ago
Paul Sokolovsky
7a4b10cc4c
unix/modjni: Support static methods.
9 years ago
Paul Sokolovsky
26a9b4d48e
unix/modjni: Factor out new_jobject(), jvalue2py() functions.
9 years ago
Paul Sokolovsky
4e7bde8c9e
unix/modjni: Factor out py2jvalue() function.
9 years ago
Paul Sokolovsky
e79c6b6312
unix/modjni: "jni" module to interface to JNI-compliant JavaVM.
This includes Android Dalvik VM for example.
Example usage:
import jni
System = jni.cls("java/lang/System")
System.out.println("Hello, Java!")
9 years ago