3 ms·
Traditional forth has blocks each 1k in size, n≥1 buffers that each can hold a single block, and words - BLOCK: reads an individual block, returns address wher
by Someone 8y ago
Traditional forth has blocks each 1k in size, n≥1 buffers that each can hold a single block, and words
- BLOCK: reads an individual block, returns address where it was loaded.
- UPDATE: marks most recent block as dirty.
- FLUSH: writes out all dirty blocks.
ANSI forth (I think) added EMPTY-BUFFERS, which marks all blocks as not-dirty.
If you wanted more, you could implement a file system on top of that.
Example usage at http://wiki.c2.com/?ForthBlocks http://wiki.c2.com/?ForthBlocks (includes a full-screen editor)
- abecedarius 8y agoANS Forth does include file I/O as well as blocks. Back when I worked at FORTH, Inc. we all just used blocks. (also iirc EMPTY-BUFFERS predates ANS Forth, though maybe it wasn't standard then.)