home *** CD-ROM | disk | FTP | other *** search
- unit uExecution;
-
- interface
- uses
- Code,LangValue,Forms,RootValue,ConstValues;
- { IExecution provides interface for task. }
- { It is similar to task or thread in operation systems}
- type IExecution=class
- protected
- public
- {Root - root value}
- Root:TRootValue;
- {Constants - execution depended}
- Consts:TConstValues;
- {Code - currently executing code}
- Code:TCode;
- {IP - Instruction pointer - address of currently}
- {executing instruction}
- IP:integer;
- {IsEnd - determines when execution must be stopped}
- IsEnd:boolean;
- {Source - source of Code (Reserved for debug purporses)}
- Source:TObject;
- {Line, Pos - line and position of source code (Reserved)}
- Line,Pos:Integer;
- {Data is a stack for storing operation arguments (Reserved for debug purporses)}
- Data,
- {Return is a stack for storing some execution-flow information}
- {such as return addresses (not implemented) and FOR loop variables}
- Return:IValStack;
- {BeginExec - see TExecution reference}
- procedure BeginExec;virtual;
- {Step - see TExecution reference}
- procedure Step;virtual;abstract;
- {EndExec - see TExecution reference}
- procedure EndExec;virtual;abstract;
- {Run - run execution until IsEnd value is setted to True}
- procedure Run;virtual;
- {Halt - stop execution}
- procedure Halt;virtual;
- end;
- implementation
- procedure IExecution.BeginExec;
- begin
- IP:=0;
- IsEnd:=false;
- end;
- procedure IExecution.Run;
- begin
- While not IsEnd do
- begin
- Step;
- Application.ProcessMessages;
- end;
- end;
- {Halt - stop execution}
- procedure IExecution.Halt;
- begin
- IsEnd:=true;
- end;
-
- end.
-