# Representation of this type in pure C on the FFI extern side
# Object -> Object
# Pointer -> void*
- fun cname: String is abstract
+ fun cname: String do return cname_normal_class
# Representation of this type in C for the internal of the system
# Hides extern types.
# type Object is_primitive? false
# type Pointer is_primitive? true
fun is_cprimitive: Bool do return false
+
+ # Name of this type in C for normal classes (not extern and not primitive)
+ protected fun cname_normal_class: String do return mangled_cname
end
redef class MClassType
if name == "UInt16" then return "uint16_t"
if name == "Int32" then return "int32_t"
if name == "UInt32" then return "uint32_t"
- if name == "NativeString" then return "char*"
+ if name == "CString" then return "char*"
if mclass.kind == extern_kind then
var ctype = mclass.ctype
assert ctype != null
if name == "UInt16" then return "uint16_t"
if name == "Int32" then return "int32_t"
if name == "UInt32" then return "uint32_t"
- if name == "NativeString" then return "char*"
+ if name == "CString" then return "char*"
if mclass.kind == extern_kind then return "void*"
return super
end
- # Name of this type in C for normal classes (not extern and not primitive)
- protected fun cname_normal_class: String do return mangled_cname
-
redef fun mangled_cname do return mclass.name
redef fun is_cprimitive do return mclass.kind == extern_kind or
- (once ["Bool", "Char", "Float", "Int", "NativeString",
+ (once ["Bool", "Char", "Float", "Int", "CString",
"Byte", "Int8", "Int16", "UInt16", "Int32", "UInt32"]).has(mclass.name)
end
redef class MNullableType
- redef fun cname do return mangled_cname
redef fun mangled_cname do return "nullable_{mtype.mangled_cname}"
end
end
redef class MGenericType
- redef fun cname do return mangled_cname
redef fun mangled_cname
do
var base = super