Renamed C files to C++ in preparation for destaticification.

No actual functionality changes should have been made. However, it has been a long time since C++ was really forward-compatible from C, so there was a bunch of syntax and type stuff that needed changing.
Made `middle` structure use virtual functions. Have not yet touched the output, or rest of the statics yet.