NAME ^

src/pmc/multiarray.pmc - Multi-dimensional Array

DESCRIPTION ^

MultiArray extends Array to provide a multi-dimensional array.

This is one way for calculating offsets in 2 dimensional space.

MULTIDIM CALC OFFSET

Algorithm:

    i + j*Ni + k*Ni*Nj + l*Ni*Nj*Nk ...

where i,j,k,l... are coordinates in a multidimensional space and Ni,Nj,Nk... are the lengths of the dimensions.

Limitations: the array can only expand in the last dimension The first (n-1) dimensions of a n-dimensional array are fixed and layed out at array creation.

Functions ^

static INTVAL calc_offset(Interp *interpreter, List *list, PMC *key)

Calculates the offset for *key.

void init()

Overrides the default in Array. There is no initialization.

INTVAL get_integer_keyed(PMC *key)

Returns the integer value for *key.

FLOATVAL get_number_keyed(PMC *key)

Returns the floating-point number value for *key.

STRING *get_string_keyed(PMC *key)

Returns the Parrot string value for *key.

PMC *get_pmc_keyed (PMC *key)

Returns the PMC value for *key.

void set_integer_keyed(PMC *key, INTVAL value)

Sets the integer value value at *key.

void set_number_keyed(PMC *key, FLOATVAL value)

Sets the floating-point number value value at *key.

void set_string_keyed(PMC *key, STRING *value)

Sets the Parrot string value value at *key.

void set_pmc_keyed(PMC *dest_key, PMC *src)

Unimplemented.

HISTORY ^

Initial revision by Josef Hook <joh@stacken.kth.se>

1.6 Based on list.c by Leopold Toetsch <lt@toetsch.at>


parrot