update for haxe3, everything but rewriting the switches for the new pattern matching so this needs -D no-pattern-matching.

...nd function as-is due to switch and pattern match changes.