nitc :: ObjCLanguage
nitc :: ObjCLanguage :: defaultinit
nitc $ ObjCLanguage :: SELF
Type of this instance, automatically specialized in every classnitc $ ObjCLanguage :: compile_callback
Generate the code to offer this callback if foreign codenitc $ ObjCLanguage :: compile_extern_class
Generate wrapper code for this extern classnitc $ ObjCLanguage :: compile_extern_method
Generate wrapper code for this extern methodnitc $ ObjCLanguage :: compile_module_block
Generate wrapper code for this module/header code blocknitc $ ObjCLanguage :: compile_to_files
Complete compilation of generated codenitc $ ObjCLanguage :: get_ftype
Get the foreign type of this extern class definitionnitc $ ObjCLanguage :: identify_language
Is thisblock
written in this language?
nitc :: FFILanguage :: _ffi_language_assignation_phase
FFILanguageAssignationPhase
assigning self
to AExternCodeBlock
s
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: FFILanguage :: compile_callback
Generate the code to offer this callback if foreign codenitc :: FFILanguage :: compile_extern_class
Generate wrapper code for this extern classnitc :: FFILanguage :: compile_extern_method
Generate wrapper code for this extern methodnitc :: FFILanguage :: compile_module_block
Generate wrapper code for this module/header code blocknitc :: FFILanguage :: compile_to_files
Complete compilation of generated codenitc :: FFILanguage :: defaultinit
nitc :: ObjCLanguage :: defaultinit
core :: Object :: defaultinit
nitc :: FFILanguage :: ffi_language_assignation_phase
FFILanguageAssignationPhase
assigning self
to AExternCodeBlock
s
nitc :: FFILanguage :: ffi_language_assignation_phase=
FFILanguageAssignationPhase
assigning self
to AExternCodeBlock
s
nitc :: FFILanguage :: get_ftype
Get the foreign type of this extern class definitionnitc :: FFILanguage :: identify_language
Is thisblock
written in this language?
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: FFILanguage
Visitor for a specific languages. Works kinda like aPhase
and is executed
# The Objective-C langugage visitor
class ObjCLanguage
super FFILanguage
redef fun identify_language(n) do return n.is_objc
redef fun compile_module_block(block, ecc, mmodule)
do
if mmodule.objc_file == null then mmodule.objc_file = new ObjCCompilationUnit
if block.is_objc_header then
mmodule.objc_file.header_custom.add block.location.as_line_pragma
mmodule.objc_file.header_custom.add block.code
mmodule.has_public_objc_header = true
else if block.is_objc_body then
mmodule.objc_file.body_custom.add block.location.as_line_pragma
mmodule.objc_file.body_custom.add block.code
end
end
redef fun compile_extern_method(block, m, ecc, mmodule)
do
if mmodule.objc_file == null then mmodule.objc_file = new ObjCCompilationUnit
var mpropdef = m.mpropdef
var recv_mtype = mpropdef.mclassdef.bound_mtype
var csignature = mpropdef.mproperty.build_csignature(
recv_mtype, mmodule, "___impl", long_signature, from_objc_call_context)
var fc = new CFunction(csignature)
fc.decls.add block.location.as_line_pragma
fc.exprs.add block.code
mmodule.objc_file.add_exported_function fc
end
redef fun compile_extern_class(block, m, ecc, mmodule) do end
redef fun get_ftype(block, m) do return new ForeignObjCType(block.code)
redef fun compile_to_files(mmodule, compdir)
do
var objc_file = mmodule.objc_file
assert objc_file != null
# Import public Objective-C header of imported modules
var dep = mmodule.objc_imported_headers
for mod in dep do
objc_file.header_custom.add "#include \"{mod.c_name}._ffi_m.h\"\n"
end
# write .m and _m.h file
mmodule.objc_file.header_c_types.add """
#include "{{{mmodule.c_name}}}._ffi.h"
"""
var file = objc_file.write_to_files(mmodule, compdir)
# add compilation to makefile
mmodule.ffi_files.add file
end
redef fun compile_callback(callback, mmodule, mainmodule, ecc)
do
callback.compile_callback_to_objc(mmodule, mainmodule)
end
end
src/ffi/objc.nit:58,1--124,3