* WASI webassembly options

This commit is contained in:
Michaël Van Canneyt 2021-12-29 13:50:31 +01:00
parent b82a00a7bc
commit e0a5700238
12 changed files with 184 additions and 33 deletions

View File

@ -1,22 +1,22 @@
object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Left = 431 Left = 431
Height = 383 Height = 430
Top = 310 Top = 310
Width = 491 Width = 508
Caption = 'Pas2JS Browser project options' Caption = 'Pas2JS Browser project options'
ClientHeight = 383 ClientHeight = 430
ClientWidth = 491 ClientWidth = 508
OnCreate = FormCreate OnCreate = FormCreate
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '2.1.0.0' LCLVersion = '2.3.0.0'
object CBCreateHTML: TCheckBox object CBCreateHTML: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 6 Left = 6
Height = 23 Height = 23
Top = 6 Top = 6
Width = 164 Width = 173
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Create initial HTML page' Caption = 'Create initial HTML page'
@ -32,28 +32,29 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Left = 6 Left = 6
Height = 23 Height = 23
Top = 122 Top = 122
Width = 200 Width = 213
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Use Browser Application object' Caption = 'Use Browser Application object'
OnChange = CBUseBrowserAppChange
TabOrder = 1 TabOrder = 1
end end
object CBUseBrowserConsole: TCheckBox object CBUseBrowserConsole: TCheckBox
AnchorSideLeft.Control = CBCreateHTML AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBUseBrowserApp AnchorSideTop.Control = CBUseWASI
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 23 Height = 23
Top = 151 Top = 180
Width = 314 Width = 341
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Use Browser Console unit to display writeln() output' Caption = 'Use Browser Console unit to display writeln() output'
TabOrder = 2 TabOrder = 2
end end
object BPHelpOptions: TButtonPanel object BPHelpOptions: TButtonPanel
Left = 6 Left = 6
Height = 39 Height = 38
Top = 338 Top = 386
Width = 479 Width = 496
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton' HelpButton.Name = 'HelpButton'
@ -70,8 +71,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Control = RBStartServerAt AnchorSideTop.Control = RBStartServerAt
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 70 Left = 70
Height = 29 Height = 27
Top = 234 Top = 263
Width = 75 Width = 75
BorderSpacing.Left = 32 BorderSpacing.Left = 32
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -86,8 +87,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 23 Height = 23
Top = 180 Top = 209
Width = 185 Width = 194
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Project needs a HTTP Server' Caption = 'Project needs a HTTP Server'
OnChange = CBUseHTTPServerChange OnChange = CBUseHTTPServerChange
@ -99,8 +100,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 38 Left = 38
Height = 23 Height = 23
Top = 209 Top = 238
Width = 169 Width = 180
BorderSpacing.Left = 32 BorderSpacing.Left = 32
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Start HTTP Server on port' Caption = 'Start HTTP Server on port'
@ -114,8 +115,8 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 38 Left = 38
Height = 23 Height = 23
Top = 265 Top = 292
Width = 163 Width = 173
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Caption = 'Use this URL to start app' Caption = 'Use this URL to start app'
TabOrder = 7 TabOrder = 7
@ -127,9 +128,9 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 70 Left = 70
Height = 29 Height = 27
Top = 290 Top = 317
Width = 409 Width = 426
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 12 BorderSpacing.Right = 12
@ -143,7 +144,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Left = 6 Left = 6
Height = 23 Height = 23
Top = 35 Top = 35
Width = 142 Width = 151
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Maintain HTML Page' Caption = 'Maintain HTML Page'
TabOrder = 9 TabOrder = 9
@ -155,7 +156,7 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Left = 6 Left = 6
Height = 23 Height = 23
Top = 64 Top = 64
Width = 290 Width = 313
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Run rtl when all page resources are fully loaded' Caption = 'Run rtl when all page resources are fully loaded'
TabOrder = 10 TabOrder = 10
@ -167,9 +168,36 @@ object WebBrowserProjectOptionsForm: TWebBrowserProjectOptionsForm
Left = 6 Left = 6
Height = 23 Height = 23
Top = 93 Top = 93
Width = 208 Width = 226
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Let rtl show uncaught exceptions' Caption = 'Let rtl show uncaught exceptions'
TabOrder = 11 TabOrder = 11
end end
object CBUseWASI: TCheckBox
AnchorSideLeft.Control = CBCreateHTML
AnchorSideTop.Control = CBUseBrowserApp
AnchorSideTop.Side = asrBottom
Left = 38
Height = 23
Top = 151
Width = 193
BorderSpacing.Left = 32
BorderSpacing.Top = 6
Caption = 'Host webassembly program'
Enabled = False
TabOrder = 12
end
object edtWasmProgram: TEdit
AnchorSideLeft.Control = CBUseWASI
AnchorSideLeft.Side = asrBottom
Left = 247
Height = 27
Top = 150
Width = 248
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 16
Enabled = False
TabOrder = 13
TextHint = 'Name of your webassembly file'
end
end end

