mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-05 04:17:54 +02:00
* Namespaced WASI and JOB APIs
This commit is contained in:
parent
ed15d85e7a
commit
1afdbeda6a
3
packages/job/namespaced/JOB.Browser.pas
Normal file
3
packages/job/namespaced/JOB.Browser.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit JOB.Browser;
|
||||
{$include ../src/job_browser.pp}
|
3
packages/job/namespaced/JOB.Shared.pas
Normal file
3
packages/job/namespaced/JOB.Shared.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit JOB.Shared;
|
||||
{$include ../src/job_shared.pp}
|
@ -3,13 +3,20 @@
|
||||
|
||||
Browser side.
|
||||
}
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit JOB_Browser;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
interface
|
||||
|
||||
uses sysutils, types, js, web, wasienv, JOB_Shared;
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
System.SysUtils, System.Types, JSApi.JS, BrowserApi.Web, Wasi.Env, JOB.Shared;
|
||||
{$ELSE}
|
||||
sysutils, types, js, web, wasienv, JOB_Shared;
|
||||
{$ENDIF}
|
||||
|
||||
Type
|
||||
EJOBBridge = class(Exception);
|
@ -3,7 +3,9 @@
|
||||
|
||||
These types and constants are shared between pas2js and webassembly.
|
||||
}
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit JOB_Shared;
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
3
packages/wasi/namespaced/Fcl.App.Wasi.Host.pas
Normal file
3
packages/wasi/namespaced/Fcl.App.Wasi.Host.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit Fcl.App.Wasi.Host;
|
||||
{$include ../src/wasihostapp.pas}
|
3
packages/wasi/namespaced/Fcl.App.Wasi.Service.pas
Normal file
3
packages/wasi/namespaced/Fcl.App.Wasi.Service.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit Fcl.App.Wasi.Service;
|
||||
{$include ../src/wasiserviceapp.pas}
|
3
packages/wasi/namespaced/Fcl.App.Wasi.Threaded.pas
Normal file
3
packages/wasi/namespaced/Fcl.App.Wasi.Threaded.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit Fcl.App.Wasi.Threaded;
|
||||
{$include ../src/wasithreadedapp.pas}
|
3
packages/wasi/namespaced/Fcl.App.Wasi.ThreadedHost.pas
Normal file
3
packages/wasi/namespaced/Fcl.App.Wasi.ThreadedHost.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit Fcl.App.Wasi.ThreadedHost;
|
||||
{$include ../src/wasiworkerthreadhost.pas}
|
3
packages/wasi/namespaced/System.WebThreads.pas
Normal file
3
packages/wasi/namespaced/System.WebThreads.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit System.WebThreads;
|
||||
{$include ../src/rtl.webthreads.pas}
|
3
packages/wasi/namespaced/Wasi.Env.pas
Normal file
3
packages/wasi/namespaced/Wasi.Env.pas
Normal file
@ -0,0 +1,3 @@
|
||||
{$DEFINE FPC_DOTTEDUNITS}
|
||||
unit Wasi.Env;
|
||||
{$include ../src/wasienv.pas}
|
@ -24,7 +24,7 @@ interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
JSApi.JS, System.SysUtils, System.WasiEnv, BrowserApi.WebAssembly;
|
||||
JSApi.JS, System.SysUtils, Wasi.Env, BrowserApi.WebAssembly;
|
||||
{$ELSE}
|
||||
JS, SysUtils, wasienv, webassembly;
|
||||
{$ENDIF}
|
@ -1,5 +1,6 @@
|
||||
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit wasienv;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode ObjFPC}
|
||||
{$modeswitch externalclass}
|
||||
@ -11,7 +12,11 @@ unit wasienv;
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
System.SysUtils, System.Classes, JSApi.JS, BrowserApi.WebAssembly, System.Types;
|
||||
{$ELSE}
|
||||
SysUtils, Classes, JS, WebAssembly, types;
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
Const
|
||||
@ -588,7 +593,12 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses weborworker;
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
BrowserApi.WebOrWorker;
|
||||
{$ELSE}
|
||||
WebOrWorker;
|
||||
{$ENDIF}
|
||||
|
||||
{ TWASIHost }
|
||||
|
@ -1,11 +1,17 @@
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit wasihostapp;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode ObjFPC}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
System.Classes, System.SysUtils, Fcl.App.Browser, JSApi.JS, BrowserApi.WebAssembly, Wasi.Env;
|
||||
{$ELSE}
|
||||
Classes, SysUtils, browserapp, js, webassembly, wasienv;
|
||||
{$ENDIF}
|
||||
|
||||
Type
|
||||
|
@ -1,11 +1,17 @@
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit wasiserviceapp;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode ObjFPC}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
System.Classes, System.SysUtils, Fcl.App.ServiceWorker, BrowserApi.WebAssembly, Wasi.Env;
|
||||
{$ELSE}
|
||||
Classes, SysUtils, serviceworkerapp, webassembly, wasienv;
|
||||
{$ENDIF}
|
||||
|
||||
Type
|
||||
{ TWASIServiceApplication }
|
@ -1,4 +1,6 @@
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit wasithreadedapp;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode ObjFPC}
|
||||
{$modeswitch externalclass}
|
||||
@ -7,7 +9,12 @@ unit wasithreadedapp;
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
JSApi.JS, System.Classes, System.SysUtils, System.WebThreads, Wasi.Env, Fcl.App.Wasi.Host,
|
||||
BrowserApi.WebOrWorker;
|
||||
{$ELSE}
|
||||
JS, Classes, SysUtils, Rtl.WebThreads, wasienv, wasihostapp, weborworker;
|
||||
{$ENDIF}
|
||||
|
||||
Type
|
||||
{ TWasmThread }
|
@ -1,4 +1,6 @@
|
||||
{$IFNDEF FPC_DOTTEDUNITS}
|
||||
unit wasiworkerthreadhost;
|
||||
{$ENDIF}
|
||||
|
||||
{$mode ObjFPC}
|
||||
{$modeswitch externalclass}
|
||||
@ -6,7 +8,12 @@ unit wasiworkerthreadhost;
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
System.Classes, System.SysUtils, JSApi.JS, Fcl.CustApp, BrowserApi.WebOrWorker,
|
||||
BrowserApi.Worker, BrowserApi.WebAssembly, Wasi.Env, System.WebThreads;
|
||||
{$ELSE}
|
||||
Classes, SysUtils, JS, custapp, weborworker, webworker, webassembly, wasienv, Rtl.WebThreads;
|
||||
{$ENDIF}
|
||||
|
||||
Type
|
||||
TWorkerThreadSupport = Class;
|
||||
@ -144,7 +151,12 @@ Type
|
||||
|
||||
implementation
|
||||
|
||||
uses Types;
|
||||
uses
|
||||
{$IFDEF FPC_DOTTEDUNITS}
|
||||
System.Types;
|
||||
{$ELSE}
|
||||
Types;
|
||||
{$ENDIF}
|
||||
|
||||
var
|
||||
Self_ : TJSDedicatedWorkerGlobalScope; external name 'self';
|
||||
@ -610,7 +622,7 @@ end;
|
||||
|
||||
function TWorkerWASIHostApplication.GetLocation: String;
|
||||
begin
|
||||
Result:=webworker.Location.pathname;
|
||||
Result:={$IFDEF FPC_DOTTEDUNITS}BrowserApi.Worker.{$ELSE}}WebWorker.{$ENDIF}Location.pathname;
|
||||
end;
|
||||
|
||||
constructor TWorkerWASIHostApplication.Create(aOwner: TComponent);
|
Loading…
Reference in New Issue
Block a user