NAME ^

classes/integer.pmc - Integer PMC class

DESCRIPTION ^

Integer provides an integer for languages that want a value-restricted integer type without going to an I register.

Functions ^

static void integer_divide(Parrot_Interp interp, PMC *self, PMC *value, PMC *destination)

Performs integer division of *self by *value, placing the result in *destination.

Methods ^

void class_init()

class_init() code is run during <Parrot_<class_class_init()>>.

Replaces multi-method divide() with integer_divide().

void set_integer_native(INTVAL value)

void set_number_native(FLOATVAL value)

Sets the value of the integer to value.

void set_string_native(STRING *value)

Sets the value of the integer to the result of converting *value to a number.

void set_pmc(PMC *value)

Sets the value of the integer to the integer value of *value.

FLOATVAL get_number()

Returns the value of the integer as a floating point number.

INTVAL get_integer()

Returns the value of the integer.

INTVAL get_bool()

Returns the boolean value of the integer.

STRING *get_string()

Returns the string representation of the integer.

void add(PMC *value, PMC *dest)

Adds *value to the integer and returns the result in *dest.

Please note: the label syntax MMD_type: denote the behavior, if the right hand value is of that type. The part inside the braces is converted to a distinct function and gets mmd_registered for these two types.

void increment()

Increments the integer.

void decrement()

Decrements the integer.

void absolute()

Sets dest to the absolute value of SELF.

INTVAL cmp(PMC *value)

Returns the result of comparing the integer with *value.


parrot