Encapsulated the constraint translator into a struct.

This will help refactor the cstx module.
Use dry run to calculate the size of the constraint code.
Fixed some code consistency issues in cstx module.