64 lines
1.3 KiB
Core
64 lines
1.3 KiB
Core
|
|
/*
|
|
PushStruct :: (a: *MA.Arena, $T: Type): *$T
|
|
size := size_of(Type)
|
|
result := PushSize(a, size)
|
|
return result
|
|
|
|
Array(int)
|
|
|
|
QueueAddSLL(list: $List, node: $Node, first: #Identifier = first, last: #Identifier = last, next: #Identifier = next)
|
|
|
|
ArrayAdd(array: $Array, item: $Item, data: #Identifier = data, len: #Identifier = len, len: #Identifier = cap)
|
|
|
|
QueueAddSLL(list: $List, node: $Node, $first = first, $last = last, $next = next)
|
|
if list.first == 0
|
|
list.first = list.last = node
|
|
else
|
|
list.last = list.last.next = node
|
|
*/
|
|
|
|
Array :: struct($T: Type)
|
|
data: *T
|
|
len: int
|
|
cap: int
|
|
|
|
Tuple :: struct($A: Type, $B: Type)
|
|
a: A
|
|
b: B
|
|
Triple :: struct($A: Type, $B: Type, $C: Type)
|
|
a: A
|
|
b: B
|
|
c: C
|
|
|
|
MakeArray :: (a: *int, count: int): Array(int)
|
|
result := Array(int) {
|
|
data = a,
|
|
len = count,
|
|
cap = count
|
|
}
|
|
return result
|
|
|
|
// :Multiple arguments
|
|
// @todo: maybe disallow multiple arguments in current form
|
|
// and use polimorphism. Then we could make var unpacking,
|
|
// unpack structs making it more powerful
|
|
MultipleArgs :: (): Tuple(int, F32)
|
|
return {32, 32}
|
|
|
|
PolyLambda :: (value: $T): T
|
|
pass
|
|
|
|
|
|
main :: (argc: int, argv: **char): int
|
|
buff: *int
|
|
array: Array(int) = {len = 10, cap = 10, data = buff}
|
|
second_array: Array(int)
|
|
third_array: Array(int)
|
|
fourth: Array(F32)
|
|
fifth: Array(F32)
|
|
|
|
// a,b := MultipleArgs()
|
|
a := MultipleArgs()
|
|
|
|
return 0 |