The photochemistry of carbon-rich circumstellar shells