Single cell in the list of arguments sent to foreign code (and received)

Each cell can hold all primitive types and pointers to Nit class instances.

Since this is a C pointer, it acts as both a single cell and an array.

Introduced properties

private fun [](index: Int): CallArg

nitc :: CallArg :: []

Get the element at index after self
private fun bool: Bool

nitc :: CallArg :: bool

The Bool held by this cell
private fun bool=(value: Bool)

nitc :: CallArg :: bool=

The Bool held by this cell
private fun byte: Byte

nitc :: CallArg :: byte

The Byte held by this cell
private fun byte=(value: Byte)

nitc :: CallArg :: byte=

The Byte held by this cell
private fun c_string: CString

nitc :: CallArg :: c_string

The CString held by this cell
private fun char: Char

nitc :: CallArg :: char

The Char held by this cell
private fun char=(value: Char)

nitc :: CallArg :: char=

The Char held by this cell
private fun float: Float

nitc :: CallArg :: float

The Float held by this cell
private fun float=(value: Float)

nitc :: CallArg :: float=

The Float held by this cell
private fun from_static_type(value: Instance, static_type: MType)

nitc :: CallArg :: from_static_type

Set the content of this cell according to static_type
private fun instance: Instance

nitc :: CallArg :: instance

The Instance held by this cell
private fun instance=(value: Instance)

nitc :: CallArg :: instance=

The Instance held by this cell
private fun int: Int

nitc :: CallArg :: int

The Int held by this cell
private fun int16: Int16

nitc :: CallArg :: int16

The Int held by this cell
private fun int16=(value: Int16)

nitc :: CallArg :: int16=

The Int held by this cell
private fun int32: Int32

nitc :: CallArg :: int32

The Int held by this cell
private fun int32=(value: Int32)

nitc :: CallArg :: int32=

The Int held by this cell
private fun int8: Int8

nitc :: CallArg :: int8

The Int held by this cell
private fun int8=(value: Int8)

nitc :: CallArg :: int8=

The Int held by this cell
private fun int=(value: Int)

nitc :: CallArg :: int=

The Int held by this cell
private init new(length: Int): CallArg

nitc :: CallArg :: new

Initialize an array of CallArg of length elements
private fun pointer: Pointer

nitc :: CallArg :: pointer

The Pointer held by this cell
private fun pointer=(value: Pointer)

nitc :: CallArg :: pointer=

The Pointer held by this cell
private fun to_instance(static_type: MType, v: NaiveInterpreter): Instance

nitc :: CallArg :: to_instance

Get the content of this cell as an Instance of the static_type
private fun uint16: UInt16

nitc :: CallArg :: uint16

The Int held by this cell
private fun uint16=(value: UInt16)

nitc :: CallArg :: uint16=

The Int held by this cell
private fun uint32: UInt32

nitc :: CallArg :: uint32

The Int held by this cell
private fun uint32=(value: UInt32)

nitc :: CallArg :: uint32=

The Int held by this cell

Redefined properties

redef type SELF: CallArg

nitc $ CallArg :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private fun [](index: Int): CallArg

nitc :: CallArg :: []

Get the element at index after self
fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
private fun bool: Bool

nitc :: CallArg :: bool

The Bool held by this cell
private fun bool=(value: Bool)

nitc :: CallArg :: bool=

The Bool held by this cell
private fun byte: Byte

nitc :: CallArg :: byte

The Byte held by this cell
private fun byte=(value: Byte)

nitc :: CallArg :: byte=

The Byte held by this cell
private fun c_string: CString

nitc :: CallArg :: c_string

The CString held by this cell
private fun char: Char

nitc :: CallArg :: char

The Char held by this cell
private fun char=(value: Char)

nitc :: CallArg :: char=

The Char held by this cell
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
private fun float: Float

nitc :: CallArg :: float

The Float held by this cell
private fun float=(value: Float)

nitc :: CallArg :: float=

The Float held by this cell
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
private fun from_static_type(value: Instance, static_type: MType)

nitc :: CallArg :: from_static_type

Set the content of this cell according to static_type
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
private fun instance: Instance

nitc :: CallArg :: instance

The Instance held by this cell
private fun instance=(value: Instance)

