The way that do things is to generate separate GCode file for each operation.
The machine that I'm sunning at the moment is a Chinese one with a pendant controller (Ti DSP inside) which is dumb enough, i.e. not interpreting all G codes well (broke some drills during G8x canned cycles) and at the moment I'm designing a BOB to dump the existing controller and to connect it to 'puter and drive it with Mach3.