"4tran"? (52)

17 Name: #!/usr/bin/anonymous : 2008-02-22 07:09 ID:Heaven

It'd be trivial to extend an existing implementation to add file manipulation without all that other bloat.

Essentially what it needs is a way to define the beginning and end of a string to use as a filename, functions to open a file for reading or writing defined by the string you've set, close a file, and change the standard input/output stream to point to that file.

Suppose we used ^ to set a string-start marker, ? to read a file, ! to write, and @ to append. Then you could do something like:

^ first character is here
o --[>-<-------]>+>
u ----[>+++++<--]>->
t ----[>+++++<--]>-->
p --[>-<-------]>++>
u ----[>+++++<--]>->
t ----[>+++++<--]>--
!

And now your . would write to "output".
You could then adjust the file operations so that after opening a file they would write a file handle into the current cell. Then, and assuming since this is the first file, our file handle is probably going to be #3 (since 0/1/2 are predefined to stdin/out/err), if we immediately did a . after the !, our file would get a \x03 written to it.

Now we just need two more commands, one to close a file when we're done with it -- say, $ -- and another to set the current handle that . or , operate on -- perhaps : to change the write handle and ; to change the read handle.

After that, you'd be set to make a Brainfuck-based imageboard.

This thread has been closed. You cannot post in this thread any longer.