summaryrefslogtreecommitdiff
path: root/tnslc/simple.tnsl
blob: 90ee758096b505a22821e07617ab29d883051abe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# No longer simple
:include "c_wrap.tnsl"

enum LOL [int] {
    A = 1,
    B = 2,
    C = 4
}

struct Lolbert {
    int a, b, c,

    ~uint8 stuff
}

/; lolbert1 (~Lolbert l, uint8 check) [bool]
    return l`.a == check
;/


/; main [int]
    Lolbert lol
    lol.a = 1
    lol.b = 4
    lol.c = 3
    lol.stuff = _alloc(2)
    lol.stuff{0} = 2
    lol.stuff{1} = 1

    /; if (lolbert1(~lol, lol.stuff{1}) && lolbert1(~lol, lol.stuff{0}))
        _delete(lol.stuff)
        return lol.a + lol.b
    ;/
    _delete(lol.stuff)
    return 0
;/