fmt.printf - Go style due to runtime type safety

This commit is contained in:
Ginger Bill
2017-01-08 01:10:55 +00:00
parent d9ce0b9da0
commit 659e5359b2
3 changed files with 791 additions and 435 deletions

View File

@@ -1,7 +1,21 @@
#import "fmt.odin";
main :: proc() {
x := "-stats";
y := "-begin";
fmt.println(x == y);
fmt.printf("%f", 123);
}
/*
Standard Library Development:
* Formatted printf
* The Variable
* math
- Trig
- Random
- atoi
* Memory allocation
* File IO
* Timing
- Regular and OS
*/

View File

@@ -299,7 +299,7 @@ __string_ge :: proc(a, b: string) -> bool #inline { return __string_cmp(a, b) >=
__assert :: proc(file: string, line, column: int, msg: string) #inline {
fmt.fprintf(os.stderr, "%(%:%) Runtime assertion: %\n",
fmt.fprintf(os.stderr, "%s(%d:%d) Runtime assertion: %s\n",
file, line, column, msg);
__debug_trap();
}
@@ -308,7 +308,7 @@ __bounds_check_error :: proc(file: string, line, column: int, index, count: int)
if 0 <= index && index < count {
return;
}
fmt.fprintf(os.stderr, "%(%:%) Index % is out of bounds range 0..<%\n",
fmt.fprintf(os.stderr, "%s(%d:%d) Index %d is out of bounds range 0..<%d\n",
file, line, column, index, count);
__debug_trap();
}
@@ -317,7 +317,7 @@ __slice_expr_error :: proc(file: string, line, column: int, low, high: int) {
if 0 <= low && low <= high {
return;
}
fmt.fprintf(os.stderr, "%(%:%) Invalid slice indices: [%:%]\n",
fmt.fprintf(os.stderr, "%s(%d:%d) Invalid slice indices: [%d:%d]\n",
file, line, column, low, high);
__debug_trap();
}
@@ -325,7 +325,7 @@ __substring_expr_error :: proc(file: string, line, column: int, low, high: int)
if 0 <= low && low <= high {
return;
}
fmt.fprintf(os.stderr, "%(%:%) Invalid substring indices: [%:%]\n",
fmt.fprintf(os.stderr, "%s(%d:%d) Invalid substring indices: [%d:%d]\n",
file, line, column, low, high);
__debug_trap();
}

File diff suppressed because it is too large Load Diff