Implement another pseudo operating system (scheduler) using goto and C macro definitions, this is not a real embedded operating system, it is a pseudo operating system, or a scheduler for MCU, it costs a few ram and rom, but can do a lot works for you and save your time and easy your software.
Compared to the previous implementation, In this implement, switch case can be used in source.