Allow specifying XS input and output code in typemaps.
Small refactroing of typemap creation.