View File

@ -16,26 +16,32 @@ type
BPHelpOptions: TButtonPanel; BPHelpOptions: TButtonPanel;
CBCreateHTML: TCheckBox; CBCreateHTML: TCheckBox;
CBUseBrowserApp: TCheckBox; CBUseBrowserApp: TCheckBox;
CBUseWASI: TCheckBox;
CBUseBrowserConsole: TCheckBox; CBUseBrowserConsole: TCheckBox;
CBUseHTTPServer: TCheckBox; CBUseHTTPServer: TCheckBox;
CBServerURL: TComboBox; CBServerURL: TComboBox;
CBMaintainPage: TCheckBox; CBMaintainPage: TCheckBox;
CBRunOnReady: TCheckBox; CBRunOnReady: TCheckBox;
cbShowUncaughtExceptions: TCheckBox; cbShowUncaughtExceptions: TCheckBox;
edtWasmProgram: TEdit;
RBUseURL: TRadioButton; RBUseURL: TRadioButton;
RBStartServerAt: TRadioButton; RBStartServerAt: TRadioButton;
SEPort: TSpinEdit; SEPort: TSpinEdit;
procedure CBCreateHTMLChange(Sender: TObject); procedure CBCreateHTMLChange(Sender: TObject);
procedure CBUseBrowserAppChange(Sender: TObject);
procedure CBUseHTTPServerChange(Sender: TObject); procedure CBUseHTTPServerChange(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
private private
procedure CheckWasi;
function GetB(AIndex: Integer): Boolean; function GetB(AIndex: Integer): Boolean;
function GetServerPort: Word; function GetServerPort: Word;
function GetURL: String; function GetURL: String;
function GetWasmProgramURL: String;
procedure SetB(AIndex: Integer; AValue: Boolean); procedure SetB(AIndex: Integer; AValue: Boolean);
procedure SetServerPort(AValue: Word); procedure SetServerPort(AValue: Word);
procedure SetURL(AValue: String); procedure SetURL(AValue: String);
procedure SetWasmProgramURL(AValue: String);
public public
property CreateHTML : Boolean Index 0 read GetB Write SetB; property CreateHTML : Boolean Index 0 read GetB Write SetB;
property MaintainHTML : Boolean Index 1 read GetB Write SetB; property MaintainHTML : Boolean Index 1 read GetB Write SetB;
@ -45,8 +51,10 @@ type
property UseURL : Boolean Index 5 read GetB Write SetB; property UseURL : Boolean Index 5 read GetB Write SetB;
property UseRunOnReady : Boolean Index 6 read GetB Write SetB; property UseRunOnReady : Boolean Index 6 read GetB Write SetB;
property ShowUncaughtExceptions : Boolean Index 7 read GetB Write SetB; property ShowUncaughtExceptions : Boolean Index 7 read GetB Write SetB;
property UseWASI : Boolean Index 8 read GetB Write SetB;
Property ServerPort : Word Read GetServerPort Write SetServerPort; Property ServerPort : Word Read GetServerPort Write SetServerPort;
Property URL : String Read GetURL Write SetURL; Property URL : String Read GetURL Write SetURL;
Property WasmProgramURL : String Read GetWasmProgramURL Write SetWasmProgramURL;
end; end;
var var
@ -73,6 +81,18 @@ begin
DoCB(CBMaintainPage); DoCB(CBMaintainPage);
end; end;
procedure TWebBrowserProjectOptionsForm.CBUseBrowserAppChange(Sender: TObject);
begin
CheckWASI;
end;
procedure TWebBrowserProjectOptionsForm.CheckWasi;
begin
CBUseWASI.Enabled:=UseBrowserApp;
edtWasmProgram.Enabled:=UseBrowserApp;
end;
procedure TWebBrowserProjectOptionsForm.CBUseHTTPServerChange(Sender: TObject); procedure TWebBrowserProjectOptionsForm.CBUseHTTPServerChange(Sender: TObject);
procedure disen(C : TControl); procedure disen(C : TControl);
@ -102,6 +122,8 @@ begin
CBUseHTTPServer.Caption:=pjsdProjectNeedsAHTTPServer; CBUseHTTPServer.Caption:=pjsdProjectNeedsAHTTPServer;
RBStartServerAt.Caption:=pjsdStartHTTPServerOnPort; RBStartServerAt.Caption:=pjsdStartHTTPServerOnPort;
RBUseURL.Caption:=pjsdUseThisURLToStartApplication; RBUseURL.Caption:=pjsdUseThisURLToStartApplication;
CBUseWASI.Caption:=pjsdUseWASIApplicationObject;
edtWasmProgram.TextHint:=pjsWasiProgramFileTextHint;
CBCreateHTMLChange(self); CBCreateHTMLChange(self);
CBUseHTTPServerChange(Self); CBUseHTTPServerChange(Self);
end; end;
@ -124,6 +146,7 @@ begin
5 : Result:=RBUseURL.Checked; 5 : Result:=RBUseURL.Checked;
6 : Result:=CBRunOnReady.Checked; 6 : Result:=CBRunOnReady.Checked;
7 : Result:=cbShowUncaughtExceptions.Checked; 7 : Result:=cbShowUncaughtExceptions.Checked;
8 : Result:=cbUseWASI.Checked;
else else
Result:=False; Result:=False;
end; end;
@ -140,12 +163,21 @@ begin
Result:=CBServerURL.Text; Result:=CBServerURL.Text;
end; end;
function TWebBrowserProjectOptionsForm.GetWasmProgramURL: String;
begin
Result:=edtWasmProgram.Text;
end;
procedure TWebBrowserProjectOptionsForm.SetB(AIndex: Integer; AValue: Boolean); procedure TWebBrowserProjectOptionsForm.SetB(AIndex: Integer; AValue: Boolean);
begin begin
Case Aindex of Case Aindex of
0 : CBCreateHTML.Checked:=AValue; 0 : CBCreateHTML.Checked:=AValue;
1 : CBMaintainPage.Checked:=AValue; 1 : CBMaintainPage.Checked:=AValue;
2 : CBUseBrowserApp.Checked:=AValue; 2 :
begin
CBUseBrowserApp.Checked:=AValue;
CheckWASI;
end;
3 : CBUseBrowserConsole.Checked:=AValue; 3 : CBUseBrowserConsole.Checked:=AValue;
4 : 4 :
begin begin
@ -161,6 +193,7 @@ begin
end; end;
6 : CBRunOnReady.Checked:=Avalue; 6 : CBRunOnReady.Checked:=Avalue;
7 : cbShowUncaughtExceptions.Checked:=aValue; 7 : cbShowUncaughtExceptions.Checked:=aValue;
8 : cbUseWASI.Checked:=aValue;
end; end;
end; end;
@ -174,5 +207,10 @@ begin
CBServerURL.Text:=AValue; CBServerURL.Text:=AValue;
end; end;
procedure TWebBrowserProjectOptionsForm.SetWasmProgramURL(AValue: String);
begin
edtWasmProgram.Text:=aValue;
end;
end. end.

View File

@ -217,6 +217,10 @@ msgstr "Utiliser ce navigateur lors de l'ouverture de l'URL ou du fichier HTML d
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "Utiliser cette URL pour démarrer l'application" msgstr "Utiliser cette URL pour démarrer l'application"
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "Répertoire des modèles d'extension de code Visual Studio" msgstr "Répertoire des modèles d'extension de code Visual Studio"
@ -238,6 +242,10 @@ msgstr "Projet Web (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Vous pouvez utiliser des macros de l'EDI comme $MakeExe(). Sans chemin complet, %s est recherché dans PATH." msgstr "Vous pouvez utiliser des macros de l'EDI comme $MakeExe(). Sans chemin complet, %s est recherché dans PATH."
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"
msgid "Pas2JS WebServers" msgid "Pas2JS WebServers"

View File

@ -219,6 +219,10 @@ msgstr "Ez a böngésző legyen használva amikor egy böngészős projekt URL-j
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "Az alkalmazás indításához ezt az URL-t használja" msgstr "Az alkalmazás indításához ezt az URL-t használja"
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "" msgstr ""
@ -242,6 +246,10 @@ msgstr "Web projekt (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Használhatók az IDE makrók, mint a $MakeExe(). Teljes útvonal nélkül a PATH-ban felsorolt helyeken lesz keresve a(z) %s." msgstr "Használhatók az IDE makrók, mint a $MakeExe(). Teljes útvonal nélkül a PATH-ban felsorolt helyeken lesz keresve a(z) %s."
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"
msgid "Pas2JS WebServers" msgid "Pas2JS WebServers"

View File

@ -207,6 +207,10 @@ msgstr ""
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "" msgstr ""
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "" msgstr ""
@ -228,6 +232,10 @@ msgstr ""
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "" msgstr ""
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"
msgid "Pas2JS WebServers" msgid "Pas2JS WebServers"

View File

@ -218,6 +218,10 @@ msgstr "Usar este navegador ao abrir a URL ou arquivo HTML de um projeto de nave
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "Usar esta URL para iniciar a aplicação" msgstr "Usar esta URL para iniciar a aplicação"
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "Diretório de modelos de extensão de código do Visual Studio" msgstr "Diretório de modelos de extensão de código do Visual Studio"
@ -241,6 +245,10 @@ msgstr "Projeto Web (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Você pode usar macros IDE como \"$MakeExe()\". Sem um caminho completo, %s é pesquisado em \"PATH\"" msgstr "Você pode usar macros IDE como \"$MakeExe()\". Sem um caminho completo, %s é pesquisado em \"PATH\""
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"
msgid "Pas2JS WebServers" msgid "Pas2JS WebServers"

View File

@ -217,6 +217,10 @@ msgstr "Браузер для открытия предназначенного
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "Использовать следующий адрес для запуска приложения" msgstr "Использовать следующий адрес для запуска приложения"
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "Каталог шаблона расширения Visual Studio Code" msgstr "Каталог шаблона расширения Visual Studio Code"
@ -238,6 +242,10 @@ msgstr "Веб-проект (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Можно использовать макросы IDE, например, $MakeExe(). Если полный путь не указан, поиск %s производится при помощи переменной окружения PATH." msgstr "Можно использовать макросы IDE, например, $MakeExe(). Если полный путь не указан, поиск %s производится при помощи переменной окружения PATH."
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"
msgid "Pas2JS WebServers" msgid "Pas2JS WebServers"

View File

@ -219,6 +219,10 @@ msgstr ""
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "" msgstr ""
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "" msgstr ""
@ -242,6 +246,10 @@ msgstr ""
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "" msgstr ""
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
#, fuzzy #, fuzzy
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"

View File

@ -219,6 +219,10 @@ msgstr "Для відкривання URL або HTML-файлів проєкт
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "Для запуску застосунку використати цей URL" msgstr "Для запуску застосунку використати цей URL"
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "Теку шаблонів розширень Visual Studio Code" msgstr "Теку шаблонів розширень Visual Studio Code"
@ -240,6 +244,10 @@ msgstr "Веб-проєкт (pas2js)"
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "Можна використовувати макроси ІСР на зразок $MakeExe(). Без повного шляху %s буде шукатись у PATH." msgstr "Можна використовувати макроси ІСР на зразок $MakeExe(). Без повного шляху %s буде шукатись у PATH."
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"
msgid "Pas2JS WebServers" msgid "Pas2JS WebServers"

View File

@ -220,6 +220,10 @@ msgstr ""
msgid "Use this URL to start application" msgid "Use this URL to start application"
msgstr "" msgstr ""
#: strpas2jsdesign.pjsdusewasiapplicationobject
msgid "Host webassembly program"
msgstr ""
#: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory #: strpas2jsdesign.pjsdvisualstudiocodeextensiontemplatedirectory
msgid "Visual Studio Code extension template directory" msgid "Visual Studio Code extension template directory"
msgstr "" msgstr ""
@ -243,6 +247,10 @@ msgstr ""
msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH." msgid "You can use IDE macros like $MakeExe(). Without a full path, %s is searched in PATH."
msgstr "" msgstr ""
#: strpas2jsdesign.pjswasiprogramfiletexthint
msgid "Name of your webassembly file"
msgstr ""
#: strpas2jsdesign.spasjswebservercaption #: strpas2jsdesign.spasjswebservercaption
#, fuzzy #, fuzzy
msgctxt "strpas2jsdesign.spasjswebservercaption" msgctxt "strpas2jsdesign.spasjswebservercaption"

View File

@ -30,7 +30,8 @@ type
baoUseBrowserConsole, // use browserconsole unit to display Writeln() baoUseBrowserConsole, // use browserconsole unit to display Writeln()
baoStartServer, // Start simple server baoStartServer, // Start simple server
baoUseURL, // Use this URL to run/show project in browser baoUseURL, // Use this URL to run/show project in browser
baoShowException // let RTL show uncaught exceptions baoShowException, // let RTL show uncaught exceptions
baoUseWASI // Use WASI browser app object
); );
TBrowserApplicationOptions = set of TBrowserApplicationOption; TBrowserApplicationOptions = set of TBrowserApplicationOption;
@ -39,6 +40,7 @@ type
FOptions: TBrowserApplicationOptions; FOptions: TBrowserApplicationOptions;
FProjectPort: integer; FProjectPort: integer;
FProjectURL: String; FProjectURL: String;
FProjectWasmURL : String;
protected protected
function CreateHTMLFile(AProject: TLazProject; AFileName: String function CreateHTMLFile(AProject: TLazProject; AFileName: String
): TLazProjectFile; virtual; ): TLazProjectFile; virtual;
@ -337,10 +339,12 @@ begin
UseBrowserConsole:=CO(baoUseBrowserConsole); UseBrowserConsole:=CO(baoUseBrowserConsole);
StartHTTPServer:=CO(baoStartServer); StartHTTPServer:=CO(baoStartServer);
UseRunOnReady:=CO(baoRunOnReady); UseRunOnReady:=CO(baoRunOnReady);
UseWASI:=CO(baoUseWASI);
ShowUncaughtExceptions:=CO(baoShowException); ShowUncaughtExceptions:=CO(baoShowException);
// We allocate the new port in all cases. // We allocate the new port in all cases.
ServerPort:=GetNextPort; ServerPort:=GetNextPort;
URL:=''; URL:='';
WasmProgramURL:='';
if Not CO(baoStartServer) then if Not CO(baoStartServer) then
UseURL:=CO(baoUseURL); UseURL:=CO(baoUseURL);
Result:=ShowModal; Result:=ShowModal;
@ -353,6 +357,7 @@ begin
SO(StartHTTPServer,baoStartServer); SO(StartHTTPServer,baoStartServer);
SO(UseRunOnReady,baoRunOnReady); SO(UseRunOnReady,baoRunOnReady);
SO(ShowUncaughtExceptions,baoShowException); SO(ShowUncaughtExceptions,baoShowException);
SO(UseWASI,baoUseWASI);
DebugLN(['Start server:', CO(baoStartServer)]); DebugLN(['Start server:', CO(baoStartServer)]);
if CO(baoStartServer) then if CO(baoStartServer) then
begin begin
@ -362,10 +367,11 @@ begin
else else
begin begin
UseURL:=CO(baoUseURL); UseURL:=CO(baoUseURL);
if CO(baoUseURL) then if UseURL then
URL:=''; FProjectURL:=URL;
end; end;
end; end;
FProjectWasmURL:=WasmProgramURL;
finally finally
Free; Free;
end; end;
@ -465,7 +471,11 @@ begin
if baoUseBrowserConsole in Options then if baoUseBrowserConsole in Options then
Units:=' browserconsole,'; Units:=' browserconsole,';
if baoUseBrowserApp in Options then if baoUseBrowserApp in Options then
begin
Units:=Units+' browserapp,' ; Units:=Units+' browserapp,' ;
if baoUseWASI in options then
Units:=Units+' wasihostapp,' ;
end;
Units:=Units+' JS, Classes, SysUtils, Web'; Units:=Units+' JS, Classes, SysUtils, Web';
Src:=TStringList.Create; Src:=TStringList.Create;
try try
@ -480,6 +490,9 @@ begin
if baoUseBrowserApp in Options then if baoUseBrowserApp in Options then
begin begin
Add('Type'); Add('Type');
if baoUseWASI in Options then
Add(' TMyApplication = Class(TWASIHostApplication)')
else
Add(' TMyApplication = Class(TBrowserApplication)'); Add(' TMyApplication = Class(TBrowserApplication)');
AddLn(' procedure doRun; override'); AddLn(' procedure doRun; override');
AddLn(' end'); AddLn(' end');
@ -487,6 +500,13 @@ begin
AddLn('Procedure TMyApplication.doRun'); AddLn('Procedure TMyApplication.doRun');
Add(''); Add('');
Add('begin'); Add('begin');
if baoUseWASI in Options then
begin
if FProjectWasmURL='' then
FProjectWasmURL:='yourwebassembly.wasm';
AddLn(Format(' StartWebAssembly(''%s'')',[FProjectWasmURL]));
end
else
Add(' // Your code here'); Add(' // Your code here');
AddLn(' Terminate'); AddLn(' Terminate');
AddLn('end'); AddLn('end');

View File

@ -81,7 +81,8 @@ Resourcestring
pjsdPas2JSBrowserProjectOptions = 'Pas2JS Browser project options'; pjsdPas2JSBrowserProjectOptions = 'Pas2JS Browser project options';
pjsdCreateInitialHTMLPage = 'Create initial HTML page'; pjsdCreateInitialHTMLPage = 'Create initial HTML page';
pjsdUseBrowserApplicationObject = 'Use Browser Application object'; pjsdUseBrowserApplicationObject = 'Use Browser Application object';
pjsdUseWASIApplicationObject = 'Host webassembly program';
pjsWasiProgramFileTextHint = 'Name of your webassembly file';
// New NodeJS project options form // New NodeJS project options form
pjsdNodeJSProjectOptions = 'NodeJS project options'; pjsdNodeJSProjectOptions = 'NodeJS project options';