mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-16 10:52:22 -07:00
ff473e8342
name and value information `count`, `min_value`, `max_value` constants
32 lines
574 B
Odin
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);
|
|
}
|
|
}
|
|
}
|
|
}
|