gen_c: use a similar to plonka.py structure

Also re-use transforms definitions.