removed 'proc's; more fun output
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 10 Apr 2021 03:00:38 +0000 (22:00 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sat, 10 Apr 2021 03:00:38 +0000 (22:00 -0500)
43 files changed:
bin/onyx
core/array.onyx
core/builtin.onyx
core/io/file.onyx
core/math.onyx
core/runtime/js.onyx
core/runtime/wasi.onyx
core/stdio.onyx
examples/07_structs.onyx
include/onyxastnodes.h
progs/foo_test.onyx
progs/odin_example.onyx
progs/particle_sym.onyx
progs/poly_solidify.onyx
progs/simd_test.onyx
progs/vararg_test.onyx
progs/wasi_test.onyx
src/onyx.c
src/onyxdoc.c
src/onyxentities.c
src/onyxtypes.c
src/onyxutils.c
src/onyxwasm.c
tests/aoc-2020/day10.onyx
tests/aoc-2020/day11.onyx
tests/aoc-2020/day17.onyx
tests/aoc-2020/day5.onyx
tests/aoc-2020/day9.onyx
tests/array_struct_robustness.onyx
tests/baked_parameters.onyx
tests/compile_time_procedures.onyx
tests/defer_with_continue.onyx
tests/hello_world.onyx
tests/i32map.onyx
tests/multiple_returns_robustness.onyx
tests/named_arguments_test.onyx
tests/operator_overload.onyx
tests/overload_with_autocast.onyx
tests/poly_structs_with_values.onyx
tests/polymorphic_array_lengths.onyx
tests/string_stream_test.onyx
tests/struct_robustness.onyx
tests/vararg_test.onyx

index a733f4b9ce3a68cabb61d2577f856de8f62869ea..5e9795c52834ec7a4bba1215c8614db40fc2a096 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index f1a52cb162a7ecf6bc0e94851e20466eb72a3bef..562e3602a9c59b9001752f8c5ca43edb636cbefd 100644 (file)
@@ -156,17 +156,18 @@ sort :: (arr: ^[..] $T, cmp: (T, T) -> i32) {
     }
 }
 
