Forth Class Reference
[Forth - Forth virtual machine]

Public interface to the forth virtual machine. More...

#include <forth.h>

Inheritance diagram for Forth:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void Reset ()
CELL Quit ()
CELL Execute (CELL xt)
CELL Evaluate (const CHAR *text, unsigned textLength)
void Push (const CELL *cells, unsigned numCells)
const CELLPop (unsigned numCells)

Static Public Member Functions

static ForthConstruct (void *memoryStart, size_t memorySize, ForthIo *ioHandler)

Detailed Description

Public interface to the forth virtual machine.

Definition at line 181 of file forth.h.


Member Function Documentation

Forth * Forth::Construct ( void *  memoryStart,
size_t  memorySize,
ForthIo ioHandler 
) [static]

Construct a forth virtual machine in the specified memory region.

Parameters:
memoryStart Start address of memory.
memorySize Size of memory.
ioHandler Pointer to the console i/o object the VM will use.
Returns:
Pointer to VM or 0 if memorySize is too small.

Definition at line 2323 of file forth.cpp.

void Forth::Reset (  ) 

Reset the virtual machine state to that of a newly constructed object.

Definition at line 2336 of file forth.cpp.

CELL Forth::Quit (  ) 

Perform the action of the forth word QUIT. I.e. continuously accept console input and interpret it.

To exit this function, enter the word BYE at the console.

Returns:
0 or a forth execption value.

Definition at line 2342 of file forth.cpp.

CELL Forth::Execute ( CELL  xt  ) 

Execute a forth execution token.

Parameters:
xt A forth execution token.
Returns:
0 or a forth execption value.

Definition at line 2348 of file forth.cpp.

CELL Forth::Evaluate ( const CHAR text,
unsigned  textLength 
)

Evaluate (interpret) a text string.

Parameters:
text Pointer to string.
textLength Number of characters in string.
Returns:
0 or a forth execption value.

Definition at line 2354 of file forth.cpp.

void Forth::Push ( const CELL cells,
unsigned  numCells 
)

Push a number of cells onto the forth parameter stack. Values are pushed in reverse order. E.g. cells[numCells -1] will be pushed first and cells [0] will be the top item on the stack.

Parameters:
cells Pointer to values to be pushed.
numCells Number of values to be pushed.

Definition at line 2366 of file forth.cpp.

const CELL * Forth::Pop ( unsigned  numCells  ) 

Pop a number of cells off the forth parameter stack.

Parameters:
numCells Number of values to be popped. This can be zero, in which case no values are removed from the stack, but a pointer to the top-most value is still returned; enabling values on the stack to read without removing them.
Returns:
Pointer to top most stack value popped; other values follow this in memory. These values become invalid once any other Forth class method is called.

Definition at line 2360 of file forth.cpp.


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.1