Skip to content

Commit

Permalink
v0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
gingerBill committed Mar 27, 2017
1 parent 188b290 commit a75ccb6
Show file tree
Hide file tree
Showing 10 changed files with 338 additions and 199 deletions.
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set exe_name=odin.exe

:: Debug = 0, Release = 1
set release_mode=0
set release_mode=1
set compiler_flags= -nologo -Oi -TC -fp:fast -fp:except- -Gm- -MP -FC -GS- -EHsc- -GR-

if %release_mode% EQU 0 ( rem Debug
Expand Down
21 changes: 17 additions & 4 deletions code/demo.odin
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#import "fmt.odin";
#import "atomic.odin";
#import "hash.odin";
#import "math.odin";
#import "mem.odin";
#import "opengl.odin";
#import "os.odin";
#import "strconv.odin";
#import "sync.odin";
#import win32 "sys/windows.odin";

#import "fmt.odin";
#import "os.odin";
#import "math.odin";


main :: proc() {
when true {
/*
Added:
* Unexported entities and fields using an underscore prefix
Expand Down Expand Up @@ -59,13 +62,19 @@ main :: proc() {
{
#label thing
for i in 0..10 {
for j := i+1; j < 10; j++ {
for j in i+1..10 {
if j == 2 {
fmt.println(i, j);
continue thing;
}
if j == 3 {
break thing;
}
}
}

// Works with, `for`, `for in`, `match`, `match in`
// NOTE(bill): This solves most of the problems I need `goto` for
}

{
Expand All @@ -76,10 +85,13 @@ main :: proc() {
fmt.println("It's a number");
}


x: any = 123;
#label foo
match i in x {
case int, f32:
fmt.println("It's an int or f32");
break foo;
}
}

Expand Down Expand Up @@ -304,4 +316,5 @@ main :: proc() {
frog, _ = union_cast(Frog)entity; // ignore error and force cast
}
}
}

12 changes: 3 additions & 9 deletions core/fmt.odin
Original file line number Diff line number Diff line change
Expand Up @@ -946,11 +946,9 @@ bprintf :: proc(b: ^[]byte, fmt: string, args: ..any) -> int {
// Process a "verb"
i++;


#label prefix_loop
for ; i < end; i++ {
skip_loop := false;
c := fmt[i];
match c {
match fmt[i] {
case '+':
fi.plus = true;
case '-':
Expand All @@ -963,11 +961,7 @@ bprintf :: proc(b: ^[]byte, fmt: string, args: ..any) -> int {
case '0':
fi.zero = !fi.minus;
default:
skip_loop = true;
}

if skip_loop {
break;
break prefix_loop;
}
}

Expand Down
4 changes: 4 additions & 0 deletions core/math.odin
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ cos :: proc(x: f64) -> f64 #foreign __llvm_core "llvm.cos.f64";
tan :: proc(x: f32) -> f32 #inline { return sin(x)/cos(x); }
tan :: proc(x: f64) -> f64 #inline { return sin(x)/cos(x); }

pow :: proc(x, power: f32) -> f32 #foreign __llvm_core "llvm.pow.f32";
pow :: proc(x, power: f64) -> f64 #foreign __llvm_core "llvm.pow.f64";


lerp :: proc(a, b, t: f32) -> f32 { return a*(1-t) + b*t; }
lerp :: proc(a, b, t: f64) -> f64 { return a*(1-t) + b*t; }

Expand Down
Loading

0 comments on commit a75ccb6

Please sign in to comment.