# files to compile TODO check is appropriate
var files = new Array[String]
- # Add `c_function` as a `static` function local to this unit
+ # Add a `static` `c_function` to be strictly local to this unit
fun add_local_function(c_function: CFunction)
do
body_decl.add "static {c_function.signature};\n"
body_impl.add c_function.to_writer
end
- # Add `c_function` as a public function to this unit
+ # Add a public `c_function` accessible from outside this compilation unit
fun add_exported_function(c_function: CFunction)
do
- header_decl.add "{c_function.signature};\n"
+ body_decl.add "{c_function.signature};\n"
body_impl.add "\n"
body_impl.add c_function.to_writer
end
private fun insert_compiler_options
do
cflags.add_one("", "-I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/")
- ldflags.add_one("", "-L $(JNI_LIB_PATH) -ljvm")
end
# Name of the generated Java class where to store all implementation methods of this module
# Representation of this type in C for the internal of the system
# Hides extern types.
- fun cname_blind: String is abstract
+ fun cname_blind: String do return "struct nitni_instance *"
# Representation of this type in mangled C
# Object -> Object
# Pointer -> Pointer
fun mangled_cname: String is abstract
- # Does this types has a primitive reprensentation
+ # Does this type have a primitive representation?
+ #
# type Object is_primitive? false
# type Pointer is_primitive? true
fun is_cprimitive: Bool is abstract
if name == "Byte" then return "unsigned char"
if name == "NativeString" then return "unsigned char*"
if mclass.kind == extern_kind then return "void*"
- return "struct nitni_instance *"
+ return super
end
# Name of this type in C for normal classes (not extern and not primitive)
redef class MNullableType
redef fun cname do return mangled_cname
- redef fun cname_blind do return "struct nitni_instance *"
redef fun mangled_cname do return "nullable_{mtype.mangled_cname}"
redef fun is_cprimitive do return false
end
redef class MVirtualType
- redef fun mangled_cname: String do return to_s
+ redef fun mangled_cname do return to_s
end
redef class MGenericType