Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

ForthIo Class Reference
[Forth - Forth virtual machine]

#include <forth.h>

Inheritance diagram for ForthIo:

StdForthIo List of all members.

Detailed Description

Abstract interfrace class for forth character i/o.

The forth VM uses this object to request character input and output. Here is an example implementation of this class using the C standard library...

    #include <conio.h>

    class StdForthIo : public ForthIo
        {
    public:
        inline StdForthIo()
            { NewLine[0]=2; NewLine[1]=13; NewLine[2]=10; }
        virtual void ConsoleOut(CHAR* text,UCELL textLength)
            { while(textLength--) putch(*text++); }
        virtual CELL ConsoleIn()
            { return getch(); }
        };

Definition at line 107 of file forth.h.

Public Member Functions

virtual void ConsoleOut (const CHAR *text, UCELL textLength)=0
virtual CELL ConsoleIn ()=0

Public Attributes

CHAR NewLine [4]


Member Function Documentation

virtual void ForthIo::ConsoleOut const CHAR text,
UCELL  textLength
[pure virtual]
 

Display a text string on the console. This is called by the forth words TYPE and EMIT.

Parameters:
text Pointer to string.
textLength Number of characters in string.

Implemented in StdForthIo.

virtual CELL ForthIo::ConsoleIn  )  [pure virtual]
 

Get a single character from the console input. This is called by the forth word KEY.

Returns:
The character.

Implemented in StdForthIo.


Member Data Documentation

CHAR ForthIo::NewLine[4]
 

A counted string representing the system's line terminating sequence. This is used by the forth word CR and the first character in this string is also used as the input termination character by ACECPT.

NewLine[0] is the character count, NewLine[1] and subsequent are the characters of the line terminating sequence; unused characters may be left uninitialised. E.g. the following sequence initialises the string with a carriage-return line-feed sequence:

    NewLine[0]=2; NewLine[1]=13; NewLine[2]=10;

Definition at line 138 of file forth.h.


The documentation for this class was generated from the following file:
Generated by  doxygen 1.4.4