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 static PMC *retval(PARROT_INTERP, void *ret)
Processes static PMC *Parrot_Array_set_pmc_ptr(PARROT_INTERP, List *list, INTVAL key)
Returns a pointer to the element at index
Undef
PMC.
*ret
,
returning the appropriate PMC,
or raising an exception if necessary.
key
of *list
.
If this element was previously empty,
then this function also creates and assigns an "undef" PMC to that element.Methods
void init()
Initializes the PMC by calling the underlying void init_pmc(PMC *init)
void assign_pmc(PMC *other)
Copy the contents of other to self.
void set_pmc(PMC *other)
Implemented as an alias to 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 INTVAL get_integer_keyed(PMC *key)
Returns the integer value of the element at index FLOATVAL get_number_keyed_int(INTVAL key)
Returns the float value of the element at index FLOATVAL get_number_keyed(PMC *key)
Returns the float value of the element at index STRING *get_string_keyed_int(INTVAL key)
Returns the string value of the element at index STRING *get_string_keyed(PMC *key)
Returns the string value of the element at index PMC *get_pmc_keyed_int(INTVAL key)
Returns the PMC value of the element at index PMC *get_pmc_keyed(PMC *key)
Returns the PMC value of the element at index void set_integer_native(INTVAL size)
Sets the length of the array to void set_integer_same(PMC *value)
Sets the length of the array to the number of elements in void set_integer_keyed_int(INTVAL key, INTVAL value)
Sets the integer value of the PMC at element void set_integer_keyed(PMC *key, INTVAL value)
Sets the integer value of the PMC at element void set_number_keyed_int(INTVAL key, FLOATVAL value)
Sets the numeric value of the PMC at element void set_number_keyed(PMC *key, FLOATVAL value)
Sets the numeric value of the PMC at element void set_string_keyed_int(INTVAL key, STRING *value)
Sets the string value of the PMC at element void set_string_keyed(PMC *key, STRING *value)
Sets the string value of the PMC at element void set_pmc_keyed_int(INTVAL idx, PMC *src)
Sets the PMC at element void set_pmc_keyed(PMC *key, PMC *value)
Sets the PMC at index void push_integer(INTVAL value)
Extends the array by adding an element of value void push_float(FLOATVAL value)
Extends the array by adding an element of value void push_string(STRING *value)
Extends the array by adding an element of value void push_pmc(PMC *value)
Extends the array by adding an element of value void unshift_integer(INTVAL value)
Extends the array by adding an element of value void unshift_float(FLOATVAL value)
Extends the array by adding an element of value void unshift_string(STRING *value)
Extends the array by adding an element of value void unshift_pmc(PMC *value)
Extends the array by adding an element of value 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 INTVAL defined_keyed_int(INTVAL key)
Returns TRUE is the element at INTVAL defined_keyed(PMC *key)
Returns TRUE is the element at INTVAL exists_keyed_int(INTVAL key)
Returns TRUE is the element at INTVAL exists_keyed(PMC *key)
Returns TRUE is the element at void delete_keyed_int(INTVAL key)
Removes the element at void delete_keyed(PMC *key)
Removes the element at INTVAL is_equal(PMC *value)
The PMC *slice(PMC *key, INTVAL f)
Return a new iterator for the slice PMC 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.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.
list_new()
function.
*init
contains the initialization information specifying initial size,
number of dimensions,
etc.
assign_pmc
since the behavior is the same.
key
.
key
.
key
.
key
.
key
.
key
.
key
.
key
.
size
.
*value
.
key
to value
.
key
to value
.
key
to value
.
key
to value
.
key
to value
.
key
to value
.
idx
to *src
.
key
to value
.
value
to the end of the array.
value
to the end of the array.
*value
to the end of the array.
*value
to the end of the array.
value
to the start of the array.
value
to the start of the array.
*value
to the start of the array.
*value
to the start of the array.
count
elements starting at offset
with the elements in value
.If count
is 0 then the elements in value
will be inserted after offset
.
key
is defined; otherwise returns false.
key
is defined; otherwise returns false.
key
exists; otherwise returns false.
key
exists; otherwise returns false.
key
.
*key
.
==
operation.
Compares two array to hold equal elements.
key
if f == 0.Return a new pythonic array slice if f == 1.
*info
is the visit info,
(see include/parrot/pmc_freeze.h).
SEE ALSO
src/list.c, include/parrot/list.h
TODO
Create global immutable undef object.