classes/resizablepmcarray.pmc - resizable size array for PMCs only


This class, ResizablePMCArray, implements an array of resizable size, which stores PMCs, it puts things into Integer, Float, or String PMCs as appropriate

TODO currently this uses PerlString instead of String PMCs.

Functions ^

void *invoke(void *next)

Pythonic object constructor. SELF is a ResizeablePMCArray Class object. Return a new list object according to 2.1. Built-in Functions.

void set_integer_native(INTVAL size)

Resizes the array to size elements.

PMC *get_pmc_keyed_int(INTVAL key)

Returns the PMC value of the element at index key.

void set_pmc_keyed_int(INTVAL key, PMC *src)

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

void set_pmc_keyed(PMC *key, PMC *src)

If key is a slice, do a splice as set that item.

PMC *clone()

Creates and returns a copy of the array.

INTVAL is_equal (PMC *value)

The == operation. Compares two array to hold equal elements.

void multiply_int(INTVAL value, PMC *dest)

Python (b6.main):

 # L = [1] * 1000000

  4           0 LOAD_CONST               1 (1)
              3 BUILD_LIST               1
              6 LOAD_CONST               2 (1000000)
              9 BINARY_MULTIPLY
             10 STORE_FAST               2 (L)
Build a list by duplicating the passed list N times. Only implemented for list.elements == 1.




Initial version 2004.06.11 by Matt Fowles Changed allocator to double size - MF 2004.06.15