std/dlist.slm

Contents

class dlist SIZE: 24b

Dynamic list, an expandable array.

prop dlist.max SIZE: 8b POS: 0b

The available free elements in the list.

prop dlist.size SIZE: 8b POS: 8b

The elements in the list.

prop dlist.elemsize SIZE: 8b POS: 16b

The size of an element in the list.

prop dlist.data SIZE: 0b POS: 24b

The data for the list.

const dlist.STEP VALUE: 16

How much elememnts to allocate when a list needs to expand.

proc dlist.new START: 1 RET: 1

int[elemsize] => ptr[dlist]

Creates a new dlist.

proc dlist.free START: 1 RET: 0

ptr[dlist] => _

Frees a dlist from the heap.

proc dlist.len START: 1 RET: 1

ptr[dlist] => int[length]

Gets the length of a dlist.

proc dlist.getptr START: 2 RET: 1

ptr[dlist] int[idx] => ptr[element]

Gets the idx element of a dlist.

proc dlist.pop START: 1 RET: 1

ptr[dlist] => ptr[element]

Gets the last element of a dlist, and removes it.

proc dlist.append START: 2 RET: 1

ptr[dlist] ptr[data] => ptr[dlist]

Adds a element to the end of a dlist, may reposition the dlist.

proc dlist.last START: 1 RET: 2

ptr[dlist] => ptr[element]

Returns the last element in a dlist.