First writeup of the proposed new IO subsystem architecture.

Operations for specific IO types (file, socket, pipe, etc) are broken into separate vtables for easy non-switch dispatch. Buffering will be encapsulated as a separate structure and will take function pointers to the relevant vtable routines for data pass-through. We are going to decrease the number of PARROT_EXPORT routines from this subsystem and make a cleaner API.
Fix a few details. Buffer will keep track of encoding. This is (probably) where we will enforce standard encodings on throughput. Move the io_vtable declaration to include/parrot/io.h, so multiple subsystems (notably PMCs can be aware of it). src/io/core.c will be repurposed for utility functions. The io_vtables array will be dynamic so we can add more on the fly.
Add in at least two isomorphic buffer structures which we can use for regular in-memory buffering or mmap-based buffering.
Remove buffer parameters from the io_vtable routines. Buffering will be handled transparently, and the buffer will call the vtables (not the other way around). Implement a rough draft of some of the new buffering routines. These prototypes use a circular buffer algorithm instead of a memcpy-based floating queue.
Remove some old cruft which isn't worth saving in buffer.c. The rest of the stuff is kept mostly for reference, and will be up-converted
Move API functions out of core.c into api.c where they belong. If the function is public and IO-general-purpose, it belongs in api.c
Rename a few files. Add a new file for the StringHandle vtables. Start tweaking some stuff
Start implementing per-type vtables. Add two new files, one for pipes and one for user-defined types. Start cannibalizing existing IO api routines to fill in the vtables.
Complete a first pass through src/io/api.c. Convert most functions to use the new architecture. Move some functions and some bare logic to other files where they belong. Leave several TODO notes with C++ // comments so they will be caught by codetest long before we try to merge anything
Rename io-related routines in src/platform/X/io.c to Parrot_io_internal_. Implement most of the FileHandle vtable. Severa other fixes, cleanups, additions and removals. Flitting around like a mosquito.
Change the buffering logic to use a more linear approach instead of a circular buffer. The added code complexity wasn't worth it. Several cleanups to the buffering code and elsewhere.
Sketch out how we're going to initialize the IO vtables, and how we are going to store them in the interp.
Start refactoring readline logic. Sketch out the new algorithm, which is going to be more neatly broken down into encapsulation-preserving subroutines. Add a routine to add a new vtable to the list, for user-defined types. Several other cleanups, changes and refactors.
Finally get the read-STRING logic under control.

Add some buffer-related helpers to read characters out of the buffer, and refuse to return incomplete codepoints. This simplifies read logic at the higher levels substantially. Use these and some other new features to (re-)implement Parrot_io_read_s and Parrot_io_readline_s. As always, a few other miscellaneous cleanups peppered throughout
Several cleanups and codestd. Remove a few unnecessary entries from the io vtable. Improved implementations of readline, peek and a few other things.
Start cleaning up sockets. Move API routines from src/io/socket.c to src/io/api.c. Rename them. Implement most socket IO_VTABLE routines. Rename functions in src/platform/xxx/socket.c to Parrot_io_internal_ to match conventions. Implement the new get_pointer_keyed_int and set_pointer_keyed_int vtables for most handle types
Add a mark routine for buffers, since they may hold a PMC reference. Start updating PMCs to use the new API calls in a standard way instead of implementing things themselves. Fill in the StringHandle vtable with existing logic and new never-before-supported operations.
Update Makefile, MANIFEST. Several fixes so that we can run headerizer, then I ran it.
fix headerization. Headerizer behaves very badly in the presence of C++-style comments so remove some of those and replace them with the much more verbose and padded Parrot-style comments.
Several fixes. Add a new API method to easily set up buffering on an existing handle.