Modify how library functions handle I/O and memory.

Modify brainfuck library functions so that they don't make any
assumptions about how to allocate and deallocate memory. Much like the
Lua core, instead of using "malloc" and friends, the functions allocates
memory through user-supplied callbacks. A similar approach is used for
handling input and output.