Skip to content

Packages

Amukh1 edited this page May 3, 2023 · 10 revisions

Core

print

print("hello ");
print("world");
hello world

println

println("hello");
println("world");
hello
world

printstr

printstr("hello");
printstr("world");
hello
world

Vector

Definition:

var vector = size;
var& vp = vector;

push_back

pushes value top of array

push_back(vp, value);

set

sets value of array at index

set(vp, index, value);

retr

retrieves a value of array at index

var valie = retr(vp, index);

Memory

alloc

allocates n bytes of memory in the heap, returns a pointer

var a = alloc(4);

a is a pointer to the 4 bytes (dword) stored in the heap.

malloc

puts a value in allocated space, given a pointer

var a = alloc(4);
malloc(a, "hi!");
var* ap = a;
printstr(ap, 3);
hi!

free

clears memory in allocated space

var a = alloc(4);
malloc(a, "hi!");
var* ap = a;
printstr(ap, 3);
free(a);
var* ap = a;
printstr(ap, 3);
hi!

Clone this wiki locally