Mechanisms and origin of continuum and line emission from carbon plasmas produced by ultrashort laser pulses