mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 03:40:08 +00:00
Remove need for type keyword
This commit is contained in:
+6
-6
@@ -109,7 +109,7 @@ type_info_base :: proc(info: ^Type_Info) -> ^Type_Info {
|
||||
return nil;
|
||||
}
|
||||
base := info;
|
||||
match type i in base {
|
||||
match i in base {
|
||||
case Type_Info.Named:
|
||||
base = i.base;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ type_info_base_without_enum :: proc(info: ^Type_Info) -> ^Type_Info {
|
||||
return nil;
|
||||
}
|
||||
base := info;
|
||||
match type i in base {
|
||||
match i in base {
|
||||
case Type_Info.Named:
|
||||
base = i.base;
|
||||
case Type_Info.Enum:
|
||||
@@ -152,9 +152,9 @@ Allocator_Mode :: enum u8 {
|
||||
FREE_ALL,
|
||||
RESIZE,
|
||||
}
|
||||
Allocator_Proc :: type proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, flags: u64) -> rawptr;
|
||||
Allocator_Proc :: #type proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, flags: u64) -> rawptr;
|
||||
Allocator :: struct #ordered {
|
||||
procedure: Allocator_Proc,
|
||||
data: rawptr,
|
||||
@@ -657,7 +657,7 @@ __dynamic_map_erase :: proc(using h: __Map_Header, fr: __Map_Find_Result) {
|
||||
|
||||
__print_ti_ptr :: proc(ti: ^Type_Info) {
|
||||
fmt.println(ti);
|
||||
match type e in ti {
|
||||
match e in ti {
|
||||
case Type_Info.Enum:
|
||||
fmt.println(e.names);
|
||||
}
|
||||
|
||||
+8
-8
@@ -107,7 +107,7 @@ buffer_write_type :: proc(buf: ^Buffer, ti: ^Type_Info) {
|
||||
}
|
||||
|
||||
using Type_Info;
|
||||
match type info in ti {
|
||||
match info in ti {
|
||||
case Named:
|
||||
buffer_write_string(buf, info.name);
|
||||
case Integer:
|
||||
@@ -355,7 +355,7 @@ int_from_arg :: proc(args: []any, arg_index: int) -> (int, int, bool) {
|
||||
if arg_index < args.count {
|
||||
arg := args[arg_index];
|
||||
arg.type_info = type_info_base(arg.type_info);
|
||||
match type i in arg {
|
||||
match i in arg {
|
||||
case int: num = i;
|
||||
case i8: num = cast(int)i;
|
||||
case i16: num = cast(int)i;
|
||||
@@ -645,7 +645,7 @@ fmt_enum :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
}
|
||||
|
||||
using Type_Info;
|
||||
match type e in v.type_info {
|
||||
match e in v.type_info {
|
||||
default:
|
||||
fmt_bad_verb(fi, verb);
|
||||
return;
|
||||
@@ -658,7 +658,7 @@ fmt_enum :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
f: f64;
|
||||
ok := false;
|
||||
a := any{type_info_base(e.base), v.data};
|
||||
match type v in a {
|
||||
match v in a {
|
||||
case i8: i = cast(i64)v;
|
||||
case i16: i = cast(i64)v;
|
||||
case i32: i = cast(i64)v;
|
||||
@@ -709,9 +709,9 @@ fmt_value :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
}
|
||||
|
||||
using Type_Info;
|
||||
match type info in v.type_info {
|
||||
match info in v.type_info {
|
||||
case Named:
|
||||
match type b in info.base {
|
||||
match b in info.base {
|
||||
case Struct:
|
||||
if verb != 'v' {
|
||||
fmt_bad_verb(fi, verb);
|
||||
@@ -882,7 +882,7 @@ fmt_arg :: proc(fi: ^Fmt_Info, arg: any, verb: rune) {
|
||||
|
||||
if verb == 'T' {
|
||||
ti := arg.type_info;
|
||||
match type a in arg {
|
||||
match a in arg {
|
||||
case ^Type_Info: ti = a;
|
||||
}
|
||||
buffer_write_type(fi.buf, ti);
|
||||
@@ -892,7 +892,7 @@ fmt_arg :: proc(fi: ^Fmt_Info, arg: any, verb: rune) {
|
||||
|
||||
base_arg := arg;
|
||||
base_arg.type_info = type_info_base(base_arg.type_info);
|
||||
match type a in base_arg {
|
||||
match a in base_arg {
|
||||
case bool: fmt_bool(fi, a, verb);
|
||||
case f32: fmt_float(fi, cast(f64)a, 32, verb);
|
||||
case f64: fmt_float(fi, a, 64, verb);
|
||||
|
||||
+2
-2
@@ -217,7 +217,7 @@ align_of_type_info :: proc(type_info: ^Type_Info) -> int {
|
||||
WORD_SIZE :: size_of(int);
|
||||
MAX_ALIGN :: size_of([vector 64]f64); // TODO(bill): Should these constants be builtin constants?
|
||||
using Type_Info;
|
||||
match type info in type_info {
|
||||
match info in type_info {
|
||||
case Named:
|
||||
return align_of_type_info(info.base);
|
||||
case Integer:
|
||||
@@ -270,7 +270,7 @@ align_formula :: proc(size, align: int) -> int {
|
||||
size_of_type_info :: proc(type_info: ^Type_Info) -> int {
|
||||
WORD_SIZE :: size_of(int);
|
||||
using Type_Info;
|
||||
match type info in type_info {
|
||||
match info in type_info {
|
||||
case Named:
|
||||
return size_of_type_info(info.base);
|
||||
case Integer:
|
||||
|
||||
@@ -20,7 +20,7 @@ LPARAM :: int;
|
||||
LRESULT :: int;
|
||||
ATOM :: i16;
|
||||
BOOL :: i32;
|
||||
WNDPROC :: type proc(HWND, u32, WPARAM, LPARAM) -> LRESULT #cc_c;
|
||||
WNDPROC :: #type proc(HWND, u32, WPARAM, LPARAM) -> LRESULT #cc_c;
|
||||
|
||||
|
||||
INVALID_HANDLE_VALUE :: cast(HANDLE)(~cast(int)0);
|
||||
@@ -359,8 +359,8 @@ PFD_DOUBLEBUFFER_DONTCARE :: 0x40000000;
|
||||
PFD_STEREO_DONTCARE :: 0x80000000;
|
||||
|
||||
HGLRC :: HANDLE;
|
||||
PROC :: type proc() #cc_c;
|
||||
wglCreateContextAttribsARBType :: type proc(hdc: HDC, hshareContext: rawptr, attribList: ^i32) -> HGLRC;
|
||||
PROC :: #type proc() #cc_c;
|
||||
wglCreateContextAttribsARBType :: #type proc(hdc: HDC, hshareContext: rawptr, attribList: ^i32) -> HGLRC;
|
||||
|
||||
|
||||
PIXELFORMATDESCRIPTOR :: struct #ordered {
|
||||
|
||||
+17
-17
@@ -11,7 +11,7 @@ is_signed :: proc(info: ^Type_Info) -> bool {
|
||||
is_integer :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Integer: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -19,7 +19,7 @@ is_integer :: proc(info: ^Type_Info) -> bool {
|
||||
is_float :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Float: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -27,7 +27,7 @@ is_float :: proc(info: ^Type_Info) -> bool {
|
||||
is_any :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Any: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -35,7 +35,7 @@ is_any :: proc(info: ^Type_Info) -> bool {
|
||||
is_string :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.String: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -43,7 +43,7 @@ is_string :: proc(info: ^Type_Info) -> bool {
|
||||
is_boolean :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Boolean: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -51,7 +51,7 @@ is_boolean :: proc(info: ^Type_Info) -> bool {
|
||||
is_pointer :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Pointer: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -59,7 +59,7 @@ is_pointer :: proc(info: ^Type_Info) -> bool {
|
||||
is_procedure :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Procedure: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -67,7 +67,7 @@ is_procedure :: proc(info: ^Type_Info) -> bool {
|
||||
is_array :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Array: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -75,7 +75,7 @@ is_array :: proc(info: ^Type_Info) -> bool {
|
||||
is_dynamic_array :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Dynamic_Array: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -83,7 +83,7 @@ is_dynamic_array :: proc(info: ^Type_Info) -> bool {
|
||||
is_dynamic_map :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Map: return i.count == 0;
|
||||
}
|
||||
return false;
|
||||
@@ -91,7 +91,7 @@ is_dynamic_map :: proc(info: ^Type_Info) -> bool {
|
||||
is_slice :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Slice: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -99,7 +99,7 @@ is_slice :: proc(info: ^Type_Info) -> bool {
|
||||
is_vector :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Vector: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -107,7 +107,7 @@ is_vector :: proc(info: ^Type_Info) -> bool {
|
||||
is_tuple :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Tuple: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -115,7 +115,7 @@ is_tuple :: proc(info: ^Type_Info) -> bool {
|
||||
is_struct :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Struct: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -123,7 +123,7 @@ is_struct :: proc(info: ^Type_Info) -> bool {
|
||||
is_union :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Union: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -131,7 +131,7 @@ is_union :: proc(info: ^Type_Info) -> bool {
|
||||
is_raw_union :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Raw_Union: return true;
|
||||
}
|
||||
return false;
|
||||
@@ -139,7 +139,7 @@ is_raw_union :: proc(info: ^Type_Info) -> bool {
|
||||
is_enum :: proc(info: ^Type_Info) -> bool {
|
||||
if info == nil { return false; }
|
||||
|
||||
match type i in type_info_base(info) {
|
||||
match i in type_info_base(info) {
|
||||
case Type_Info.Enum: return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user