NAME

src/pmc/array.pmc - Array PMC

DESCRIPTION

These are the vtable functions for the Array base class.

Functions

static PMC *undef(PARROT_INTERP)
Returns a Undef PMC.
static PMC *retval(PARROT_INTERP, void *ret)
Processes *ret, returning the appropriate PMC, or raising an exception if necessary.
static PMC *Parrot_Array_set_pmc_ptr(PARROT_INTERP, List *list, INTVAL key)
Returns a pointer to the element at index key of *list. If this element was previously empty, then this function also creates and assigns an "undef" PMC to that element.

Methods

void class_init()
Class initialization. Creates the required memory pools.
void init()
Initializes the PMC by calling the underlying list_new() function.
void init_pmc(PMC *init)
*init contains the initialization information specifying initial size, number of dimensions, etc.
void assign_pmc(PMC *other)
Copy the contents of other to self.
void set_pmc(PMC *other)
Implemented as an alias to assign_pmc since the behavior is the same.
void mark()
Mark the array and its contents as live.
PMC *clone()
Return a clone of the array.
INTVAL get_integer()
Returns the number of elements in the array.
INTVAL get_bool()
Returns true if the array has one or more elements.
INTVAL elements()
Returns the number of elements in the array.
FLOATVAL get_number()
Returns the number of elements in the array.
STRING *get_string()
Returns a string representation of the array.
INTVAL get_integer_keyed_int(INTVAL key)
Returns the integer value of the element at index key.
INTVAL get_integer_keyed(PMC *key)
Returns the integer value of the element at index key.
FLOATVAL get_number_keyed_int(INTVAL key)
Returns the float value of the element at index key.
FLOATVAL get_number_keyed(PMC *key)
Returns the float value of the element at index key.
STRING *get_string_keyed_int(INTVAL key)
Returns the string value of the element at index key.
STRING *get_string_keyed(PMC *key)
Returns the string value of the element at index key.
PMC *get_pmc_keyed_int(INTVAL key)
Returns the PMC value of the element at index key.
PMC *get_pmc_keyed(PMC *key)
Returns the PMC value of the element at index key.
void set_integer_native(INTVAL size)
Sets the length of the array to size.
void set_integer_same(PMC *value)
Sets the length of the array to the number of elements in *value.
void set_integer_keyed_int(INTVAL key, INTVAL value)
Sets the integer value of the PMC at element key to value.
void set_integer_keyed(PMC *key, INTVAL value)
Sets the integer value of the PMC at element key to value.
void set_number_keyed_int(INTVAL key, FLOATVAL value)
Sets the numeric value of the PMC at element key to value.
void set_number_keyed(PMC *key, FLOATVAL value)
Sets the numeric value of the PMC at element key to value.
void set_string_keyed_int(INTVAL key, STRING *value)
Sets the string value of the PMC at element key to value.
void set_string_keyed(PMC *key, STRING *value)
Sets the string value of the PMC at element key to value.
void set_pmc_keyed_int(INTVAL idx, PMC *src)
Sets the PMC at element idx to *src.
void set_pmc_keyed(PMC *key, PMC *value)
Sets the PMC at index key to value.
void push_integer(INTVAL value)
Extends the array by adding an element of value value to the end of the array.
void push_float(FLOATVAL value)
Extends the array by adding an element of value value to the end of the array.
void push_string(STRING *value)
Extends the array by adding an element of value *value to the end of the array.
void push_pmc(PMC *value)
Extends the array by adding an element of value *value to the end of the array.
void unshift_integer(INTVAL value)
Extends the array by adding an element of value value to the start of the array.
void unshift_float(FLOATVAL value)
Extends the array by adding an element of value value to the start of the array.
void unshift_string(STRING *value)
Extends the array by adding an element of value *value to the start of the array.
void unshift_pmc(PMC *value)
Extends the array by adding an element of value *value to the start of the array.
INTVAL pop_integer()
Removes and returns an integer from the end of the array.
FLOATVAL pop_float()
Removes and returns a float value from the end of the array.
STRING *pop_string()
Removes and returns a string from the end of the array.
PMC *pop_pmc()
Removes and returns a PMC from the end of the array.
INTVAL shift_integer()
Removes and returns an integer from the start of the array.
FLOATVAL shift_float()
Removes and returns a float from the start of the array.
STRING *shift_string()
Removes and returns a string from the start of the array.
PMC *shift_pmc()
Removes and returns a PMC from the start of the array.
void splice(PMC *value, INTVAL offset, INTVAL count)
Replaces count elements starting at offset with the elements in value.If count is 0 then the elements in value will be inserted after offset.
INTVAL defined_keyed_int(INTVAL key)
Returns TRUE is the element at key is defined; otherwise returns false.
INTVAL defined_keyed(PMC *key)
Returns TRUE is the element at key is defined; otherwise returns false.
INTVAL exists_keyed_int(INTVAL key)
Returns TRUE is the element at key exists; otherwise returns false.
INTVAL exists_keyed(PMC *key)
Returns TRUE is the element at key exists; otherwise returns false.
void delete_keyed_int(INTVAL key)
Removes the element at key.
void delete_keyed(PMC *key)
Removes the element at *key.
INTVAL is_equal(PMC *value)
The == operation. Compares two array to hold equal elements.
PMC *slice(PMC *key, INTVAL f)
Return a new iterator for the slice PMC key if f == 0.Return a new pythonic array slice if f == 1.
PMC *get_iter()
Return a new iterator for SELF.
void visit(visit_info *info)
This is used by freeze/thaw to visit the contents of the array.*info is the visit info, (see include/parrot/pmc_freeze.h).
void freeze(visit_info *info)
Used to archive the array.
void thaw(visit_info *info)
Used to unarchive the array.
PMC *share_ro()
Recursively make the array read-only and shared.

SEE ALSO

src/list.c, include/parrot/list.h

TODO

Create global immutable undef object.