"Old style" enums

name and value information
`count`, `min_value`, `max_value` constants
This commit is contained in:
Ginger Bill
2017-01-08 20:24:12 +00:00
parent 659e5359b2
commit ff473e8342
9 changed files with 350 additions and 135 deletions

View File

@@ -1,21 +1,31 @@
#import "fmt.odin";
main :: proc() {
fmt.printf("%f", 123);
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);
}
}
}
}
/*
Standard Library Development:
* Formatted printf
* The Variable
* math
- Trig
- Random
- atoi
* Memory allocation
* File IO
* Timing
- Regular and OS
*/