NAME ^

src/classes/sarray.pmc - Subroutine Parameter Array

DESCRIPTION ^

These are the vtable functions for the SArray base class

SArray data are kept in an malloced array of HashEntry's:

0 start_idx

First index, for shift.

1 end_idx

Last index, for push.

2...

Data.

This is the Simple (or Static) Array class for parameter passing according to PDD 3.

SArrays are fixed size, implying that the first operation on it must be setting its size, and that only the most important vtable methods are implemented

Functions ^

static PARROT_INLINE INTVAL ret_int(Interp *interpreter, HashEntry *e)

Processes *e, returning the appropriate integer, or raising an exception if necessary.

static PARROT_INLINE FLOATVAL ret_num(Interp *interpreter, HashEntry *e)

Processes *e, returning the appropriate floating-point number, or raising an exception if necessary.

static PARROT_INLINE STRING *ret_string(Interp *interpreter, HashEntry *e)

Processes *e, returning the appropriate Parrot string, or raising an exception if necessary.

static PARROT_INLINE PMC *ret_pmc(Interp *interpreter, HashEntry *e)

Processes *e, returning the appropriate PMC, or raising an exception if necessary.

static PARROT_INLINE HashEntry *shift_entry(PMC *self)

Removes and returns the first element from the array.

static PARROT_INLINE HashEntry *get_entry(PMC *self, INTVAL key)

Returns the element for index key.

Methods ^

void init()

Initializes the array.

void morph(INTVAL type)

Const classes must have a morph().

void mark()

Marks the array as live.

void destroy()

Destroys the array.

PMC *clone()

Creates and returns a copy of the array.

INTVAL get_bool()

Returns whether the array has any elements.

INTVAL elements()

INTVAL get_integer()

Returns the number of elements in the array.

INTVAL type_keyed_int(INTVAL key)

Returns the type of the element at index key.

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.

INTVAL shift_integer()

Removes the first element from the array and returns its integer value.

FLOATVAL get_number_keyed_int(INTVAL key)

Returns the floating-point value of the element at index key.

FLOATVAL get_number_keyed (PMC *key)

Returns the floating-point value of the element at index *key.

FLOATVAL shift_float()

Removes the first element from the array and returns its floating-point value.

STRING *get_string_keyed_int(INTVAL key)

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

STRING *get_string_keyed(PMC *key)

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

STRING *shift_string()

Removes the first element from the array and returns its Parrot string value.

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.

PMC *shift_pmc()

Removes the first element from the array and returns its PMC value.

void set_integer_native(INTVAL size)

Resizes the array to size elements.

void set_integer_keyed_int(INTVAL key, INTVAL value)

Sets the integer value of the element at index key to value.

void push_integer(INTVAL value)

Adds an element with integer value value to the end of the array.

void set_number_keyed_int(INTVAL key, FLOATVAL value)

Sets the floating-point value of the element at index key to value.

void push_float(FLOATVAL value)

Adds an element with floating-point value value to the end of the array.

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)

Adds an element with Parrot string value *value to the end of the array.

void set_pmc_keyed_int(INTVAL key, PMC *src)

Sets the PMC value of the element at index key to *src.

void push_pmc(PMC *value)

Adds an element with PMC value *value to the end of the array.

SEE ALSO ^

docs/pdds/pdd03_calling_conventions.pod.

HISTORY ^

Initial version 2003.07.04 by leo

2003.11.06 boemmels renamed HASH_ENTRY to HashEntry


parrot