NAME ^

src/pmc/resizablestringarray.pmc - resizable array for strings only

DESCRIPTION ^

ResizableStringArray implements a resizeable array which stores Parrot strings only. Any ints or floats assigned to elements of the array will first be converted to String PMCs and then to native Parrot strings. PMCs assigned to to elements of the array will be stringified by having their get_string method called.

Functions ^

STRING *get_string_keyed_int(INTVAL key)

Returns the Parrot string value of the element at index key.

void set_string_keyed_int(INTVAL key, STRING *value)

Sets the Parrot string value of the element at index key to value.

void push_string (STRING *value)

Extends the array by adding an element of value *value to the end of the array.

STRING *pop_string()

Removes and returns the last element in the array.

PMC *pop_pmc()

Removes and returns the last element in the array.

INTVAL pop_integer()

Removes and returns the last element in the array.

FLOATVAL pop_float()

Removes and returns the last element in the array.

void set_integer_native(INTVAL size)

Resizes the array to size elements.

PMC *clone()

Creates and returns a copy of the array.

STRING *shift_string()

Removes and returns an item from the start of the array.

PMC *shift_pmc()

Removes and returns the first element in the array.

INTVAL shift_integer()

Removes and returns the first element in the array.

FLOATVAL shift_float()

Removes and returns the first element in the array.

void push_pmc (PMC *value)

Extends the array by adding an element of value *value to the end of the array.

void push_integer (INTVAL value)

Extends the array by adding an element of value *value to the end of the array.

void push_float (FLOAT value)

Extends the array by adding an element of value *value to the end of the array.

PMC *shift_pmc()

Removes and returns a String PMC from 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 front of the array.

void unshift_integer (INTVAL value)

Extends the array by adding an element of value *value to the front of the array.

void unshift_float (FLOAT value)

Extends the array by adding an element of value *value to the front of the array.

void delete_keyed_int(INTVAL key)

Converts key to a PMC key and calls delete_keyed() with it.

void delete_keyed(PMC *key)

Removes the element at *key.

SEE ALSO ^

docs/pdds/pdd17_basic_types.pod.

HISTORY ^

Initial version - Matt Fowles 2004-06-11 Changed allocator to double size - Matt Fowles 2004-06-15 Added push_string - Bernhard Schmalhofer 2004-10-17 moved available size to int_val2 - Matt Fowles 2005-07-22


parrot