diff options
Diffstat (limited to 'code')
| -rw-r--r-- | code/demo.odin | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/code/demo.odin b/code/demo.odin index 1fe4c564d..285abe14d 100644 --- a/code/demo.odin +++ b/code/demo.odin @@ -1,21 +1,31 @@ #import "fmt.odin"; main :: proc() { - fmt.printf("%f", 123); -} - -/* -Standard Library Development: -* Formatted printf -* The Variable -* math - - Trig - - Random - - atoi -* Memory allocation -* File IO -* Timing - - Regular and OS + using Type_Info; + is_type_integer :: proc(info: ^Type_Info) -> bool { + if info == nil { + return false; + } + match type i : type_info_base(info) { + case Integer: + return true; + } + return false; + } -*/ + ti := type_info_base(type_info(Allocator_Mode)); + match type e : ti { + case Enum: + is_int := is_type_integer(e.base); + for i : 0..<e.names.count { + name := e.names[i]; + value := e.values[i]; + if is_int { + fmt.printf("%s - %d\n", name, value.i); + } else { + fmt.printf("%s - %f\n", name, value.f); + } + } + } +} |