2 Copyright (C) 2001-2007, Parrot Foundation.
7 src/pmc/boolean.pmc - Boolean PMC
11 This class implements a boolean value variable.
13 Albeit the C<Boolean PMC> is derived from the C<Integer PMC>,
14 it doesn't morph to other types. Only its value is changed.
24 pmclass Boolean extends Integer provides boolean provides scalar {
28 =item C<PMC *instantiate(PMC *sig)>
30 Object constructor. SELF is a Boolean Class object. Return a new
31 C<bool> object according to the passed PMC value.
36 VTABLE PMC *instantiate(PMC *sig) {
38 const int argcP = REG_INT(interp, 3);
39 PMC * const res = pmc_new(interp, enum_class_Boolean);
42 SELF.set_bool(VTABLE_get_bool(interp, REG_PMC(interp, 5)));
44 return PMCNULL; /* TODO */
48 =item C<STRING *get_string()>
55 VTABLE STRING *get_string() {
62 =item C<void set_integer_native(INTVAL value)>
64 =item C<void set_bool(INTVAL value)>
66 =item C<void set_pmc(PMC *value)>
71 VTABLE void set_integer_native(INTVAL value) {
76 VTABLE void set_bool(INTVAL value) {
77 SELF.set_integer_native(value);
82 =item C<void set_number_native(FLOATVAL value)>
84 Sets the value to C<value> evaluated in a boolean context.
90 VTABLE void set_number_native(FLOATVAL value) {
91 SELF.set_bool(!FLOAT_IS_ZERO(value));
96 =item C<void set_string_native(STRING *value)>
98 Sets the value to C<*value> evaluated in a boolean context.
104 VTABLE void set_string_native(STRING *value) {
105 SELF.set_bool(Parrot_str_boolean(INTERP, value));
119 * c-file-style: "parrot"
121 * vim: expandtab shiftwidth=4: