aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/test.cff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-04 15:46:32 +0200
committerlemon <lsof@mailbox.org>2022-08-04 15:46:32 +0200
commitd104761e3c213504f5a6dfb63059fc905fe6799f (patch)
tree5b51d3147ce0506d331e89874033af0d4eb260e3 /bootstrap/test.cff
parent8a5bde697364ca301c14471196d137c3a53c25fa (diff)
enum
Diffstat (limited to 'bootstrap/test.cff')
-rw-r--r--bootstrap/test.cff25
1 files changed, 24 insertions, 1 deletions
diff --git a/bootstrap/test.cff b/bootstrap/test.cff
index ba47c6d..d962b16 100644
--- a/bootstrap/test.cff
+++ b/bootstrap/test.cff
@@ -1,7 +1,30 @@
-typedef v3f ["!"[~-1] - 30]f32;
+typedef v3f ["!"[~-1] - as(int)30.0]f32;
+
+enum Color {
+ Red = 7,
+ Green = -10,
+ Blue,
+}
+
+fn best() Color {
+ return :Green;
+}
+
+fn hex(c Color) u32 {
+ switch (c) {
+ case :Red do return 0xFF0000;
+ case :Green do return 0x00FF00;
+ case :Blue do return 0x0000FF;
+ }
+}
extern fn main (argc int, argv **u8) void {
extern fn printf(fmt *const u8, ...) int;
+
+ printf("red %d\n", Color:Red);
+ printf("green %d\n", Color:Green);
+ printf("blue %d\n", Color:Blue);
+ printf("red ! %.8X\n", hex(:Red));
return;
}