casereader: Factor buffering shim out into separate source file.
This moves the "shim" code out of casereader.c into a separate
casereader-shim.[ch] in preparation for using it from procedure.c.
This commit also adds an optimization: if the shim reads all of the
subreader, then it closes the subreader immediately, instead of waiting
for the shim itself to be destroyed. This can allow resources to be freed
earlier.
This commit also adds a new function casereader_shim_slurp(). This
function will be used for the first time in the following commit.