Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
12 files changed:
import platform
import abstract_compiler
import platform
import abstract_compiler
-import common_ffi
-intrude import common_ffi::extra_java_files
+import ffi
+intrude import ffi::extra_java_files
import android_annotations
redef class ToolContext
import android_annotations
redef class ToolContext
module compiler_ffi
intrude import abstract_compiler
module compiler_ffi
intrude import abstract_compiler
-intrude import common_ffi
import nitni
redef class MModule
import nitni
redef class MModule
var indirection_sig = mproperty.build_csignature(mclass_type, mmodule, "___cpp_impl_mid", long_signature, internal_call_context)
## In C file (__ffi.c)
var indirection_sig = mproperty.build_csignature(mclass_type, mmodule, "___cpp_impl_mid", long_signature, internal_call_context)
## In C file (__ffi.c)
# Declare the indirection function in C
ecc.body_decl.add("{indirection_sig};\n")
# Declare the indirection function in C
ecc.body_decl.add("{indirection_sig};\n")
# FFI concers common between the compilers and the interpreter.
# Offers services to compile modules using foreign code. Mainly allows
# to wrap foreign code in Nit methods.
# FFI concers common between the compilers and the interpreter.
# Offers services to compile modules using foreign code. Mainly allows
# to wrap foreign code in Nit methods.
# does the super module has inherited dependancies?
var hd = m.header_dependencies
# does the super module has inherited dependancies?
var hd = m.header_dependencies
- if not hd.is_empty then
+ if not hd.is_empty then
header_dependencies.add_all(hd)
end
header_dependencies.add_all(hd)
end
# Returns the list of C functions to link with extern Java methods, as required
# to enable this callback from Java code.
# Returns the list of C functions to link with extern Java methods, as required
# to enable this callback from Java code.
# Return used by `MModule::ensure_linking_callback_methods`
#
# TODO we return an Array to support cast and other features like that
# Return used by `MModule::ensure_linking_callback_methods`
#
# TODO we return an Array to support cast and other features like that
private fun jni_type: String do return "jint"
# JNI short type name (for signatures)
private fun jni_type: String do return "jint"
# JNI short type name (for signatures)
# Is used by `MMethod::build_jni_format` to pass a Java method signature
# to the JNI function `GetStaticMetodId`.
private fun jni_format: String do return "I"
# Is used by `MMethod::build_jni_format` to pass a Java method signature
# to the JNI function `GetStaticMetodId`.
private fun jni_format: String do return "I"
redef class MMethod
# Returns the JNI signature format of this Nit method
redef class MMethod
# Returns the JNI signature format of this Nit method
# Example: a Nity signature `(Bool, Int, Float, JavaString)` is represented by
# the JNI format `(ZIDLjava/lang/string;)V"
private fun build_jni_format(recv_mtype: MClassType, from_mmodule: MModule): String
# Example: a Nity signature `(Bool, Int, Float, JavaString)` is represented by
# the JNI format `(ZIDLjava/lang/string;)V"
private fun build_jni_format(recv_mtype: MClassType, from_mmodule: MModule): String