blob: 90a32e475d8dad3529809e9e645714bd0ee0e6d9 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
//interop simple = "c" (); //<-- this should not be allowed!
interop simple = "c" (:current_dir, "simple.h", @[:strip("SOME_PREFIX_")]);
int main()
{
int y = simple:const_int;
simple:var_int = 2;
int^ p = simple:ptr_int;
int#[2]^ pa = simple:ptr_to_arr;
int unknownelem = simple:unknownsize#[5];
simple:getchar();
simple:funcptr^();
int ^q = simple:func();
byte b;
byte^#[3] arr = [@b, @b, @b];
int^? opt_ptr = none;
simple:putchar(65);
//simple:funcptr_func(@simple:putchar); // not allowed since the function parameters have different names
simple:funcptr_func(@simple:putchar as int(int)^);
simple:funcptr_func(none);
simple:void_functionptr(@simple:void_function);
simple:test_void(p, @arr);
simple:test_void(none, none);
simple:test_void(opt_ptr, none);
simple:_Tagged:tagstruct testtagged = (1,);
simple:_Tagged:tagenum1 testenum1 = :TAGENUM1_B;
simple:_Tagged:tagenum2 testenum2 = simple:_Tagged:tagenum2:TAGENUM2_A;
// TODO fix typedefs of structs/enums in the c interop
var simple:_Tagged:enumexpr ee;
ee = simple:_Tagged:enumexpr:EE1;
ee = simple:_Tagged:enumexpr:EE2;
ee = simple:_Tagged:enumexpr:EE3;
simple:testvarargs(0, 123 as int);
simple:testvarargs(0, 123 as int, 456 as int);
simple:typedef_struct ts;
simple:wierdtypedef^ x;
// TODO implement prefix stripping for tag identifiers
simple:spstuff = 123;
//simple:_Tagged:spstruct1 spst1;
simple:spstruct2 spst2;
//simple:_Tagged:spstruct3a spst3a;
simple:spstruct3b spst3b;
//simple:_Tagged:spenum1 spen1;
simple:spenum2 spen2;
//simple:_Tagged:spenum3a spen3a;
simple:spenum3b spen3b;
var simple:priv_t^ privptr;
simple:usepriv(privptr);
simple:end = 1;
return 0;
}
|