-fold :: (arr: ^[..] $T, init: $R, f: (T, R) -> R) -> R {
-    val := init;
-    for it: *arr do val = f(it, val);
-    return val;
-}
-
-// CLEANUP: :slice Move this elsewhere when more slice functionality is added
-fold_slice :: (arr: [] $T, init: $R, f: (T, R) -> R) -> R {
-    val := init;
-    for it: arr do val = f(it, val);
-    return val;
+fold :: proc {
+    (arr: ^[..] $T, init: $R, f: (T, R) -> R) -> R {
+        val := init;
+        for it: *arr do val = f(it, val);
+        return val;
+    },
+
+    (arr: [] $T, init: $R, f: (T, R) -> R) -> R {
+        val := init;
+        for it: arr do val = f(it, val);
+        return val;
+    }
 }
 
 map :: (arr: ^[..] $T, data: $R, f: (T, R) -> T) {
@@ -174,23 +175,31 @@ map :: (arr: ^[..] $T, data: $R, f: (T, R) -> T) {
 }
 
 #private_file
-greatest_impl :: (arr: ^$T, count: i32) -> (i32, T) {
-    greatest_idx := 0;
-    greatest     := arr[0];
+fold_idx_elem :: (arr: ^$T, count: i32, cmp: (T, T) -> bool) -> (i32, T) {
+    idx  := 0;
+    elem := arr[0];
     
     for i: 1 .. count {
-        if arr[i] > greatest {
-            greatest_idx = i;
-            greatest     = arr[i];
+        if cmp(arr[i], elem) {
+            idx  = i;
+            elem = arr[i];
         }
     }
     
-    return greatest_idx, greatest;
+    return idx, elem;
 }
 
-// This pattern should be expanded on to make all kinds of folding functions.
+#private_file cmp_greater :: (x: $T, y: T) -> bool do return x > y;
+#private_file cmp_less    :: (x: $T, y: T) -> bool do return x < y;
+
 greatest :: proc {
-    (arr: [..] $T) -> (i32, T) { return greatest_impl(arr.data, arr.count); },
-    (arr: [] $T)   -> (i32, T) { return greatest_impl(arr.data, arr.count); },
-    (arr: [$N] $T) -> (i32, T) { return greatest_impl(cast(^T) arr, N); },
+    (arr: [..] $T) -> (i32, T) { return fold_idx_elem(arr.data, arr.count, cmp_greater); },
+    (arr: [] $T)   -> (i32, T) { return fold_idx_elem(arr.data, arr.count, cmp_greater); },
+    (arr: [$N] $T) -> (i32, T) { return fold_idx_elem(cast(^T) arr, N,     cmp_greater); },
+}
+
+least :: proc {
+    (arr: [..] $T) -> (i32, T) { return fold_idx_elem(arr.data, arr.count, cmp_less); },
+    (arr: [] $T)   -> (i32, T) { return fold_idx_elem(arr.data, arr.count, cmp_less); },
+    (arr: [$N] $T) -> (i32, T) { return fold_idx_elem(cast(^T) arr, N,     cmp_less); },
 }
index b15509f51fa08b1e21ff39421d95bef73a14003b..7a7fd34c45144057966c99ba54727353281c6bae 100644 (file)
@@ -136,6 +136,7 @@ calloc  :: (size: u32) -> rawptr do return raw_alloc(context.allocator, size);
 cresize :: (ptr: rawptr, size: u32) -> rawptr do return raw_resize(context.allocator, ptr, size);
 cfree   :: (ptr: rawptr) do raw_free(context.allocator, ptr);
 
+// CLEANUP: Does this really need to be limited to a non-custom runtime?
 #if runtime.Runtime != runtime.Runtime_Custom {
     new :: ($T: type_expr, allocator := context.allocator, initialize := true) -> ^T {
         res := cast(^T) raw_alloc(allocator, sizeof T);
index 757be624c7c9a1e9be51193b6015a988695fa6a3..36d7b404ffe41993920c1f119973b540235f85e7 100644 (file)
@@ -151,7 +151,7 @@ get_contents_from_file :: (file: File) -> str {
 get_contents :: proc {
     get_contents_from_file,
 
-    proc (path: str) -> str {
+    (path: str) -> str {
         tmp_file, success := file_open(path, OpenMode.Read);
         if !success do return .{ null, 0 };
         defer file_close(tmp_file);
index ad579b23fe4ab3b38958c9753744dbd4630aec87..b7b48a5782401a6df177400800727d3c6198a842 100644 (file)
@@ -249,7 +249,7 @@ clamp :: (v: $T, lo: T, hi: T) -> T {
 }
 
 sqrt :: proc { wasm.sqrt_f32, wasm.sqrt_f64, sqrt_poly }
-sqrt_poly :: proc (x: $T) -> T {
+sqrt_poly :: (x: $T) -> T {
     return ~~ sqrt_f64(~~ x);
 }
 
index 2907569cd7a021f5399c284bc5956b2d70ec6335..2891881decad7ee8ad41b599b1a44be198468674 100644 (file)
@@ -10,7 +10,7 @@ __exit          :: (status: i32) -> void #foreign "host" "exit" ---
 
 // The builtin _start proc.
 // Sets up everything needed for execution.
-proc () #export "_start" {
+_start :: () -> void #export "_start" {
     __runtime_initialize();
 
     args: [] cstr = .{ null, 0 };
index 3fdb3365b5796f649ed116406d7af06a0b6478d7..a28b73cfae9bd6bfb39ce9fbe323692b84f9ef0b 100644 (file)
@@ -21,7 +21,7 @@ __exit :: (status: i32) do proc_exit(status);
 
 // The builtin _start proc.
 // Sets up everything needed for execution.
-proc () #export "_start" {
+_start :: () -> void #export "_start" {
     __runtime_initialize();
 
     args : [] cstr;
index 86569be3a69200993f9d12f666a2580505a6532a..f272143768f134cdee61a1ecdc5da59bb0571e5b 100644 (file)
@@ -12,10 +12,12 @@ use package runtime as runtime
     #error "'stdio' can only be included in the 'wasi' or 'js' runtime."
 }
 
+auto_flush_stdio := true
+
 print :: proc {
     (x: str) {
         io.write(^print_writer, x);
-        if x[x.count - 1] == #char "\n" do __flush_stdio();
+        if x[x.count - 1] == #char "\n" && auto_flush_stdio do __flush_stdio();
     },
 
     (x: $T)        { io.write(^print_writer, x); },
index efbe9da7edb3a654fc05ea04c135c82e2874545a..b562d0595754553cb7c68e049613095fe7356c30 100644 (file)
@@ -127,7 +127,7 @@ main :: (args: [] cstr) {
     // pointer conversion between two structs, A and B, if A is the first member of B, and is used.
     // For example, we can pass `thing` to this procedure, even though it is not a ComponentOne.
     // The first member is a ComponentOne and is used, so a implicit pointer conversion is always safe.
-    do_something_with_component_one :: proc (c: ^ComponentOne) {
+    do_something_with_component_one :: (c: ^ComponentOne) {
         printf("ComponentOne's name is %s.\n", c.name);
     }
 
@@ -161,6 +161,6 @@ main :: (args: [] cstr) {
 
 
 
-    print_spacer :: proc () do println("\n===========================================");
+    print_spacer :: () do println("\n===========================================");
 }
 
index 827072bbc033c90635e8fca4d00cc692cfa4d0e1..5d30efbc1cbac87976df62762243f253ec38892a 100644 (file)
@@ -981,6 +981,8 @@ typedef struct EntityHeap {
 
     i32 state_count[Entity_State_Count];
     i32 type_count[Entity_Type_Count];
+
+    i32 all_count[Entity_State_Count][Entity_Type_Count];
 } EntityHeap;
 
 void entity_heap_init(EntityHeap* entities);
index f395f2f558c680451c446ef04d93f66afeff9f96..83f131599475b4eff9649fcf7720d2e7dc62eeef 100644 (file)
@@ -4,6 +4,6 @@ use package core
 
 TestFoo :: struct { a: i32; }
 
-print_foo :: proc () do println("Foo!");
+print_foo :: () do println("Foo!");
 
 SomeEnum :: enum #flags { Val1; Val2; Val3; }
index 309f06c40bc1fd161ba5bcce171c6bc19f9b8c40..566a3d20d0ed67aecbac6cd4f8db01eb7bde484a 100644 (file)
@@ -30,7 +30,7 @@ Bar :: struct {
 // asdf :: proc (f: Foo) -> ...
 // asdf(bar.foo);
 
-print_foo :: proc (f: ^Foo) {
+print_foo :: (f: ^Foo) {
     print("Foo: \n");
     print(f.data1);
     print("\n");
@@ -38,7 +38,7 @@ print_foo :: proc (f: ^Foo) {
     print("\n");
 }
 
-print_bar :: proc (bar: ^Bar) {
+print_bar :: (bar: ^Bar) {
     print(bar.data1);
     print("\n");
     print(cast(i32) bar.data2);
@@ -47,7 +47,7 @@ print_bar :: proc (bar: ^Bar) {
     print("\n");
 }
 
-make_bar :: proc () -> Bar {
+make_bar :: () -> Bar {
     bar : Bar;
     bar.data1 = 1234;
     bar.data2 = 12.34f;
@@ -56,7 +56,7 @@ make_bar :: proc () -> Bar {
     return bar;
 }
 
-f :: proc () -> [5] [2] u32 #export "IAMTHEFUNCTION" {
+f :: () -> [5] [2] u32 #export "IAMTHEFUNCTION" {
     // This method of returning an array will leak memory, since this is never freed.
     // mem := cast(^u32) calloc(sizeof [5] [2] u32);
     // for i: 0 .. 10 do mem[i] = 1234 + i;
@@ -69,7 +69,7 @@ f :: proc () -> [5] [2] u32 #export "IAMTHEFUNCTION" {
     return mem;
 }
 
-compress :: proc (arr: [$N] $T, f : proc (T, T) -> T) -> T {
+compress :: (arr: [$N] $T, f : proc (T, T) -> T) -> T {
     val := arr[0];
     for i: 1..N do val = f(val, arr[i]);
     return val;
@@ -85,14 +85,14 @@ BadUnion :: struct {
 Vec2   :: struct { x: i32; y: i32; }
 Entity :: struct { use pos: Vec2; }
 
-array_literal_optim :: proc () #export {
+array_literal_optim :: () -> void #export {
     bar : [5] u32;
     bar = u32.[ 1, 2, 3, 4, 5 ];
     bar[2] = 1234;
     for b: bar do printf("b: %i\n", b);
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     a : BadUnion;
     a.int = 1234;
     a.float = 0.5;
@@ -112,7 +112,7 @@ main :: proc (args: [] cstr) {
         printf("%p == %p\n", cast(^u32) foo, ^foo);
         for ^thing: foo do for t: *thing do printf("%p %i\n", thing, t);
 
-        println(compress(f32.[ 1, 2, 3, 4, 5 ], proc (a: $T, b: T) -> T { return a + b; }));
+        println(compress(f32.[ 1, 2, 3, 4, 5 ], (a: $T, b: T) -> T { return a + b; }));
     }
 
     use package test { foo as foo_pkg }
index b52eec1738eeab22a518f984844dca0172c1ff01..fefebb4a821fe9381d6ab03fb5d378785ca2df0a 100644 (file)
@@ -6,7 +6,7 @@ package main
 use package core
 use package core.intrinsics.simd
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     init_positions();
     init_velocities();
 
@@ -24,7 +24,7 @@ OBJECT_COUNT :: 10000
 positions  : [OBJECT_COUNT] f32x4
 velocities : [OBJECT_COUNT] f32x4
 
-init_positions :: proc () {
+init_positions :: () {
     for ^p: positions {
         *p = f32x4_replace_lane(*p, 0, random.float(-127.0f, 127.0f));
         *p = f32x4_replace_lane(*p, 1, random.float(-127.0f, 127.0f));
@@ -33,23 +33,23 @@ init_positions :: proc () {
     }
 }
 
-init_velocities :: proc () {
+init_velocities :: () {
     for ^v: velocities do *v = f32x4_splat(0.0f);
 }
 
-horizontal_add :: proc (f: f32x4) -> f32 {
+horizontal_add :: (f: f32x4) -> f32 {
     return f32x4_extract_lane(f, 0)
          + f32x4_extract_lane(f, 1)
          + f32x4_extract_lane(f, 2)
          + f32x4_extract_lane(f, 3);
 }
 
-distance :: proc (x: f32x4, y: f32x4) -> f32 {
+distance :: (x: f32x4, y: f32x4) -> f32 {
     d := f32x4_sub(x, y);
     return horizontal_add(f32x4_mul(d, d));
 }
 
-update :: proc () {
+update :: () {
     for i: 0 .. OBJECT_COUNT {
         for j: 0 .. OBJECT_COUNT {
             dist := distance(positions[i], positions[j]);
@@ -64,7 +64,7 @@ update :: proc () {
     }
 }
 
-avg_motion :: proc () -> f32 {
+avg_motion :: () -> f32 {
     avg_motion := f32x4_splat(0.0f);
     obj_vec := f32x4_splat(cast(f32) OBJECT_COUNT);
     for v: velocities {
index 931c5e7e90b9f9967a407cc755ffe98075c9b735..4c623768b8c7d482d028ff744254d2cccfce79a1 100644 (file)
@@ -4,13 +4,13 @@ use package core
 
 max_f32 :: #solidify math.max_poly { T = f32 };
 
-compose :: proc (a: $A, f: proc (A) -> $B, g: proc (B) -> $C) -> C do return g(f(a));
+compose :: (a: $A, f: (A) -> $B, g: (B) -> $C) -> C do return g(f(a));
 
 specific_compose_0 :: #solidify compose { B = f32 };
 specific_compose_1 :: #solidify specific_compose_0 { A = f32 };
 specific_compose_2 :: #solidify specific_compose_1 { C = f64 };
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     use package runtime
     println(Runtime);
     println("==================================================");
@@ -22,8 +22,8 @@ main :: proc (args: [] cstr) {
 
     println(specific_compose_2(
         2,
-        proc (a: f32) -> f32 { return ~~(a * 2); },
-        proc (b: f32) -> f64 { return ~~(b + 6); }));
+        (a: f32) -> f32 { return ~~(a * 2); },
+        (b: f32) -> f64 { return ~~(b + 6); }));
 
 
     arr1 := array.make(f32);
@@ -42,7 +42,7 @@ main :: proc (args: [] cstr) {
 
     print_arrays(arr1, arr2);
 
-    print_arrays :: proc (arr1: [..] $T, arr2: [..] $R) {
+    print_arrays :: (arr1: [..] $T, arr2: [..] $R) {
         println("==================================================");
         print_array(arr1);
         print_array(arr2);
@@ -50,7 +50,7 @@ main :: proc (args: [] cstr) {
     }
 }
 
-array_map :: proc (arr: [..] $T, f: proc (T) -> T) {
+array_map :: (arr: [..] $T, f: (T) -> T) {
     foo := #solidify math.max_poly { T = T };
     is := (#type InternalStruct(T)).{ foo = foo(6, 2) };
     printf("%i\n", is.foo);
@@ -60,7 +60,7 @@ array_map :: proc (arr: [..] $T, f: proc (T) -> T) {
     {
         test2();
 
-        test2 :: proc () {
+        test2 :: () {
             test();
 
             is : InternalStruct([] u32);
@@ -68,7 +68,7 @@ array_map :: proc (arr: [..] $T, f: proc (T) -> T) {
             println("WORLD!!!!");
         }
 
-        test  :: proc () {
+        test  :: () {
             println("HELLO!!!");
         }
     }
@@ -78,4 +78,4 @@ array_map :: proc (arr: [..] $T, f: proc (T) -> T) {
     }
 }
 
-double :: proc (v: $V) -> V do return v * 2;
+double :: (v: $V) -> V do return v * 2;
index c3ea8149c56c574d70166487579543fd0196d39c..c0a905148cd3b7d26c084a1878918a1dbc30b034 100644 (file)
@@ -6,7 +6,7 @@ package main
 use package core
 use package core.intrinsics.simd
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     x := f32x4_const(10.0f, 20.0f, 30.0f, 40.0f);
     y := f32x4_splat(100.0f);
 
index 14759e3830edc05cf8c235ad5c158c5aa232c4b7..ada9a3df921358565933da6c111161b81d2c6580 100644 (file)
@@ -4,7 +4,7 @@ package main
 
 use package core;
 
-old_va_test :: proc (fix: Fixes, va: ..i32) {
+old_va_test :: (fix: Fixes, va: ..i32) {
     println(fix.prefix);
     for v: va do println(v);
     println(fix.suffix);
@@ -12,7 +12,7 @@ old_va_test :: proc (fix: Fixes, va: ..i32) {
 
 Fixes :: struct { prefix: str; suffix: str; }
 
-new_va_test :: proc (fix: Fixes, va: ...) {
+new_va_test :: (fix: Fixes, va: ...) {
     println(fix.prefix);
 
     for i: 0 .. va.count {
@@ -24,7 +24,7 @@ new_va_test :: proc (fix: Fixes, va: ...) {
     println(fix.suffix);
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     new_va_test(Fixes.{ "foo", "foozle" }, 1, 2, 3.0f, 5.0f);
     old_va_test(Fixes.{ "bar", "barzle" }, 1);
 
index 40f48b0ff7749208a5e0c585a6f9d3f1ebea8167..64cc6513b2121376496245d214b44b14ffbfa034 100644 (file)
@@ -8,7 +8,7 @@ use package core
 use package core_file
 use package wasi
 
-// print_rights :: proc (rights: Rights) {
+// print_rights :: (rights: Rights) {
 //     print(cast(u32) rights, 2);
 //     print("\n");
 //
@@ -43,7 +43,7 @@ use package wasi
 //     if rights & Rights.SockShutdown != cast(Rights) 0 do print("SockShutdown\n");
 // }
 
-readline :: proc (buf: ^u8, bufsize: u32) -> u32 {
+readline :: (buf: ^u8, bufsize: u32) -> u32 {
     iov := IOVec.{ buf, bufsize };
     nread : Size;
     fd_pread(0, IOVecArray.{ ^iov, 1 }, 0, ^nread);
@@ -51,7 +51,7 @@ readline :: proc (buf: ^u8, bufsize: u32) -> u32 {
     return nread;
 }
 
-readdir :: proc (fd: FileDescriptor) {
+readdir :: (fd: FileDescriptor) {
     buf : [1024] u8;
     bufused : Size;
 
@@ -79,19 +79,19 @@ readdir :: proc (fd: FileDescriptor) {
     }
 }
 
-timer_start :: proc () -> Timestamp {
+timer_start :: () -> Timestamp {
     curr_time: Timestamp;
     clock_time_get(ClockID.Realtime, cast(Timestamp) 1, ^curr_time);
     return curr_time;
 }
 
-timer_end :: proc (start_time: Timestamp) -> Timestamp {
+timer_end :: (start_time: Timestamp) -> Timestamp {
     curr_time: Timestamp;
     clock_time_get(ClockID.Realtime, cast(Timestamp) 1, ^curr_time);
     return (curr_time - start_time) / 1000000;
 }
 
-is_prime :: proc (n := 0) -> bool {
+is_prime :: (n := 0) -> bool {
     sqrt :: cast(i32) (sqrt_f32(cast(f32) n));
     for i: 2 .. sqrt + 1 do if n % i == 0 do return false;
     return true;
@@ -109,7 +109,7 @@ S :: struct {
     pos:  Vec3;
 }
 
-output_s :: proc (sb: ^StringBuilder, s: ^S) -> ^StringBuilder {
+output_s :: (sb: ^StringBuilder, s: ^S) -> ^StringBuilder {
     sb  |> sba("Hello, I'm ")
         |> sba(s.name)
         |> sba(". I am ")
@@ -122,7 +122,7 @@ output_s :: proc (sb: ^StringBuilder, s: ^S) -> ^StringBuilder {
     return sb;
 }
 
-print_arr :: proc (sb: ^StringBuilder, arr: [] $T) {
+print_arr :: (sb: ^StringBuilder, arr: [] $T) {
     sb |> string_builder_clear();
 
     for i: 0 .. arr.count {
@@ -132,12 +132,12 @@ print_arr :: proc (sb: ^StringBuilder, arr: [] $T) {
     sb |> sba("\n") |> string_builder_to_string() |> print();
 }
 
-make_i32_arr :: proc (a := context.allocator, len := 10) -> [] i32 {
+make_i32_arr :: (a := context.allocator, len := 10) -> [] i32 {
     arr := cast(^i32) alloc(a, sizeof i32 * len);
     return arr[0 .. len];
 }
 
-main :: proc (args: []cstring) {
+main :: (args: []cstring) {
     now : Timestamp;
     clock_time_get(ClockID.Realtime, cast(Timestamp) 1, ^now);
 
@@ -297,7 +297,7 @@ main :: proc (args: []cstring) {
     print(dynarr.count, 10);
 }
 
-foobar :: proc (a: i32, b := 1, c: i64 = 5) {
+foobar :: (a: i32, b := 1, c: i64 = 5) {
     print_i64(cast(u64) a);
     print("\n");
     print_i64(cast(u64) b, 16);
@@ -306,7 +306,7 @@ foobar :: proc (a: i32, b := 1, c: i64 = 5) {
     print("\n");
 }
 
-fib :: proc (n: i32) -> i32 {
+fib :: (n: i32) -> i32 {
     switch n {
         case 0 do return 1;
         case 1 do return 1;
@@ -318,16 +318,16 @@ fib :: proc (n: i32) -> i32 {
     return 0;
 }
 
-add :: proc (a: $T, b: T) -> T {
+add :: (a: $T, b: T) -> T {
     return a + b;
 }
 
-multi_poly :: proc (a: $T, b: $R) -> R {
+multi_poly :: (a: $T, b: $R) -> R {
     return cast(R) (a + cast(T) b);
 }
 
-make_slice :: proc (ptr: ^$T, count: u32) -> [] T {
+make_slice :: (ptr: ^$T, count: u32) -> [] T {
     return ptr[4 .. count];
 }
 
-get_slice_length :: proc (s: ^[] $T) -> u32 do return s.count;
+get_slice_length :: (s: ^[] $T) -> u32 do return s.count;
index c0969323bd172ec58fb98a73d92308879111edf1..5030c3f1fdeabadf459ba98c4469274e1fdbe467 100644 (file)
@@ -369,12 +369,50 @@ static void output_dummy_progress_bar() {
     EntityHeap* eh = &context.entities;
     if (bh_arr_length(eh->entities) == 0) return;
 
+    static const char* state_colors[] = {
+        "\e[91m",
+        "\e[93m",
+        "\e[97m",
+        "\e[93m",
+        "\e[94m",
+        "\e[95m",
+        "\e[94m",
+        "\e[95m",
+        "\e[96m",
+        "\e[92m",
+    };
+
     printf("\e[2;1H");
+
     for (i32 i = 0; i < Entity_State_Count - 1; i++) {
-        printf("%25s (%4d) | ", entity_state_strings[i], eh->state_count[i]);
-        
+        if (i % 4 == 0) printf("\n");
+        printf("%s \xe2\x96\x88 %s", state_colors[i], entity_state_strings[i]);
+    }
+
+    printf("\n\n");
+    
+    for (i32 i = 0; i < Entity_Type_Count; i++) {
+        if (eh->type_count[i] == 0) {
+            printf("\e[90m");
+        } else {
+            printf("\e[97m");
+        }
+
+        printf("%25s (%4d) | ", entity_type_strings[i], eh->type_count[i]);
+
         printf("\e[0K");
-        for (i32 c = 0; c < eh->state_count[i] * 50 / bh_arr_length(eh->entities); c++) printf("\xe2\x96\x88");
+        for (i32 j = 0; j < Entity_State_Count; j++) {
+            if (eh->all_count[j][i] == 0) continue;
+
+            printf(state_colors[j]);
+
+            i32 count = (eh->all_count[j][i] >> 5) + 1;
+            for (i32 c = 0; c < count * 2; c++) {
+                printf("\xe2\x96\x88");
+            }
+
+            printf("\e[0m");
+        }
         printf("\n");
     }
 }
index cbb5893d6fcae7585412e920da52b2918e9aecc1..b6015d4181fb1625a2d91ab74002318802618d7e 100644 (file)
@@ -25,7 +25,7 @@ static char* node_to_doc_def(const char* sym, AstNode *node, bh_allocator a) {
 
     switch (node->kind) {
         case Ast_Kind_Function: {
-            strncat(buf, "proc (", 1023);
+            strncat(buf, "(", 1023);
 
             AstFunction *func = (AstFunction *) node;
             bh_arr_each(AstParam, param, func->params) {
index d415b62d10689a62f4ac10784ef30414658c6003..ce4112c0ecef3a92db03ad772a363404009401d6 100644 (file)
@@ -91,8 +91,9 @@ void entity_heap_insert_existing(EntityHeap* entities, Entity* e) {
        eh_shift_up(entities, bh_arr_length(entities->entities) - 1);
     e->entered_in_queue = 1;
 
-       entities->state_count[e->state]++;
+    entities->state_count[e->state]++;
     entities->type_count[e->type]++;
+    entities->all_count[e->state][e->type]++;
 }
 
 // nocheckin
@@ -107,12 +108,14 @@ Entity* entity_heap_top(EntityHeap* entities) {
 }
 
 void entity_heap_change_top(EntityHeap* entities, Entity* new_top) {
-       entities->state_count[entities->entities[0]->state]--;
-       entities->state_count[new_top->state]--;
+    entities->state_count[entities->entities[0]->state]--;
+    entities->state_count[new_top->state]++;
 
-    // CLEANUP: I don't think both of these should be --?
     entities->type_count[entities->entities[0]->type]--;
-    entities->type_count[new_top->type]--;
+    entities->type_count[new_top->type]++;
+
+    entities->all_count[entities->entities[0]->state][entities->entities[0]->type]--;
+    entities->all_count[new_top->state][new_top->type]++;
        
        entities->entities[0] = new_top;
        eh_shift_down(entities, 0);
@@ -121,6 +124,7 @@ void entity_heap_change_top(EntityHeap* entities, Entity* new_top) {
 void entity_heap_remove_top(EntityHeap* entities) {
     entities->state_count[entities->entities[0]->state]--;
     entities->type_count[entities->entities[0]->type]--;
+    entities->all_count[entities->entities[0]->state][entities->entities[0]->type]--;
     entities->entities[0]->entered_in_queue = 0;
 
        entities->entities[0] = entities->entities[bh_arr_length(entities->entities) - 1];
index 42eab6b28229332d04d748de08e68f7802c42bcb..778b38978d10837818693ac787e8a0136761cffc 100644 (file)
@@ -46,9 +46,7 @@ b32 types_are_compatible_(Type* t1, Type* t2, b32 recurse_pointers) {
     switch (t1->kind) {
         case Type_Kind_Basic:
             if (t2->kind == Type_Kind_Basic) {
-                // HACK: Not sure if this is right way to check this?
-                if (t1 == t2) return 1;
-
+                // Signedness of an integer doesn't matter.
                 if ((t1->Basic.flags & Basic_Flag_Integer) && (t2->Basic.flags & Basic_Flag_Integer)) {
                     return t1->Basic.size == t2->Basic.size;
                 }
@@ -660,7 +658,7 @@ const char* type_get_unique_name(Type* type) {
             char buf[512];
             fori (i, 0, 512) buf[i] = 0;
 
-            strncat(buf, "proc (", 511);
+            strncat(buf, "(", 511);
             fori (i, 0, type->Function.param_count) {
                 strncat(buf, type_get_unique_name(type->Function.params[i]), 511);
                 if (i != type->Function.param_count - 1)
@@ -703,7 +701,7 @@ const char* type_get_name(Type* type) {
             char buf[512];
             fori (i, 0, 512) buf[i] = 0;
 
-            strncat(buf, "proc (", 511);
+            strncat(buf, "(", 511);
             fori (i, 0, type->Function.param_count) {
                 strncat(buf, type_get_name(type->Function.params[i]), 511);
                 if (i != type->Function.param_count - 1)
index 84f0709237ab0a76eb6434112a5507514f7aed2b..b7d219fd6a459eb3068402b2530f3b604968e99a 100644 (file)
@@ -1023,7 +1023,7 @@ void report_unable_to_match_overload(AstCall* call) {
         }
     }
 
-    onyx_report_error(call->token->pos, "unable to match overloaded function with provided argument types: (%s)", arg_str);
+    onyx_report_error(call->token->pos, "Unable to match overloaded function with provided argument types: (%s)", arg_str);
 
     bh_free(global_scratch_allocator, arg_str);
 }
index 7dc355de5dbb9fcc2c809eaf89375120ec2bdef8..ac679c83176de9147897fa53d0c057b0f1650bba 100644 (file)
@@ -2165,7 +2165,7 @@ EMIT_FUNC(expression, AstTyped* expr) {
             //
             // I think a more general case of accessing fields on r-values is better. For example,
             //
-            //     returns_foo :: proc () -> Foo { ... }
+            //     returns_foo :: () -> Foo { ... }
             //
             //     value := returns_foo().foo_member;
             //
index 13420ee734fec10f174c8034f00fa2394930c9c4..2eb0cca041d6643f8c6469e82291e5d4f4caf2d8 100644 (file)
@@ -39,7 +39,7 @@ main :: (args: [] cstr) {
     // Slight hack, but having 0 in the array makes both parts easier
     array.push(^nums, 0);
 
-    cmp_asc :: proc (a: $T, b: T) -> i32 do return ~~(a - b);
+    cmp_asc :: (a: $T, b: T) -> i32 do return ~~(a - b);
     array.sort(^nums, cmp_asc);
 
     diffs: [3] u32;
index 5375be4bbb9832c2921da89ffd7e84804911ec83..dccf87653d91d6e5613bb4766ccc42be440ecc53 100644 (file)
@@ -65,7 +65,7 @@ gos_iter :: (use gos: ^GameOfSeats) -> bool {
     return changed;
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     contents := #file_contents "./tests/aoc-2020/input/day11.txt";
 
     file := reader.make(contents);
index 6d8e833a382341b9a8aded53bcf21c7ff17f1e6f..ea22356bd46824722811467e76f4ea103acb7d65 100644 (file)
@@ -36,7 +36,7 @@ get_neighbor_count :: (cubes: ^map.Map(CubePos, CubeState), pos: CubePos) -> u32
     return count;
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     contents := #file_contents "./tests/aoc-2020/input/day17.txt";
 
     file := reader.make(contents);
index 2348531fd92b826d077dfbad276be03600f7c0a5..d1898aa22d67b49c9438dd56ee0888d1d5ba5cdb 100644 (file)
@@ -35,4 +35,4 @@ main :: (args: [] cstr) {
     printf("Your seat: %i\n", missing);
 }
 
-cmp_asc :: proc (a: $T, b: T) -> i32 do return ~~(a - b);
+cmp_asc :: (a: $T, b: T) -> i32 do return ~~(a - b);
index 967dbb335f830f4199f5dbc025de442025e79401..10d5e1daf58af59f1ffc2759e129c6e7f14ed238 100644 (file)
@@ -64,8 +64,8 @@ main :: (args: [] cstr) {
 
     start, end := find_contiguous_subarray_with_sum(nums, invalid);
 
-    max := array.fold_slice(nums.data[start .. end + 1], cast(u64) 0, math.max_poly);
-    min := array.fold_slice(nums.data[start .. end + 1], cast(u64) max, math.min_poly);
+    max := array.fold(nums.data[start .. end + 1], cast(u64) 0, math.max_poly);
+    min := array.fold(nums.data[start .. end + 1], cast(u64) max, math.min_poly);
 
     printf("Extrema sum: %l\n", min + max);
 }
index e001f9d523e515aa75d72fd7fc09bb8b4e8e2021..806b8656f39d410343fdd09d067f02b0f89eff7c 100644 (file)
@@ -14,7 +14,7 @@ EntityStore :: struct {
     velocities : [4] Vec2;
 }
 
-calc_vecs :: proc (n := 0) -> [4] Vec2 {
+calc_vecs :: (n := 0) -> [4] Vec2 {
     vecs : [4] Vec2;
 
     i := n;
@@ -27,7 +27,7 @@ calc_vecs :: proc (n := 0) -> [4] Vec2 {
     return vecs;
 }
 
-main :: proc (args: [] cstr) #export "MAIN" {
+main :: (args: [] cstr) {
     // Array of structs on stack
     {
         println("Array of structs on the stack.");
@@ -95,4 +95,4 @@ main :: proc (args: [] cstr) #export "MAIN" {
 
         println(nums[50]);
     }
-}
\ No newline at end of file
+}
index 01feb48d486c7870a73f63d617197b9019115560..461466a6ec17c4f550cc714a5df6444178bb343a 100644 (file)
@@ -2,19 +2,19 @@
 
 use package core
 
-count_to :: proc ($N: i32) {
+count_to :: ($N: i32) {
     for i: 0 .. N do printf("%i ", i);
     print("\n");
 }
 
-alloc_slice :: proc ($T: type_expr, N: i32) -> [] T {
+alloc_slice :: ($T: type_expr, N: i32) -> [] T {
     data := cast(^T) calloc(sizeof T * N);
     return <[] T>.{ data, N };
 }
 
 count_to_30 :: #solidify count_to { N = #value 30 };
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     count_to(5);
     count_to(10);
     count_to(10);
@@ -38,7 +38,7 @@ main :: proc (args: [] cstr) {
     map.put(^ages, "Jim", 25);
     map.put(^ages, "Pam", 24);
 
-    print_age :: proc (ages: ^map.Map(str, u32), name: str) {
+    print_age :: (ages: ^map.Map(str, u32), name: str) {
         age := map.get(ages, name);
         printf("%s's age is %i.\n", name, age);
     }
index eca8241628fd93ef4c121534f6d15fc946f9ef9f..abc2cdae98fb2b57fb7460245c7eb758b5a1bcbc 100644 (file)
@@ -3,20 +3,20 @@
 use package core
 
 Test_VTable :: struct {
-    first  : proc (i32) -> i32;
-    second : proc (i32) -> i32;
+    first  : (i32) -> i32;
+    second : (i32) -> i32;
 
-    third  : proc (i32, i32) -> i32 = null_proc;
+    third  : (i32, i32) -> i32 = null_proc;
 }
 
 test_vtable1 := Test_VTable.{
-    first  = proc (a: i32) -> i32 { return a * 2; },
-    second = proc (a: i32) -> i32 { return a + 2; },
+    first  = (a: i32) -> i32 { return a * 2; },
+    second = (a: i32) -> i32 { return a + 2; },
 }
 
 test_vtable2 := Test_VTable.{
-    first  = proc (a: i32) -> i32 { return a / 2; },
-    second = proc (a: i32) -> i32 { return a - 2; },
+    first  = (a: i32) -> i32 { return a / 2; },
+    second = (a: i32) -> i32 { return a - 2; },
 }
 
 
@@ -27,10 +27,10 @@ Test_Thing :: struct {
 }
 
 // because of the work i did above, this also works now.
-dummy := proc () { println("hello world!"); }
+dummy := () { println("hello world!"); }
 
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     dummy();
 
     t := Test_Thing.{ ^test_vtable1, 10 };
@@ -45,7 +45,7 @@ main :: proc (args: [] cstr) {
 
     println(t.vt.first == test_vtable1.second);
 
-    do_a_thing :: proc (use t: ^Test_Thing) -> i32 {
+    do_a_thing :: (use t: ^Test_Thing) -> i32 {
         if vt.second == null_proc || vt.first == null_proc do return data;
 
         res := data |> vt.second() |> vt.first();
@@ -53,4 +53,4 @@ main :: proc (args: [] cstr) {
 
         return res;
     }
-}
\ No newline at end of file
+}
index 7e390ce71f3d23f3bd17aff5479fc8cfe6f93bb3..1c076ae77eeba53059c1dde34a9f0957f2f558e0 100644 (file)
@@ -2,7 +2,7 @@
 
 use package core
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     defer println("At the end!");
     i := 0;
     while i < 10 {
index aa793d3b69d6a07cde8416711ffc47b2b29a9e18..88198e4f97c854df908b55b3fd003c5d7348aab8 100644 (file)
@@ -4,6 +4,6 @@ package main
 
 use package core
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     println("Hello, World!");
 }
index c83cb05fe73806acf89534a1cae7bc374c6c1ffd..2a55f7767a661424ce9446d140ee91fd78c58396 100644 (file)
@@ -4,7 +4,7 @@ package main
 
 use package core
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     imap : map.Map(i32, str);
     map.init(^imap, "");
     defer {
index 277908196ed32038810b8e09711963b8de175220..0021d167666511be17b3609447127907592e8700 100644 (file)
@@ -2,16 +2,16 @@
 
 use package core
 
-foo :: proc () -> (i32, i32) {
+foo :: () -> (i32, i32) {
     return 50, 60;
 }
 
-something :: proc (f: proc () -> ($T, T)) -> T {
+something :: (f: () -> ($T, T)) -> T {
     a, b := f();
     return a + b;
 }
 
-get_extrema :: proc (arr: [$N] $T) -> (T, T) {
+get_extrema :: (arr: [$N] $T) -> (T, T) {
     min := arr[0];
     max := arr[0];
 
@@ -23,13 +23,13 @@ get_extrema :: proc (arr: [$N] $T) -> (T, T) {
     return min, max;
 }
 
-return_multiple_arrays :: proc () -> ([3] i32, [3] f32) {
+return_multiple_arrays :: () -> ([3] i32, [3] f32) {
     iarr := i32.[ 0, 1, 2 ];
     farr := f32.[ 3, 4, 5 ];
     return iarr, farr;
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     a, b := foo();
     a, b = b, a;
 
@@ -47,7 +47,7 @@ main :: proc (args: [] cstr) {
     array_print(iarr);
     array_print(farr);
 
-    array_print :: proc (arr: [$N] $T) {
+    array_print :: (arr: [$N] $T) {
         for ^e: arr {
             print(*e);
             print(" ");
index a43ae642a75a326fe86e9240f5b6b4a728ce78ee..d369d294b15aa6efca272d84323cf121f2c68496 100644 (file)
@@ -2,8 +2,8 @@
 
 use package core
 
-main :: proc (args: [] cstr) {
-    foo :: proc (x: i32, y: f32) {
+main :: (args: [] cstr) {
+    foo :: (x: i32, y: f32) {
         printf("x is %i\n", x);
         printf("y is %f\n", y);
     }
@@ -14,7 +14,7 @@ main :: proc (args: [] cstr) {
 
     println("\n\n=========================");
 
-    poly_named :: proc (x: $T, y: [$N] T) {
+    poly_named :: (x: $T, y: [$N] T) {
         println(x);
         print_array(y);
     }
@@ -26,9 +26,9 @@ main :: proc (args: [] cstr) {
     println("\n\n=========================");
 
     poly_overloaded :: proc {
-        proc (y: [$N] $T) { print("MATCHED Y: "); print_array(y); },
-        proc (x: $T)      { print("MATCHED X: "); println(x); },
-        proc (z: $T)      { print("MATCHED Z: "); println(z); },
+        (y: [$N] $T) { print("MATCHED Y: "); print_array(y); },
+        (x: $T)      { print("MATCHED X: "); println(x); },
+        (z: $T)      { print("MATCHED Z: "); println(z); },
     }
 
     poly_overloaded(u32.[ 10, 20 ]);
@@ -38,7 +38,7 @@ main :: proc (args: [] cstr) {
 
     println("\n\n=========================");
 
-    overload_with_varargs :: proc (x: i32, y: i32, z: ..f32) {
+    overload_with_varargs :: (x: i32, y: i32, z: ..f32) {
         println(x);
         println(y);
 
@@ -52,7 +52,7 @@ main :: proc (args: [] cstr) {
 
     println("\n\n=========================");
 
-    lotza_options :: proc (
+    lotza_options :: (
         options_a : bool,
         options_b := false,
         options_c := true,
@@ -74,12 +74,12 @@ main :: proc (args: [] cstr) {
 
     // This currently does not work and would require a lot of rewriting of compiler internals to make work.
     // named_baked_overloaded_parameters :: proc {
-    //     proc ($T: type_expr, x: T)      do { println("MATCHED X"); },
-    //     proc ($T: type_expr, y: [$N] T) do { println("MATCHED X"); },
-    //     proc ($T: type_expr, z: T)      do { println("MATCHED X"); },
+    //     ($T: type_expr, x: T)      do { println("MATCHED X"); },
+    //     ($T: type_expr, y: [$N] T) do { println("MATCHED X"); },
+    //     ($T: type_expr, z: T)      do { println("MATCHED X"); },
     // }
 
     // named_baked_overloaded_parameters(i32, 10);
     // named_baked_overloaded_parameters(i32, u32.[ 10, 20, 30 ]);
     // named_baked_overloaded_parameters(i32, z = u32.[ 10, 20, 30 ]);
-}
\ No newline at end of file
+}
index 41e6b3e4aa876f78e92cac02d4f8938a4016c67a..e5b58f55fd059c0f3c4b01f86f02ed32f65c7140 100644 (file)
@@ -19,7 +19,7 @@ proc (a: Complex, b: Complex) -> Complex #operator* {
     return Complex.{ a.re * b.re - a.im * b.im, a.re * b.im + a.im * b.re };
 }
 
-C :: proc (re: f32, im: f32) -> Complex do return Complex.{ re, im };
+C :: (re: f32, im: f32) -> Complex do return Complex.{ re, im };
 
 
 
@@ -52,18 +52,18 @@ proc (a: Vec($T, $N), b: Vec(T, N)) -> T #operator* {
     return res;
 }
 
-join :: proc (a: Vec($T, $N), b: Vec(T, $M)) -> Vec(T, #value N + M) {
+join :: (a: Vec($T, $N), b: Vec(T, $M)) -> Vec(T, #value N + M) {
     out : Vec(T, #value N + M);
     for i: 0 .. N do out.data[i]     = a.data[i]; 
     for i: 0 .. M do out.data[i + N] = b.data[i]; 
     return out;
 }
 
-make_vec :: proc (data: [$N] $T) -> Vec(T, N) {
+make_vec :: (data: [$N] $T) -> Vec(T, N) {
     return <Vec(T, N)>.{ data };
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     {
         a := C(2, 3);
         b := C(0, 1);
@@ -101,6 +101,6 @@ main :: proc (args: [] cstr) {
 }
 
 test_overload :: proc {
-    proc (x: $T, y: T)  -> T { return x; },
-    proc (x: $T, y: $R) -> R { return y; },
+    (x: $T, y: T)  -> T { return x; },
+    (x: $T, y: $R) -> R { return y; },
 }
index e790ac62a70d820dfa2172a4f09ee114df5bd62d..1dcef3d3b5c213bce427b1f0eb0e4279d9df3734 100644 (file)
@@ -3,12 +3,12 @@
 use package core
 
 overloaded :: proc {
-    proc (x: str, y: i32) do println("Called str, i32"); ,
-    proc (x: f32, y: str) do println("Called f32, str"); ,
-    proc (x: i32, y: i32) do println("Called i32, i32"); ,
+    (x: str, y: i32) do println("Called str, i32"); ,
+    (x: f32, y: str) do println("Called f32, str"); ,
+    (x: i32, y: i32) do println("Called i32, i32"); ,
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     x: i32 = 1234;
     overloaded(~~x, 4);
 
index d49957f9410b0ed73c878018da5128f11d3e21c4..3fd0053488545913ea8374504b2ace0cd308415d 100644 (file)
@@ -2,7 +2,7 @@
 
 use package core
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     NewPolyStruct :: struct (T: type_expr, N: i32) {
         x : [N] T; 
         y : [N] f32;
@@ -29,5 +29,5 @@ main :: proc (args: [] cstr) {
     println(swd.str_member);
     poly_match(swd);
 
-    poly_match :: proc (swd: SimpleWithDefault($T, $D)) do println(D);
-}
\ No newline at end of file
+    poly_match :: (swd: SimpleWithDefault($T, $D)) do println(D);
+}
index 822b2faf919c2c880ef03d56262287781ed85ef7..7f88e2b306a7d6eb49be511689a947da910cf5ad 100644 (file)
@@ -2,7 +2,7 @@
 
 use package core
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     arr := u32.[ 1, 2, 3, 4, 5 ];
     for elem: array_to_slice(arr) do printf("%i ", elem);
 
@@ -11,13 +11,13 @@ main :: proc (args: [] cstr) {
 
     for root: roots do println(root);
 
-    array_to_slice :: proc (arr: [$N] $T) -> [] T {
+    array_to_slice :: (arr: [$N] $T) -> [] T {
         return (#type [] T).{ ~~arr, N };
     }
 
-    compute_roots :: proc (arr: [$N] f32) {
+    compute_roots :: (arr: [$N] f32) {
         for i: 0 .. N {
             arr[i] = math.sqrt(cast(f32) i);
         }
     }
-}
\ No newline at end of file
+}
index b18e0d3574552048cd27ef88e6afa685218d9344..b3eb204aaa1afd33be817e8f9ef54eb2fd342586 100644 (file)
@@ -2,7 +2,7 @@
 
 use package core
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     some_string := "This is a test string that can be read.\n\n\n\n\n\n1234 4567";
 
     sstream := io.string_stream_make(some_string);
index 896d038cb190c2f01f28099abf59272e964a317d..f84f7c8871f574a18d6b6b9a8abb01f71bf6fee6 100644 (file)
@@ -2,7 +2,7 @@
 
 use package core
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
 
     test_simple_struct();
     test_simple_union();
@@ -14,7 +14,7 @@ main :: proc (args: [] cstr) {
     test_polymorphic_union();
     test_polymorphic_union_with_use();
 
-    test_simple_struct :: proc () {
+    test_simple_struct :: () {
         println("Testing a simple structure.");
         
         SimpleStruct :: struct {
@@ -33,7 +33,7 @@ main :: proc (args: [] cstr) {
             cast(u32) age, height, name);
     }
 
-    test_simple_union :: proc () {
+    test_simple_union :: () {
         println("\n\nTesting a simple union.");
 
         SimpleUnion :: struct #union {
@@ -47,7 +47,7 @@ main :: proc (args: [] cstr) {
         printf("%p == 0x3F000000\n", u.int_val);
     }
 
-    test_default_values :: proc () {
+    test_default_values :: () {
         println("\n\nTesting a struct with default values.");
 
         DefaultedStruct :: struct {
@@ -63,12 +63,12 @@ main :: proc (args: [] cstr) {
         ds2 := DefaultedStruct.{ i = 3, d = 0 };
         print_defaulted(ds2);
 
-        print_defaulted :: proc (use ds: DefaultedStruct) {
+        print_defaulted :: (use ds: DefaultedStruct) {
             printf("DefaultedStruct(%i, %f, %l, %d)\n", i, f, l, d);
         }
     }
 
-    test_simple_use :: proc () {
+    test_simple_use :: () {
         println("\n\nTesting a struct with `use`.");
 
         StructWithUse :: struct {
@@ -95,7 +95,7 @@ main :: proc (args: [] cstr) {
         // This will not work. `use`d members cannot be set directly.
         // swu3 := StructWithUse.{ 1234, 1, 2, 5678 };
 
-        print_swu :: proc (use swu: StructWithUse) {
+        print_swu :: (use swu: StructWithUse) {
             printf("StructWithUse(%i, (%f, %f), %i)\n",
                 first_member, x, y, last_member);
         }
@@ -104,7 +104,7 @@ main :: proc (args: [] cstr) {
         print_swu(swu2);
     }
 
-    test_polymorphic :: proc () {
+    test_polymorphic :: () {
         println("\n\nTesting a polymorphic struct.");
 
         PolyStruct :: struct (T: type_expr, R: type_expr) {
@@ -123,7 +123,7 @@ main :: proc (args: [] cstr) {
         printf("PolyStruct<f32, i32>(%f, %i)\n", ps2.t_data, ps2.r_data);
     }
 
-    test_polymorphic_with_defaults :: proc () {
+    test_polymorphic_with_defaults :: () {
         println("\n\nTesting a polymorphic struct with default values.");
 
         PolyStruct :: struct (T: type_expr, R: type_expr) {
@@ -137,7 +137,7 @@ main :: proc (args: [] cstr) {
         printf("PolyStruct<i32, f32>(%i, %f)\n", ps.t_data, ps.r_data);
     }
 
-    test_polymorphic_union_with_use :: proc () {
+    test_polymorphic_union_with_use :: () {
         println("\n\nTesting a polymorphic union with use.");
 
         PolyStruct :: struct (T: type_expr, R: type_expr) {
@@ -155,7 +155,7 @@ main :: proc (args: [] cstr) {
         printf("%i, %d\n", ps.t_data, ps.r_data);
     }
 
-    test_union_with_use :: proc () {
+    test_union_with_use :: () {
         println("\n\nTesting a union with use.");
 
         Vec2 :: struct {
@@ -177,7 +177,7 @@ main :: proc (args: [] cstr) {
         printf("Union(%s)\n", u.name);
     }
 
-    test_polymorphic_union :: proc () {
+    test_polymorphic_union :: () {
         println("\n\nTesting a polymorphic union.");
 
         PolyUnion :: struct (T: type_expr, R: type_expr) #union {
index 9bc287e86145c7e4528eedc27e5fdbdea9cb87ce..7751a254eca874384eb22e8c646c8485a94c1f67 100644 (file)
@@ -4,12 +4,12 @@ package main
 
 use package core;
 
-old_va_test :: proc (prefix: str, va: ..i32) {
+old_va_test :: (prefix: str, va: ..i32) {
     println(prefix);
     for v: va do println(v);
 }
 
-new_va_test :: proc (prefix: str, va: ...) {
+new_va_test :: (prefix: str, va: ...) {
     println(prefix);
 
     for i: 0 .. va.count {
@@ -19,7 +19,7 @@ new_va_test :: proc (prefix: str, va: ...) {
     }
 }
 
-main :: proc (args: [] cstr) {
+main :: (args: [] cstr) {
     new_va_test("foo", 1, 2, 3.0f, 5.0f);
     old_va_test("bar", 1);