aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorZachary Pierson <zacpiersonhehe@gmail.com>2017-02-10 23:41:23 -0600
committerZachary Pierson <zacpiersonhehe@gmail.com>2017-02-10 23:41:23 -0600
commitcad46ae51c8d3baed5a6c6d64a6e5d57fbe2a397 (patch)
treee931af6c1536ab8913d8168e7ee109a64dc7c981 /code
parent3424b2badd347b76ced3f4107d98a12bb50ae49b (diff)
parent73d6a55f5c96459d30eca5747d1458bcf6e9fec4 (diff)
Merge https://github.com/gingerBill/Odin
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin77
-rw-r--r--code/http_test.odin2
2 files changed, 39 insertions, 40 deletions
diff --git a/code/demo.odin b/code/demo.odin
index bc193ef1f..2577f8d3c 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -11,16 +11,27 @@
main :: proc() {
{
+ Fruit :: enum {
+ APPLE,
+ BANANA,
+ COCONUT,
+ }
+
+ fmt.println(Fruit.names);
+ }
+
+when false {
+ {
m: map[f32]int;
- reserve(^m, 16);
+ reserve(m, 16);
defer free(m);
m[1.0] = 1278;
m[2.0] = 7643;
m[3.0] = 564;
- c := m[3.0];
_, ok := m[3.0];
- // assert(ok && c == 564);
+ c := m[3.0];
+ assert(ok && c == 564);
fmt.print("map[");
i := 0;
@@ -28,7 +39,7 @@ main :: proc() {
if i > 0 {
fmt.print(", ");
}
- fmt.printf("%f=%v", key, val);
+ fmt.printf("%v=%v", key, val);
i += 1;
}
fmt.println("]");
@@ -48,48 +59,36 @@ main :: proc() {
fmt.println(m);
}
-
-
- // fm: map[128, int]f32;
-
-/*
{
- sig: u32;
- x := __cpuid(0, ^sig);
- fmt.println(sig, x);
- }
-
-
-
- i: int;
-
- fmt.println("Hellope!");
+ fmt.println("Hellope!");
- x: [dynamic]f64;
- defer free(x);
- append(^x, 2_000_000.500_000, 3, 5, 7);
+ x: [dynamic]f64;
+ reserve(x, 16);
+ defer free(x);
+ append(x, 2_000_000.500_000, 3, 5, 7);
- for p, i in x {
- if i > 0 { fmt.print(", "); }
- fmt.print(p);
- }
- fmt.println();
+ for p, i in x {
+ if i > 0 { fmt.print(", "); }
+ fmt.print(p);
+ }
+ fmt.println();
- {
- Vec3 :: [vector 3]f32;
+ {
+ Vec3 :: [vector 3]f32;
- x := Vec3{1, 2, 3};
- y := Vec3{4, 5, 6};
- fmt.println(x < y);
- fmt.println(x + y);
- fmt.println(x - y);
- fmt.println(x * y);
- fmt.println(x / y);
+ x := Vec3{1, 2, 3};
+ y := Vec3{4, 5, 6};
+ fmt.println(x < y);
+ fmt.println(x + y);
+ fmt.println(x - y);
+ fmt.println(x * y);
+ fmt.println(x / y);
- for i in x {
- fmt.println(i);
+ for i in x {
+ fmt.println(i);
+ }
}
}
-*/
+}
}
diff --git a/code/http_test.odin b/code/http_test.odin
index e6c5f1173..ca76e1c55 100644
--- a/code/http_test.odin
+++ b/code/http_test.odin
@@ -3,7 +3,7 @@
#foreign_system_library ws2 "Ws2_32.lib" when ODIN_OS == "windows";
-SOCKET :: type uint;
+SOCKET :: #type uint;
INVALID_SOCKET :: ~(cast(SOCKET)0);
AF :: enum i32 {