NAME ^

classes/scalar.pmc - Scalar Abstract Superclass

DESCRIPTION ^

These are the vtable functions for the scalar base PMC class

Methods ^

PMC *clone()

Creates and returns a clone of the scalar.

INTVAL get_integer()

Returns the integer value of the scalar.

FLOATVAL get_number()

Returns the floating-point value of the scalar.

BIGNUM *get_bignum()

Returns the big number value of the scalar.

STRING *get_string()

INTVAL get_bool()

Returns the boolean value for the scalar.

Accessor Methods ^

The set methods merely make the appropriate part of the cache be what it should be, more complex behaviour is left as an exercise for the inheriting class.

void set_integer_native(INTVAL value)

Sets the integer value.

void set_number_native(FLOATVAL value)

Sets the floating-point value.

void set_bignum_native(BIGNUM *value)

Sets the big number value.

void set_string_native(STRING *value)

Sets the Parrot string value.

Mathematical Methods ^

void add_int(INTVAL value, PMC *dest)

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

TODO - overflow detection, bigint promotion?

void add_float(FLOATVAL value, PMC *dest)

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

TODO - overflow detection, bigint promotion?

void subtract(PMC *value, PMC *dest)

void subtract_int(INTVAL value, PMC *dest)

Subtracts value from the scalar and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void subtract_float (FLOATVAL value, PMC *dest)

Subtracts value from the scalar and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void multiply (PMC *value, PMC *dest)

Multiplies the scalar by *value and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void multiply_int(INTVAL value, PMC *dest)

Multiplies the scalar by value and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void multiply_float(FLOATVAL value, PMC *dest)

Multiplies the scalar by value and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void divide(PMC *value, PMC *dest)

Divides the scalar by *value and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void divide_int(INTVAL value, PMC *dest)

Divides the scalar by value and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void divide_float(FLOATVAL value, PMC *dest)

Divides the scalar by value and returns the result in *dest.

TODO - overflow detection, bigint promotion?

void modulus(PMC *value, PMC *dest)

This does perl-like modulus.

Returns in *dest the value of the scalar mod the integer value of *value.

void modulus_int(INTVAL value, PMC *dest)

Returns in *dest the value of the scalar mod value.

void modulus_float(FLOATVAL value, PMC *dest)

Calls the superclass implementation.

void neg(PMC *dest)

Set dest to the negated value of SELF.

Bitwise Methods ^

void bitwise_or(PMC *value, PMC *dest)

Returns in *dest the bitwise OR of the scalar and *value.

void bitwise_or_int(INTVAL value, PMC *dest)

Returns in *dest the bitwise OR of the scalar and value.

void bitwise_and(PMC *value, PMC *dest)

Returns in *dest the bitwise AND of the scalar and *value.

void bitwise_and_int(INTVAL value, PMC *dest)

Returns in *dest the bitwise AND of the scalar and value.

void bitwise_xor(PMC *value, PMC *dest)

Returns in *dest the bitwise XOR of the scalar and *value.

void bitwise_xor_int(INTVAL value, PMC *dest)

Returns in *dest the bitwise XOR of the scalar and value.

void bitwise_not(PMC *dest)

Returns in *dest the bitwise negation of the scalar and value.

void bitwise_shr(PMC *value, PMC *dest)

Returns in *dest the shift right of the scalar by *value.

void bitwise_shr_int(INTVAL value, PMC *dest)

Returns in *dest the shift right of the scalar by value.

void bitwise_shl(PMC *value, PMC *dest)

Returns in *dest the shift left of the scalar by *value.

void bitwise_shl_int(INTVAL value, PMC *dest)

Returns in *dest the shift left of the scalar by value.

String Methods ^

void concatenate(PMC *value, PMC *dest)

Returns in *dest the result of concatenating the scalar and *value.

void concatenate_str(STRING *value, PMC *dest)

Returns in *dest the result of concatenating the scalar and *value.

Comparison Methods ^

INTVAL is_equal(PMC *value)

Returns whether the scalar is equal to *value.

INTVAL cmp_num(PMC *value)

Returns the result of comparing the floating-point values of the scalar and *value.

INTVAL cmp_string(PMC *value)

Returns the result of comparing the string values of the scalar and *value.

Logical Methods ^

void logical_or(PMC *value, PMC *dest)

Returns in *dest the result of the logical OR of the scalar and *value.

void logical_and(PMC *value, PMC *dest)

Returns in *dest the result of the logical AND of the scalar and *value.

void logical_xor(PMC *value, PMC *dest)

Returns in *dest the result of the logical XOR of the scalar and *value.

void logical_not(PMC *dest)

Returns in *dest the result of the logical negation of the scalar and *value.

void repeat(PMC *value, PMC *dest)

Returns in *dest the result of repeating the scalar *value times.

void repeat_int(INTVAL value, PMC *dest)

Returns in *dest the result of repeating the scalar value times.

void increment()

Increments the scalar.

void decrement()

Decrements the scalar.

INTVAL defined()

Always returns true.

STRING *substr_str(INTVAL offset, INTVAL length)

Returns the substring of length length of the scalar starting at offset.


parrot