BEBIG is a 'memory extension' helper module which provides Andys Binary Folding Editor with the capability to edit massive files.
BE normally reads the files its editing into memory, but this is a little impractical for files of large numbers of megabytes.
BEBIG works by opening the file and keeping the file handle handy. When BE asks for data to display, it seeks to the right position and reads a byte. When BE edits data, it seeks to the right position and writes a byte back.
This may not be the fastest implementation around, but it is clearly the simplest.
BEBIG does not cache any data from the file, so pressing r or R both behave the same, ie: they simply cause the screen to be redrawn.
big! prefix is a cue that the binary data is to be
provided on demand to BE via BEBIG.
Anything after the prefix are arguments to be passed to BEBIG, and in this case it is the filename.
You can open a file in read-only mode using :-
Because BEBIG works by actually manipulating an open file, there are never any unsaved changes - ie: all changes are immediately placed into the file. Bear this in mind before making changes. If you quit the editor, you'll not be given the opportunity not to commit the changes.
The main reason for writing this module was not to handle the massive file case. Invokations of BE tend to be on small files (tens to hundreds of kilobytes). Also, when asked to edit a few megabytes of data, BE holds up well under the strain.
BEBIG is supplied (with source code) to serve as a template from which your own home grown memory extensions may be derived.
Note that if your own memory extension caches data, then it should implement
bemem_refresh entrypoint, which throws away any cached
Also, if the memory extension keeps modified data in memory and doesn't
immediately commit it back to the medium where it belongs, the memory
extension should implement the
bemem_flush entrypoint, which
must commit the 'unsaved changes'.