X-Git-Url: http://nitlanguage.org diff --git a/src/ffi/c.nit b/src/ffi/c.nit index 44841a8..495d4e6 100644 --- a/src/ffi/c.nit +++ b/src/ffi/c.nit @@ -31,11 +31,13 @@ class CLanguage redef fun compile_module_block(block, ecc, mmodule) do if block.is_c_header then - ecc.header_custom.add( block.location.as_line_pragma ) - ecc.header_custom.add( block.code ) + ecc.header_custom.add block.location.as_line_pragma + ecc.header_custom.add "\n" + ecc.header_custom.add block.code else if block.is_c_body then - ecc.body_custom.add( block.location.as_line_pragma ) - ecc.body_impl.add( block.code ) + ecc.body_impl.add block.location.as_line_pragma + ecc.body_impl.add "\n" + ecc.body_impl.add block.code end end @@ -68,12 +70,18 @@ redef class AExternCodeBlock end redef class Location - fun as_line_pragma: String do return "#line {line_start} \"{file.filename}\"\n" + fun as_line_pragma: String do return "#line {line_start-1} \"{file.filename}\"\n" end redef class MModule - var c_compiler_options = "" is writable - var c_linker_options = "" is writable + # FIXME make nullable the key of `cflags`, `ldflags` and `cppflags` when + # supported by the bootstrap + + # Custom options for the C compiler (CFLAGS) + var cflags = new MultiHashMap[String, String] + + # Custom options for the C linker (LDFLAGS) + var ldflags = new MultiHashMap[String, String] # Additional libraries needed for the compilation # Will be used with pkg-config @@ -84,11 +92,6 @@ class ForeignCType super ForeignType redef var ctype: String - - init(ctype: String) - do - self.ctype = ctype - end end redef class NitniCallback @@ -118,7 +121,7 @@ end class ToCCallContext super CallContext - private init do end + # TODO: private init because singleton instance (see `to_c_call_context`) redef fun name_mtype(mtype) do @@ -131,7 +134,7 @@ end class FromCCallContext super CallContext - private init do end + # TODO: private init because singleton instance (see `from_c_call_context`) redef fun name_mtype(mtype) do return mtype.cname end