diff options
Diffstat (limited to 'unused.jai')
| -rw-r--r-- | unused.jai | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -1,4 +1,32 @@ +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- // + + +Step_Iterator :: struct { + min: int; + max: int; + step: int; +} + +step_iterator :: (min: int, max: int, step: int) -> Step_Iterator { + return .{ min, max, step }; +} +for_expansion :: (iterator: Step_Iterator, body: Code, flags: For_Flags) #expand { + iteration_count: int; + for <=cast(bool)(flags & .REVERSE) i: iterator.min..iterator.max { + iteration_count += 1; + if iteration_count % iterator.step == 0 continue; + + `it := i; + `it_index := void; + + #insert body; + } +} + +for step_iterator(0, 10, 2) { + log("%", it); +} // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- // |
