The thermochemistry of carbon: valence states, heats of sublimation and energies of linkage