Fixes to delay() and add_gate_pulses().
Some unit tests for Compiler components

Mostly testing things in PatternUtils.
Only need one instance of preprocess_APS between the APS1 and APS2 code.

Also include a few fixes for non-waveform entries. Will need to merge
this with recent changes to the same function on the develop branch.