Support cffi-0.6

Due to the enum format change from str to int in cffi-0.6, strings can't be passed as enum arguments.
This changes the constant generator to generate int constants and uses them everywhere instead of strings.