home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 February
/
Chip_2000-02_cd.bin
/
zkuste
/
Delphi
/
navody
/
tt
/
objvm.exe
/
SAMPLE
/
uRunTime.pas
< prev
Wrap
Pascal/Delphi Source File
|
1998-06-23
|
5KB
|
175 lines
unit uRunTime;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
LangValue, uObjVM, ObjVM, ProxyValue, VisualValue, LangProc;
type
TRunTime = class(TDataModule)
VM: TObjVM;
ShowProc: TLangProc;
ShowProcRuss: TProxyValue;
InputQueryProc: TLangProc;
InputQueryRuss: TProxyValue;
CRLF: TLangProc;
FlToStr: TLangProc;
CStrProc: TLangProc;
procedure ShowProcExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
procedure InputQueryProcExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
procedure CRLFExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
procedure FlToStrExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
procedure CStrProcExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
RunTime: TRunTime;
implementation
uses VarLangValue;
{$R *.DFM}
procedure TRunTime.ShowProcExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
Var I:Integer;
str:string;
Res:TVarLangValue;
begin
str:='';
for i:=0 to S.FrameCount-1 do
begin
str:=str+s.FrameValues[i].AsString;
end;
S.DropFrame;
if MustReturn then
begin
Res:=TVarLangValue.Create(nil);
Res.AsBoolean:=true;
S.Push(Res);
end;
MessageDlg(str,mtInformation,[mbOk],0);
end;
procedure TRunTime.InputQueryProcExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
Var sCaption,sPrompt,sValue:string;
aResult:boolean;
iCaption,iPrompt,iValue:integer;
vCaption,vPrompt,vValueRef,vValue,vResult:ILangValue;
begin
sCaption:='';
sPrompt:='';
sValue:='';
vValueRef:=nil;
iCaption:=-1;
iPrompt:=-1;
iValue:=-1;
case s.FrameCount of
1:begin
iValue:=0;
end;
2:begin
iPrompt:=0;
iValue:=1;
end;
3:begin
iCaption:=0;
iPrompt:=1;
iValue:=2;
end;
end;
if iValue<>-1 then
begin
vValueRef:=s.FrameValues[iValue].CreateEqu;
vValue:=vValueRef.GetValue;
sValue:=vValue.AsString;
vValue.Free;
end;
if iPrompt<>-1 then
begin
sPrompt:=s.FrameValues[iPrompt].AsString;
end;
if iCaption<>-1 then
begin
sCaption:=s.FrameValues[iCaption].AsString;
end;
s.DropFrame;
aResult:=InputQuery(sCaption,sPrompt,sValue);
if iValue<>-1 then
begin
vValue:=TVarLangValue.Create(nil);
vValue.AsString:=sValue;
vValueRef.SetValue(vValue);
vValueRef.Free;
end;
if MustReturn then
begin
vResult:=TVarLangValue.Create(nil);
vResult.AsBoolean:=aResult;
s.Push(vResult);
end;
end;
procedure TRunTime.CRLFExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
Var v:TVarLangValue;
begin
s.DropFrame;
if MustReturn then
begin
v:=TVarLangValue.Create(Nil);
v.AsString:=#10#13;
S.Push(v);
end;
end;
procedure TRunTime.FlToStrExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
Var str:string;
v:TVarLangValue;
begin
if s.FrameCount>0 then
begin
str:=s.FrameValues[0].AsVariant;
end;
s.DropFrame;
if MustReturn then
begin
v:=TVarLangValue.Create(Nil);
v.AsString:=Str;
S.Push(v);
end;
end;
procedure TRunTime.CStrProcExec(Sender: TVisualValue; S: IValStack;
MustReturn: Boolean);
Var str:string;
v:TVarLangValue;
begin
if s.FrameCount>0 then
begin
str:=s.FrameValues[0].AsVariant;
end;
s.DropFrame;
if MustReturn then
begin
v:=TVarLangValue.Create(Nil);
v.AsString:=Str;
S.Push(v);
end;
end;
end.