Bef is a 32-bit token-threaded Forth language IDE by Bruce Hoyt (my dad) that runs under DOS, Windows and Linux and now also on the ARM (cloader version).
This version was modified and maintained by Berwyn Hoyt (one of my brothers), who used it at work for a number of years.
It includes bonus applications FE (Forth Editor) and Pentom (a lighting-fast pentomino puzzle solver). FE is also available in its own repository.
The Windows version is a console program that uses the Windows API for system calls. It will use the current window size for the editor. The buffer size will be reduced to the window size in the editor and restored to its previous size for the forth command line.
git clone https://github.com/benhoyt/bef
cd bef
./fmake installTo run the FE editor or Pentom:
bin/tfel myfile.txt # run text editor
cd inc/pentom
../../bin/tfl pentom.f # run 8x8 puzzle solver
../../bin/tfl pent3d.f # run 3D 3x4x5 puzzle solverOn Linux, also do:
sudo apt install libc6-i386 # install 32-bit libs required for this older 32-bit software
make
make install # to install in your local $HOME/bin directory
fe myfile.txt # run text editor
pentom # run 8x8 puzzle solver
pent3d # run 3D 3x4x5 puzzle solverThis first installs i386 libraries which are required for this older 32-bit software to run on a 64-bit machine, and then make will also install code page 437, which is necessary in Linux to properly display the DOS character set used by Pentom to display puzzle solutions.
The ARM-Linux version presently uses a loader written in C which contains the primitives and system calls.
The DOS version uses DPMI for system calls. To build it:
mk talldTo meta-compile the system:
- set
SRC-PATHin the filebef.cfgto the root of the source tree - see
bef.cfxfor an example
Also set the list of include paths (note the example in bef.cfx) for paths you want INCLUDE to search.
Note: I'm not sure the following works any more as I don't see mk or mk.bat. Maybe now does fmake does what is required.
To build the Windows system in a CMD or Command shell:
mk tallwTo build the Windows system under CYGWIN bash:
./mk.bat tallwBef searches for bef.cfg (and editor searches fe.cfg) in the following order:
- current directory
- directory of executable
- full paths pointed to by
BEF_CFGenvironment variable
Bef uses / in paths internally. They are converted to \ before the WIN API sees them.
Forth words that contain System calls include the following:
_stdin
_stdout
_stderr
outfile-id
_write-file
_read-file
_type
_at-xy
_get-screen-buffer-info
_get-xy
_screen-size
console-window-size
console-buffer-size
set-console-window-size
set-console-buffer-size
init-console-mode
_get-colour
_set-colour
_type-chars
eeol
_clear-scr
_page
set-cursor-size
_set-cursor-shape
_ekey
_ekey?
ekey>char
_key
_key?
ms
time&date
allocate
free
resize
_bye
_close-file
r/o
w/o
r/w
bin
_create-file
_open-file
delete-file
rename-file
_reposition-file
_file-position
_file-size
_resize-file
_read-line
_write-line
file-status
_flush-file
expand-path
is-char-device?
create-dir
delete-dir
command-line
prog-name
getenv
_system
start-timer
read-timer
_emit
bell
NOTE: words with an initial _ are default values for the deferred standard words without the initial _. For example, create-file is a deferred word initialised to _create-file.