NAME ^

src/pmc/capture.pmc - Capture PMC

DESCRIPTION ^

These are the vtable functions for the Capture PMC.

Functions ^

void init()

Initializes the Capture instance.

void destroy()

Free structures.

void set_number_keyed_int(INTVAL key, FLOATVAL value)

void set_integer_keyed_int(INTVAL key, INTVAL value)

void set_pmc_keyed_int(INTVAL key, PMC *value)

void set_string_keyed_int(INTVAL key, STRING *value)

Sets a value in the array component of the Capture.

FLOATVAL get_number_keyed_int(INTVAL key)

INTVAL get_integer_keyed_int(INTVAL key)

PMC *get_pmc_keyed_int(INTVAL key)

STRING *get_string_keyed_int(INTVAL key)

Retrieves a value in the array component of the Capture.

void push_float(FLOATVAL value)

void push_integer(INTVAL value)

void push_pmc(PMC *value)

void push_string(STRING *value)

Push a value onto the array component of the Capture.

void unshift_float(FLOATVAL value)

void unshift_integer(INTVAL value)

void unshift_pmc(PMC *value)

void unshift_string(STRING *value)

Unshift a value onto the array component of the Capture.

FLOATVAL pop_float()

INTVAL pop_integer()

PMC *pop_pmc()

STRING *pop_string()

Pop a value from the array component of the Capture.

FLOATVAL shift_float()

INTVAL shift_integer()

PMC *shift_pmc()

STRING *shift_string()

Shift a value from the array component of the Capture.

INTVAL elements()

Return the number of elements in the array component of the Capture.

INTVAL defined_keyed_int(INTVAL key)

Return true if element key of the array component is defined.

INTVAL exists_keyed_int(INTVAL key)

Return true if element key of the array component exists.

void delete_keyed_int(INTVAL key)

Delete the element corresponding to key in the array component.

void set_number_keyed(PMC *key, FLOATVAL value)

void set_integer_keyed(PMC *key, INTVAL value)

void set_pmc_keyed(PMC *key, PMC *value)

void set_string_keyed(PMC *key, STRING *value)

Sets a value in the hash component of the Capture.

FLOATVAL get_number_keyed(PMC *key)

INTVAL get_integer_keyed(PMC *key)

PMC *get_pmc_keyed(PMC *key)

STRING *get_string_keyed(PMC *key)

Retrieves a value from the hash component of the Capture.

INTVAL defined_keyed(PMC *key)

Return true if element key of the hash component is defined.

INTVAL exists_keyed(PMC *key)

Return true if element key of the hash component exists.

void delete_keyed(PMC *key)

Delete the element corresponding to key in the hash component.

Methods ^

*/

    METHOD get_array() {
        PMC *capt_array;
        PMC *capt = SELF;
        /* XXX:  This workaround is for when we get here as
                 part of a subclass of Capture */
        if (PObj_is_object_TEST(SELF)) {
            STRING *classname = CONST_STRING(INTERP, "Capture");
            PMC    *classobj  = Parrot_oo_get_class_str(INTERP, classname);
            capt              = VTABLE_get_attr_keyed(interp, SELF, classobj,
                                    CONST_STRING(interp, "proxy"));
        }

        CAPTURE_array_CREATE(INTERP, capt);
        capt_array = PARROT_CAPTURE(capt)->array;

        RETURN(PMC *capt_array);
    }

    METHOD get_hash() {
        PMC *capt_hash;
        PMC *capt = SELF;
        /* XXX:  This workaround is for when we get here as
                 part of a subclass of Capture */
        if (PObj_is_object_TEST(SELF)) {
            STRING *classname = CONST_STRING(INTERP, "Capture");
            PMC    *classobj  = Parrot_oo_get_class_str(INTERP, classname);
            capt              = VTABLE_get_attr_keyed(interp, SELF, classobj,
                                    CONST_STRING(interp, "proxy"));
        }
        CAPTURE_hash_CREATE(INTERP, capt);
        capt_hash = PARROT_CAPTURE(capt)->hash;
        RETURN(PMC *capt_hash);
    }

}

/*

HISTORY ^

Initial version - Patrick Michaud 2006-11-03


parrot