import "libc.hff"; import "libc.hff"; struct Vec2f; struct Vec2f { x f32, y f32, } union Val { x i64, lo i32, y f64, } enum Color { Red, Green, Blue } static xs *void = {}, ok = 6; defmacro each(i, x, arr, &body) [ for let i = 0; i < sizeof(arr)/sizeof(arr[0]); ++i { let x = arr[i]; body } ] defmacro times(n,&body) [ for let $i = 0; $i < (n); ++$i { body } ] fn isort(xs *int, n usize) void { fn icmp(lhs *const void, rhs *const void, _ *void) int { let lhs = *as(*int)lhs, rhs = *as(*int)rhs; return lhs - rhs; } qsort(xs, n, 4, &icmp); fn foo() void {} let x= &foo; x(); } extern fn main (argc int, argv **u8) int { let colors [3]Color = { :Red, :Green, :Blue } ; let x = Vec2f { .y: 1, .x: 2.4 }; let p = &x; printf("v = { %g, %g }\n", x.x, p.y); let xs [10]int = { [4] = 1, 2, [1 - 1] = 3 }; isort(xs, 10); each(i, x, xs) { printf("%d\n", xs[i]); } printf("sizeof(is) = %zu\n", sizeof(xs)); printf("sizeof *void = %zu\n", sizeof *void); return 0; }