Next: Emacs and Gforth, Previous: Model, Up: Top
This is not yet implemented.
Several people like to use Forth as scripting language for applications that are otherwise written in C, C++, or some other language.
The Forth system ATLAST provides facilities for embedding it into applications; unfortunately it has several disadvantages: most importantly, it is not based on ANS Forth, and it is apparently dead (i.e., not developed further and not supported). The facilities provided by Gforth in this area are inspired by ATLAST's facilities, so making the switch should not be hard.
We also tried to design the interface such that it can easily be implemented by other Forth systems, so that we may one day arrive at a standardized interface. Such a standard interface would allow you to replace the Forth system without having to rewrite C code.
You embed the Gforth interpreter by linking with the library
libgforth.a (give the compiler the option
global symbols in this library that belong to the interface, have the
forth_. (Global symbols that are used internally have the
You can include the declarations of Forth types and the functions and
variables of the interface with
Data and FP Stack pointer. Area sizes.
forth_init(imagefile) forth_evaluate(string) exceptions? forth_goto(address) (or forth_execute(xt)?) forth_continue() (a corountining mechanism)
Accessing the Stacks