API Remake
This commit is contained in:
@@ -2,6 +2,8 @@ unit RuntimeBuilder.Fasm;
|
||||
|
||||
interface
|
||||
|
||||
//{$INLINE auto}
|
||||
|
||||
uses
|
||||
System.Classes,System.TypInfo,System.IOUtils,System.Rtti,Winapi.Windows,
|
||||
RuntimeBuilder,FasmOnDelphi;
|
||||
@@ -35,23 +37,23 @@ type
|
||||
constructor Create(Name:string);
|
||||
destructor Destroy;override;
|
||||
end;
|
||||
protected
|
||||
libs:TStringList;
|
||||
function GetIncLibs():string;
|
||||
protected
|
||||
FText:string;
|
||||
function GetText:string;override;
|
||||
procedure SetText(S:string);override;
|
||||
public
|
||||
function LoadLib(Name:string):TRTBLib;override;
|
||||
constructor Create(Compiler:TRTBFasmCompiler);
|
||||
function CompilateAsFunc:TRTBFunc;override;
|
||||
function CompilateAsLib:TRTBLib;override;
|
||||
end;
|
||||
protected
|
||||
function GetIncLibs():string;
|
||||
public
|
||||
CompilerMem:NativeUInt;
|
||||
MaxSteps:word;
|
||||
libs:TStringList;
|
||||
constructor Create(FasmPath:String=FasmPath;AsDll:boolean=false);
|
||||
function LoadLib(Name:string):TRTBLib;
|
||||
function GenNewSrc():TRTBSource;override;
|
||||
end;
|
||||
|
||||
@@ -68,9 +70,6 @@ FreeMem(p);
|
||||
end;
|
||||
|
||||
function TRTBFasmCompiler.TRTBFasmSource.TRTBFasmFunc.Call(OutType:PTypeInfo;args:TArray<TValue>;CallType:TRTBCallType=CRTBCallTypeDefault):TValue;
|
||||
{$IFDEF CPUX64}
|
||||
//function()
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF CPUX64}
|
||||
Result:=Invoke(p,args,ccReg,OutType);
|
||||
@@ -127,10 +126,25 @@ begin
|
||||
FText:=S;
|
||||
end;
|
||||
|
||||
function TRTBFasmCompiler.TRTBFasmSource.GetIncLibs():string;
|
||||
var
|
||||
i:integer;
|
||||
begin
|
||||
Result:='';
|
||||
for i:=0 to libs.count-1 do
|
||||
Result:=Result+sLineBreak+'include '+#39+libs.Strings[i]+#39;
|
||||
end;
|
||||
|
||||
constructor TRTBFasmCompiler.TRTBFasmSource.Create(Compiler:TRTBFasmCompiler);
|
||||
begin
|
||||
inherited Create(Compiler);
|
||||
FText:='';
|
||||
libs:=TStringList.Create;
|
||||
end;
|
||||
|
||||
function TRTBFasmCompiler.TRTBFasmSource.LoadLib(Name:string):TRTBLib;
|
||||
begin
|
||||
libs.Add(Name);
|
||||
end;
|
||||
|
||||
function TRTBFasmCompiler.TRTBFasmSource.CompilateAsFunc:TRTBFunc;
|
||||
@@ -162,21 +176,6 @@ begin
|
||||
CompilerMem:=1024*1024*16;
|
||||
MaxSteps:=65535;
|
||||
OpenFASM(FasmPath,AsDll);
|
||||
libs:=TStringList.Create;
|
||||
end;
|
||||
|
||||
function TRTBFasmCompiler.LoadLib(Name:string):TRTBLib;
|
||||
begin
|
||||
libs.Add(Name);
|
||||
end;
|
||||
|
||||
function TRTBFasmCompiler.GetIncLibs():string;
|
||||
var
|
||||
i:integer;
|
||||
begin
|
||||
Result:='';
|
||||
for i:=0 to libs.count-1 do
|
||||
Result:=Result+sLineBreak+'include '+#39+libs.Strings[i]+#39;
|
||||
end;
|
||||
|
||||
function TRTBFasmCompiler.GenNewSrc():TRTBSource;
|
||||
|
||||
Reference in New Issue
Block a user