add a function to get the basetypes of a datatype

This is needed for the implementation of type_resize as well as for the
"emulation" of MPI_Type_get_contents.