home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 February
/
Chip_2000-02_cd.bin
/
zkuste
/
Delphi
/
navody
/
tt
/
objvm.exe
/
UNITS
/
ObjVM.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-06-27
|
2KB
|
55 lines
unit ObjVM;
interface
uses uObjVM,
Classes,ObjOp,OpList,RootValue,Code,uExecution,LangVariables,
ObjOps,ConstValues,LangValue;
type
{ TObjVM is a virtual machine for "objective" languages }
TObjVM=class(IObjVM)
public
Constants:TConstValues;
function StartExecution(c:TCode):IExecution;override;
published
constructor Create(o:TComponent);override;
destructor Destroy;override;
procedure AddValue(const Name:string;a:ILangValue);override;
procedure RemoveValue(a:ILangValue);override;
end;
implementation
uses Execution,ProxyValue;
function TObjVM.StartExecution;
Var e:TExecution;
begin
e:=TExecution.Create(Self,c);
e.Root.Add(TProxyValue.CreateFrom(Root));
e.Root.Add(TLangVariables.Create);
result:=e;
end;
constructor TObjVM.Create;
begin
Inherited Create(o);
Root:=TRootValue.Create;
Ops:=TOpList.Create;
Constants:=TConstValues.Create;
Constants.AddValue('Common',TLangVariables.Create);
Root.Add(Constants);
ObjOps.Register(Ops);
end;
destructor TObjVM.Destroy;
begin
Ops.Free;
Root.Free;
Inherited Destroy;
end;
procedure TObjVM.AddValue;
begin
Constants.AddValue(Name,a)
end;
procedure TObjVM.RemoveValue;
begin
Constants.RemoveValue(a);
end;
end.