aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/test.cff
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/test.cff')
-rw-r--r--bootstrap/test.cff11
1 files changed, 11 insertions, 0 deletions
diff --git a/bootstrap/test.cff b/bootstrap/test.cff
index 966176f..f74619a 100644
--- a/bootstrap/test.cff
+++ b/bootstrap/test.cff
@@ -17,6 +17,16 @@ enum Color {
static xs *void = {};
+fn isort(xs *int, n usize) void {
+ extern fn qsort(base *void, nmemb usize, size usize, compar *fn(l *const void, r *const void, _ *void) int) void;
+ fn icmp(lhs *const void, rhs *const void, _ *void) int {
+ let lhs = *as(*int)lhs;
+ let rhs = *as(*int)rhs;
+ return lhs - rhs;
+ }
+ qsort(xs, n, 4, &icmp);
+}
+
extern fn main (argc int, argv **u8) int {
extern fn printf(fmt *const u8, ...) int;
@@ -25,6 +35,7 @@ extern fn main (argc int, argv **u8) int {
printf("v = { %g, %g }\n", x.x, x.y);
let is [10]int = { [4] = 1, 2, [1 - 1] = 3 };
+ isort(is, 10);
for let i = 0; i < 10; ++i {
printf("%d\n", is[i]);
}