|
@@ -20,6 +20,11 @@ type
|
|
NoStrip : Boolean;
|
|
NoStrip : Boolean;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ TExportInfo = record
|
|
|
|
+ isExport : Boolean;
|
|
|
|
+ name : string;
|
|
|
|
+ end;
|
|
|
|
+
|
|
{ TWasmParam }
|
|
{ TWasmParam }
|
|
|
|
|
|
TWasmParam = class(TObject)
|
|
TWasmParam = class(TObject)
|
|
@@ -114,10 +119,21 @@ type
|
|
constructor Create;
|
|
constructor Create;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ { TWasmImport }
|
|
|
|
+
|
|
|
|
+ TWasmImport = class(TObject)
|
|
|
|
+ LinkInfo : TLinkInfo;
|
|
|
|
+ module : string;
|
|
|
|
+ name : string;
|
|
|
|
+ fn : TWasmFunc;
|
|
|
|
+ function AddFunc: TWasmFunc;
|
|
|
|
+ end;
|
|
|
|
+
|
|
{ TWasmModule }
|
|
{ TWasmModule }
|
|
|
|
|
|
TWasmModule = class(TObject)
|
|
TWasmModule = class(TObject)
|
|
private
|
|
private
|
|
|
|
+ imports : TList;
|
|
types : TList;
|
|
types : TList;
|
|
funcs : TList;
|
|
funcs : TList;
|
|
exp : TList;
|
|
exp : TList;
|
|
@@ -125,6 +141,9 @@ type
|
|
constructor Create;
|
|
constructor Create;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
|
|
|
|
|
|
+ function AddImport: TWasmImport;
|
|
|
|
+ function ImportCount: Integer;
|
|
|
|
+
|
|
function AddFunc: TWasmFunc;
|
|
function AddFunc: TWasmFunc;
|
|
function GetFunc(i: integer): TWasmFunc;
|
|
function GetFunc(i: integer): TWasmFunc;
|
|
function FuncCount: integer;
|
|
function FuncCount: integer;
|
|
@@ -205,6 +224,14 @@ begin
|
|
l.Clear;
|
|
l.Clear;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{ TWasmImport }
|
|
|
|
+
|
|
|
|
+function TWasmImport.AddFunc: TWasmFunc;
|
|
|
|
+begin
|
|
|
|
+ if not Assigned(fn) then fn:= TWasmFunc.Create;
|
|
|
|
+ Result:=fn;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ TWasmExport }
|
|
{ TWasmExport }
|
|
|
|
|
|
constructor TWasmExport.Create;
|
|
constructor TWasmExport.Create;
|
|
@@ -371,10 +398,13 @@ begin
|
|
types := TList.Create;
|
|
types := TList.Create;
|
|
funcs := TList.Create;
|
|
funcs := TList.Create;
|
|
exp := TList.Create;
|
|
exp := TList.Create;
|
|
|
|
+ imports := TList.Create;
|
|
end;
|
|
end;
|
|
|
|
|
|
destructor TWasmModule.Destroy;
|
|
destructor TWasmModule.Destroy;
|
|
begin
|
|
begin
|
|
|
|
+ ClearList(imports);
|
|
|
|
+ imports.Free;
|
|
ClearList(exp);
|
|
ClearList(exp);
|
|
exp.Free;
|
|
exp.Free;
|
|
ClearList(types);
|
|
ClearList(types);
|
|
@@ -384,6 +414,17 @@ begin
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TWasmModule.AddImport: TWasmImport;
|
|
|
|
+begin
|
|
|
|
+ Result:=TWasmImport.Create;
|
|
|
|
+ imports.Add(Result);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TWasmModule.ImportCount: Integer;
|
|
|
|
+begin
|
|
|
|
+ Result:=imports.Count;
|
|
|
|
+end;
|
|
|
|
+
|
|
function TWasmModule.AddFunc: TWasmFunc;
|
|
function TWasmModule.AddFunc: TWasmFunc;
|
|
begin
|
|
begin
|
|
Result:=TWasmFunc.Create;
|
|
Result:=TWasmFunc.Create;
|