General dimensional reduction of ten-dimensional supergravity and superstring