Adaptive ultrashort pulse compression and shaping