//=========================================================
objinterface SimpleObjCompiler;
Procedure InitCompiler;
Procedure AddString(Str : String);
Procedure CompAndExec;
end;
//=========================================================
vipinterface test implements SimpleObjCompiler;
//=========================================================
interface test Show At (1,1,5,3);
create view
as select
*
from
x$files
;
//---------------------------------------------------------
screen sc;
buttons
cmProcessFirst;
<<
<.Press me.>
>>
end;
var SourceHandle: longInt;
procedure InitCompiler;
begin
SourceHandle := vaGetFreeHandle;
end;
procedure AddString(Str : String);
begin
vaAddStr(SourceHandle, Str);
end;
procedure CompAndExec;
begin
var RuntimeHandle : longInt;
RuntimeHandle := vaCompile(SourceHandle);
var Result : Void;
vaExecute(RuntimeHandle, Result);
end;
handleEvent
cmProcessFirst:
{
Message('Родительский интерфейс');
var firstSourceHandle : longInt;
firstSourceHandle := vaGetFreeHandle;
vaAddStr(firstSourceHandle,'Script TheFirst; ');
vaAddStr(firstSourceHandle,' ');
vaAddStr(firstSourceHandle,' objinterface SimpleObjCompiler; ');
vaAddStr(firstSourceHandle,' Procedure InitCompiler; ');
vaAddStr(firstSourceHandle,' Procedure AddString(Str : String); ');
vaAddStr(firstSourceHandle,' Procedure CompAndExec; ');
vaAddStr(firstSourceHandle,' end; ');
vaAddStr(firstSourceHandle,' ');
vaAddStr(firstSourceHandle,' vipinterface test implements SimpleObjCompiler; ');
vaAddStr(firstSourceHandle,' ');
vaAddStr(firstSourceHandle,'begin ');
vaAddStr(firstSourceHandle,' var ObjCompiler : Test; ');
vaAddStr(firstSourceHandle,' message(''Первый скрипт''); ');
vaAddStr(firstSourceHandle,' ObjCompiler.InitCompiler; ');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' '');');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' Script ВторойСкрипт; '');');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' begin '');');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' '');');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' message(''''Скрипт, скомпилированный из-под скрипта!!'''') '');');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' '');');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' end. '');');
vaAddStr(firstSourceHandle,' ObjCompiler.AddString('' '');');
vaAddStr(firstSourceHandle,' ObjCompiler.CompAndExec; ');
vaAddStr(firstSourceHandle,' message(''Опять первый скрипт''); ');
vaAddStr(firstSourceHandle,'end. ');
var firstRunTimeHandle : longInt;
firstRunTimeHandle := vaCompile(firstSourceHandle);
var firstResult : Void;
vaExecute(firstRunTimeHandle, firstResult);
Message('Опять родительский интерфейс');
};
end;
end.