martedì 2 ottobre 2007

New Primitives

Adding a new primitive means that you create a forth function. Every time you run this function in forth interpreter you just run C function associated.

To add a new primitive are enough three steps:

1. forth.h: add the name primitive function after the other ones

2. forth.c: in the function build_primitive add a line with the following syntax:
build_primitive( name_in_forth.h, "equivalent_Forth_command" );

3. Write the function void name_in_forth.h( void ) in any file (i.e. extension.c)

Nessun commento: