std/cstr.slm

Contents

class cstr SIZE: 0b

Stores a cstring, null terminated char array.

proc cstr.len START: 1 RET: 1

ptr[cstr] => int[length]

Gets the length of a cstring.

proc cstr.print START: 1 RET: 0

ptr[cstr] => _

Prints a cstring to the console.

proc cstr.println START: 1 RET: 0

ptr[cstr] => _

Prints a cstring to the console followed by a new line.

proc cstr.cr START: 0 RET: 0

_ => _

Prints a new line to the console.

proc cstr.eq START: 2 RET: 1

ptr[cstr] ptr[cstr] => int[equal]

Compares 2 cstrings, returns bool.true if they are equal.

proc cstr.cpy START: 2 RET: 2

ptr[dest] ptr[src] => ptr[dest] ptr[src]

Copies src to desc and appends a null terminator.

proc cstr.last START: 1 RET: 1

ptr[cstr] => ptr[last]

Gets the last char in the cstring.

proc cstr.clear START: 1 RET: 1

ptr[cstr] => ptr[cstr]

Fills a cstring with zeros.

proc cstr.cat START: 2 RET: 1

ptr[dest] ptr[src] => ptr[dest]

Appends src to dest.

proc cstr.isnum START: 1 RET: 1

ptr[cstr] => int[number?]

Returns bool.true if a cstr is a number.

proc cstr.int START: 1 RET: 1

ptr[cstr] => int[value]

Converts a cstring to a number.

proc cstr.split START: 3 RET: 2

ptr[src] int[delim] ptr[dest] => ptr[start] ptr[end]

Splits src at delim, destroys src.

proc cstr.iter START: 1 RET: 2

ptr[self] => ptr[self] ptr[next]

iterates through a cstr.