Spatial instabilities, all-optical limiting, and thresholding in nonlinear distributed-feedback devices.