Stdio.IOBuffer -> Stdio.Buffer (part 2)
Stdio.IOBuffer -> Stdio.Buffer (part 1)
Some IOBuffer work
o Made all (I think) functions atomic. Either they work or they do
nothing (except throw an error or return 0).
o One minor optimization to avoid copies when strings/system.memory
object etc are added to an empty buffer. Unless you add more data
the buffer is just moved to point to the object that was just added.
The malloced buffer is still kept around, however.
o Added a very very basic testsuite for IOBuffer. More to come.
Merge remote-tracking branch 'origin/8.0' into string_alloc
Added buffered asynchronous I/O mode to Stdio.File
In this mode the input and output is kept in buffers in the file object.
Adding data to the output buffer will write it to the filedescriptor, and
the read callback will receive the input buffer as its argument.
The write callback will have the output buffer as a second argument,
but most of the time this can be ignored since you keep the buffer
The write callback will only be called if the buffer needs more data,
so if you implement a range_error function in the buffer that refills
the buffer it will only be called once that callback returns 0.
Some tweaks to Stdio.IOBuffer:
o The various functions that add data now return the buffer
o It is now possible to overload the range_error method.
This can be used to fill the buffer on demand.
Some changes to Stdio.IOBuffer:
o Set error mode now accepts a program to throw on error
o Relaxed argument types (for now)
Added some more functionality to Stdio.IOBuffer
o input_from(file), output_to(file) -- async or sync file-IO.
o add and crete now supports the other buffer objects
Moved __builtin.IOBuffer to Stdio.IOBuffer (for now)