Matt S Trout > Rakudo-Star-2012.08_001 > src/pmc/boolean.pmc

Download:
Rakudo-Star-2012.08_001.tar.gz

Annotate this POD

Source  

NAME ^

src/pmc/boolean.pmc - Boolean PMC

DESCRIPTION ^

This PMC implements a Boolean type with a single true/false value. A Boolean does not morph to other types when its value is set; it simply changes its value.

This implementation of Boolean inherits from the Scalar PMC. Unlike the previous implementation, it does not inherit from Integer.

Functions

void init()

Create a new Boolean with initial value FALSE.

void init_pmc(PMC *value)

Create a new Boolean with the given initial value interpreted as a Boolean.

void init_int(INTVAL value)

Create a new Boolean with the given initial value interpreted as a Boolean.

INTVAL get_bool()

Obtain the value of the Boolean as an integer: 1 = TRUE, 0 = FALSE.

INTVAL get_integer()

Same as get_bool().

FLOATVAL get_number()

Obtain the value of the Boolean as a float: 1.0 = TRUE, 0.0 = FALSE.

STRING *get_string()

Obtain the value of the Boolean as a string: "1" = TRUE, "0" = FALSE.

void set_bool(INTVAL value)

Sets the value of the Boolean to the specified integer value: 0 = FALSE, non-0 = TRUE.

void set_integer_native(INTVAL value)

Same as set_bool().

void set_number_native(FLOATVAL value)

Sets the value of the Boolean to the specified float value: 0.0 = FALSE, non-0.0 = TRUE.

void set_string_native(STRING *value)

Sets the Boolean to the value represented by the specified string. All values are considered TRUE except for "" and "0", which are considered FALSE.

INTVAL is_equal(PMC *value)

The == operation.

void freeze(PMC *info)

Used to archive the Boolean.

void thaw(PMC *info)

Used to unarchive the Boolean.

See also the Scalar PMC.

syntax highlighting: