Files
Odin/code/demo.odin
T
Ginger Bill ff473e8342 "Old style" enums
name and value information
`count`, `min_value`, `max_value` constants
2017-01-08 20:24:12 +00:00

32 lines
574 B
Odin

#import "fmt.odin";
main :: proc() {
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);
}
}
}
}