Data-reduction pipeline for CASA