nitc :: CallArg :: instance=

The Instance held by this cell
private fun int: Int

nitc :: CallArg :: int

The Int held by this cell
private fun int16: Int16

nitc :: CallArg :: int16

The Int held by this cell
private fun int16=(value: Int16)

nitc :: CallArg :: int16=

The Int held by this cell
private fun int32: Int32

nitc :: CallArg :: int32

The Int held by this cell
private fun int32=(value: Int32)

nitc :: CallArg :: int32=

The Int held by this cell
private fun int8: Int8

nitc :: CallArg :: int8

The Int held by this cell
private fun int8=(value: Int8)

nitc :: CallArg :: int8=

The Int held by this cell
private fun int=(value: Int)

nitc :: CallArg :: int=

The Int held by this cell
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
private fun native_equals(o: Pointer): Bool

core :: Pointer :: native_equals

private init new(length: Int): CallArg

nitc :: CallArg :: new

Initialize an array of CallArg of length elements
init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
private fun pointer: Pointer

nitc :: CallArg :: pointer

The Pointer held by this cell
private fun pointer=(value: Pointer)

nitc :: CallArg :: pointer=

The Pointer held by this cell
private fun premultiply_alpha(width: Int, height: Int)

core :: Pointer :: premultiply_alpha

Multiply RGB values by their alpha value
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
private fun to_instance(static_type: MType, v: NaiveInterpreter): Instance

nitc :: CallArg :: to_instance

Get the content of this cell as an Instance of the static_type
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
private fun uint16: UInt16

nitc :: CallArg :: uint16

The Int held by this cell
private fun uint16=(value: UInt16)

nitc :: CallArg :: uint16=

The Int held by this cell
private fun uint32: UInt32

nitc :: CallArg :: uint32

The Int held by this cell
private fun uint32=(value: UInt32)

nitc :: CallArg :: uint32=

The Int held by this cell
package_diagram nitc::dynamic_loading_ffi::CallArg CallArg core::Pointer Pointer nitc::dynamic_loading_ffi::CallArg->core::Pointer core::Object Object core::Pointer->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Class definitions

