Initial implementation of struct-type contract generation.

Can you move this to a file that is named in such a way that we can put other contracts that we need to implement in it. @ianj needed something similar for hash tables.