home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / uObjVM.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-05-29  |  1.0 KB  |  44 lines

  1. unit uObjVM;
  2.  
  3. interface
  4. uses Classes,
  5.      Code,uExecution,LangValue,RootValue,OpList;
  6. type IObjVM=class(IValueOwner)
  7.      public
  8.         Ops:TOpList;
  9.         Root:TRootValue;
  10.         {Current execution if run method used}
  11.         Execution:IExecution;
  12.         {Contructor}
  13.         constructor Create(o:TComponent);override;
  14.         {}
  15.         function StartExecution(c:TCode):IExecution;virtual;abstract;
  16.         {Run code}
  17.         procedure Run(c:TCode);virtual;
  18.         {Halt the current execution}
  19.         procedure Halt;virtual;
  20.      end;
  21. implementation
  22. constructor IObjVM.Create;
  23.             begin
  24.               inherited;
  25.               Execution:=nil;
  26.             end;
  27.  
  28. procedure IObjVM.Run;
  29.           begin
  30.             Execution:=StartExecution(c);
  31.             try
  32.               Execution.Run;
  33.             finally
  34.               Execution.Free;
  35.               Execution:=nil;
  36.             end;
  37.           end;
  38. procedure IObjVM.Halt;
  39.           begin
  40.             Execution.Halt;
  41.           end;
  42.  
  43. end.
  44.