nitc $ CallArg
# Single cell in the list of arguments sent to foreign code (and received)
#
# Each cell can hold all primitive types and pointers to Nit class instances.
#
# Since this is a C pointer, it acts as both a single cell and an array.
private extern class CallArg `{ nit_call_arg* `}

	# Initialize an array of `CallArg` of `length` elements
	new (length: Int) `{ return calloc(length, sizeof(nit_call_arg)); `}

	# Get the element at `index` after `self`
	fun [](index: Int): CallArg `{ return self + index; `}

	# The `Int` held by this cell
	fun int: Int `{ return self->value_Int; `}

	# The `Int` held by this cell
	fun int=(value: Int) `{ self->value_Int = value; `}

	# The `Bool` held by this cell
	fun bool: Bool `{ return self->value_Bool; `}

	# The `Bool` held by this cell
	fun bool=(value: Bool) `{ self->value_Bool = value; `}

	# The `Char` held by this cell
	fun char: Char `{ return self->value_Char; `}

	# The `Char` held by this cell
	fun char=(value: Char) `{ self->value_Char = value; `}

	# The `Byte` held by this cell
	fun byte: Byte `{ return self->value_Byte; `}

	# The `Byte` held by this cell
	fun byte=(value: Byte) `{ self->value_Byte = value; `}

	# The `Int` held by this cell
	fun int8: Int8 `{ return self->value_Int8; `}

	# The `Int` held by this cell
	fun int8=(value: Int8) `{ self->value_Int8 = value; `}

	# The `Int` held by this cell
	fun int16: Int16 `{ return self->value_Int16; `}

	# The `Int` held by this cell
	fun int16=(value: Int16) `{ self->value_Int16 = value; `}

	# The `Int` held by this cell
	fun uint16: UInt16 `{ return self->value_UInt16; `}

	# The `Int` held by this cell
	fun uint16=(value: UInt16) `{ self->value_UInt16 = value; `}

	# The `Int` held by this cell
	fun int32: Int32 `{ return self->value_Int32; `}

	# The `Int` held by this cell
	fun int32=(value: Int32) `{ self->value_Int32 = value; `}

	# The `Int` held by this cell
	fun uint32: UInt32 `{ return self->value_UInt32; `}

	# The `Int` held by this cell
	fun uint32=(value: UInt32) `{ self->value_UInt32 = value; `}

	# The `Float` held by this cell
	fun float: Float `{ return self->value_Float; `}

	# The `Float` held by this cell
	fun float=(value: Float) `{ self->value_Float = value; `}

	# The `Pointer` held by this cell
	fun pointer: Pointer `{ return self->value_Pointer; `}

	# The `Pointer` held by this cell
	fun pointer=(value: Pointer) `{ self->value_Pointer = value; `}

	# The `Instance` held by this cell
	fun instance: Instance is light_ffi `{ return (Instance)self->value_Pointer; `}

	# The `Instance` held by this cell
	fun instance=(value: Instance) is light_ffi `{ self->value_Pointer = value; `}

	# The `CString` held by this cell
	fun c_string: CString `{ return (char*)self->value_Pointer; `}

	# Set the content of this cell according to `static_type`
	#
	# Opposite of `to_instance`.
	fun from_static_type(value: Instance, static_type: MType)
	do
		if static_type.name == "Int" then
			assert value isa PrimitiveInstance[Int]
			self.int = value.val
		else if static_type.name == "Bool" then
			assert value isa PrimitiveInstance[Bool]
			self.bool = value.val
		else if static_type.name == "Char" then
			assert value isa PrimitiveInstance[Char]
			self.char = value.val
		else if static_type.name == "Byte" then
			assert value isa PrimitiveInstance[Byte]
			self.byte = value.val
		else if static_type.name == "Int8" then
			assert value isa PrimitiveInstance[Int8]
			self.int8 = value.val
		else if static_type.name == "Int16" then
			assert value isa PrimitiveInstance[Int16]
			self.int16 = value.val
		else if static_type.name == "UInt16" then
			assert value isa PrimitiveInstance[UInt16]
			self.uint16 = value.val
		else if static_type.name == "Int32" then
			assert value isa PrimitiveInstance[Int32]
			self.int32 = value.val
		else if static_type.name == "UInt32" then
			assert value isa PrimitiveInstance[UInt32]
			self.uint32 = value.val
		else if static_type.name == "Float" then
			assert value isa PrimitiveInstance[Float]
			self.float = value.val
		else if static_type.name == "CString" then
			assert value isa PrimitiveInstance[CString]
			self.pointer = value.val
		else if static_type isa MClassType and static_type.mclass.kind == extern_kind then
			assert value isa PrimitiveInstance[Pointer] else print value.class_name
			self.pointer = value.val
		else
			self.instance = value
		end
	end

	# Get the content of this cell as an `Instance` of the `static_type`
	#
	# Opposite of `from_static_type`.
	fun to_instance(static_type: MType, v: NaiveInterpreter): Instance
	do
		var name = static_type.name
		if name == "Int" then
			return v.int_instance(self.int)
		else if name == "Bool" then
			return if self.bool then
				v.true_instance
			else v.false_instance
		else if name == "Char" then
			return v.char_instance(self.char)
		else if name == "Byte" then
			return v.byte_instance(self.byte)
		else if name == "Int8" then
			return v.int8_instance(self.int8)
		else if name == "Int16" then
			return v.int16_instance(self.int16)
		else if name == "UInt16" then
			return v.uint16_instance(self.uint16)
		else if name == "Int32" then
			return v.int32_instance(self.int32)
		else if name == "UInt32" then
			return v.uint32_instance(self.uint32)
		else if name == "Float" then
			return v.float_instance(self.float)
		else if name == "CString" then
			var instance = new PrimitiveInstance[CString](static_type, self.c_string)
			v.init_instance_primitive instance
			return instance
		else if static_type isa MClassType and static_type.mclass.kind == extern_kind then
			# We tag it with the most precise known type
			var instance = new PrimitiveInstance[Pointer](static_type, self.pointer)
			v.init_instance_primitive instance
			return instance
		else
			return self.instance
		end
	end
end
src/interpreter/dynamic_loading_ffi/dynamic_loading_ffi.nit:48,1--223,3