The structure of commutative automorphic loops