X-ray diffraction of modulated structures