Przeglądaj źródła

* FCL-Base namespaced version

Michaël Van Canneyt 1 rok temu
rodzic
commit
6637b6307b

+ 3 - 0
packages/fcl-base/namespaced/Browser.DebugCapture.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Browser.DebugCapture;
+{$include ../src/debugcapture.pas}

+ 3 - 0
packages/fcl-base/namespaced/Fcl.App.Browser.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Fcl.App.Browser;
+{$include ../src/browserapp.pas}

+ 3 - 0
packages/fcl-base/namespaced/Fcl.App.NodeJs.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Fcl.App.NodeJs;
+{$include ../src/nodejsapp.pas}

+ 3 - 0
packages/fcl-base/namespaced/Fcl.App.ServiceWorker.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Fcl.App.ServiceWorker;
+{$include ../src/serviceworkerapp.pas}

+ 3 - 0
packages/fcl-base/namespaced/Fcl.CustApp.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Fcl.CustApp;
+{$include ../src/custapp.pas}

+ 3 - 0
packages/fcl-base/namespaced/Fcl.Expressions.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Fcl.Expressions;
+{$include ../src/fpexprpars.pas}

+ 3 - 0
packages/fcl-base/namespaced/Pascal.CodeGenerator.pas

@@ -0,0 +1,3 @@
+{$DEFINE FPC_DOTTEDUNITS}
+unit Pascal.CodeGenerator;
+{$include ../src/pascodegen.pp}

+ 79 - 0
packages/fcl-base/namespaced/fcl_base_pas2js_namespaced.lpk

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <Package Version="5">
+    <Name Value="fcl_base_pas2js_namespaced"/>
+    <Type Value="RunTimeOnly"/>
+    <Author Value="Mattias Gaertner"/>
+    <AutoUpdate Value="Manually"/>
+    <CompilerOptions>
+      <Version Value="11"/>
+      <SearchPaths>
+        <UnitOutputDirectory Value="."/>
+      </SearchPaths>
+      <Parsing>
+        <SyntaxOptions>
+          <AllowLabel Value="False"/>
+          <UseAnsiStrings Value="False"/>
+        </SyntaxOptions>
+      </Parsing>
+      <Linking>
+        <Debugging>
+          <GenerateDebugInfo Value="False"/>
+        </Debugging>
+      </Linking>
+      <Other>
+        <CustomOptions Value="-Jc"/>
+        <CompilerPath Value="$(pas2js)"/>
+        <ExecuteBefore>
+          <Command Value="$MakeExe(IDE,pas2js) -O- -Jc -vbq fcl_base_pas2js_namespaced.pas"/>
+          <Parsers Count="1">
+            <Item1 Value="Pas2JS"/>
+          </Parsers>
+        </ExecuteBefore>
+      </Other>
+      <SkipCompiler Value="True"/>
+    </CompilerOptions>
+    <Description Value="Free Pascal Component Library - Base
+Port to pas2js."/>
+    <License Value="Modified LGPL-2"/>
+    <Version Major="1"/>
+    <Files Count="6">
+      <Item1>
+        <Filename Value="Fcl.CustApp.pas"/>
+        <UnitName Value="Fcl.CustApp"/>
+      </Item1>
+      <Item2>
+        <Filename Value="Fcl.App.NodeJs.pas"/>
+        <UnitName Value="Fcl.App.NodeJs"/>
+      </Item2>
+      <Item3>
+        <Filename Value="Fcl.App.Browser.pas"/>
+        <UnitName Value="Fcl.App.Browser"/>
+      </Item3>
+      <Item4>
+        <Filename Value="Fcl.Expressions.pas"/>
+        <UnitName Value="Fcl.Expressions"/>
+      </Item4>
+      <Item5>
+        <Filename Value="Fcl.App.ServiceWorker.pas"/>
+        <UnitName Value="Fcl.App.ServiceWorker"/>
+      </Item5>
+      <Item6>
+        <Filename Value="Pascal.CodeGenerator.pas"/>
+        <UnitName Value="Pascal.CodeGenerator"/>
+      </Item6>
+    </Files>
+    <CompatibilityMode Value="True"/>
+    <RequiredPkgs Count="1">
+      <Item1>
+        <PackageName Value="pas2js_rtl"/>
+      </Item1>
+    </RequiredPkgs>
+    <UsageOptions>
+      <UnitPath Value="$(PkgOutDir)"/>
+    </UsageOptions>
+    <PublishOptions>
+      <Version Value="2"/>
+    </PublishOptions>
+  </Package>
+</CONFIG>

+ 15 - 0
packages/fcl-base/namespaced/fcl_base_pas2js_namespaced.pas

@@ -0,0 +1,15 @@
+{ This file was automatically created by Lazarus. Do not edit!
+  This source is only used to compile and install the package.
+ }
+
+unit fcl_base_pas2js_namespaced;
+
+{$warn 5023 off : no warning about unused units}
+interface
+
+uses
+  Fcl.CustApp, Fcl.App.NodeJs, Fcl.App.Browser, Fcl.Expressions, Fcl.App.ServiceWorker, Pascal.CodeGenerator;
+
+implementation
+
+end.

+ 22 - 0
packages/fcl-base/browserapp.pas → packages/fcl-base/src/browserapp.pas

@@ -1,11 +1,33 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2003 by the Free Pascal development team
+
+    Pascal code generator class.
+
+    Port to pas2js by Mattias Gaertner [email protected]
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit BrowserApp;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, System.Types, JSApi.JS, BrowserApi.Web, Fcl.CustApp;
+{$ELSE}
   Classes, SysUtils, Types, JS, web, CustApp;
+{$ENDIF}
 
 type
   TServiceWorkerRegisteredEvent = reference to procedure(Registration: TJSServiceWorkerRegistration);

+ 7 - 1
packages/fcl-base/custapp.pas → packages/fcl-base/src/custapp.pas

@@ -14,14 +14,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit CustApp;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, System.Types, JSApi.JS;
+{$ELSE}
   Classes, SysUtils, Types, JS;
+{$ENDIF}
 
 Const
   SErrInvalidOption: String = 'Invalid option at position %s: "%s"';
@@ -234,7 +240,7 @@ begin
       end
       else begin
         ExceptObject:=nil;
-        ExceptObjectJS := JS.JSExceptValue;
+        ExceptObjectJS := {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.JSExceptValue;
         HandleException(Self);
       end;
     end;

+ 6 - 1
packages/fcl-base/debugcapture.pas → packages/fcl-base/src/debugcapture.pas

@@ -12,15 +12,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
-
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit debugcapture;
+{$ENDIF}
 
 {$mode ObjFPC}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Types, System.Classes, System.SysUtils;
+{$ELSE}
   Types, Classes, SysUtils;
+{$ENDIF}
 
 Const
   DefaultURL = '/debugcapture';

+ 10 - 3
packages/fcl-base/fcl_base_pas2js.lpk → packages/fcl-base/src/fcl_base_pas2js.lpk

@@ -24,7 +24,14 @@
       <Other>
         <CustomOptions Value="-Jc"/>
         <CompilerPath Value="$(pas2js)"/>
+        <ExecuteBefore>
+          <Command Value="$MakeExe(IDE,pas2js) -O- -Jc -vbq fcl_base_pas2js.pas"/>
+          <Parsers Count="1">
+            <Item1 Value="Pas2JS"/>
+          </Parsers>
+        </ExecuteBefore>
       </Other>
+      <SkipCompiler Value="True"/>
     </CompilerOptions>
     <Description Value="Free Pascal Component Library - Base
 Port to pas2js."/>
@@ -33,15 +40,15 @@ Port to pas2js."/>
     <Files Count="5">
       <Item1>
         <Filename Value="custapp.pas"/>
-        <UnitName Value="custapp"/>
+        <UnitName Value="CustApp"/>
       </Item1>
       <Item2>
         <Filename Value="nodejsapp.pas"/>
-        <UnitName Value="nodejsapp"/>
+        <UnitName Value="NodeJSApp"/>
       </Item2>
       <Item3>
         <Filename Value="browserapp.pas"/>
-        <UnitName Value="browserapp"/>
+        <UnitName Value="BrowserApp"/>
       </Item3>
       <Item4>
         <Filename Value="fpexprpars.pas"/>

+ 1 - 1
packages/fcl-base/fcl_base_pas2js.pas → packages/fcl-base/src/fcl_base_pas2js.pas

@@ -8,7 +8,7 @@ unit fcl_base_pas2js;
 interface
 
 uses
-  CustApp, NodeJSApp, browserapp;
+  CustApp, NodeJSApp, BrowserApp, fpexprpars, ServiceWorkerApp;
 
 implementation
 

+ 14 - 2
packages/fcl-base/fpexprpars.pas → packages/fcl-base/src/fpexprpars.pas

@@ -13,14 +13,21 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
+unit fpexprpars;
+{$ENDIF}
+
 {$mode objfpc}
 {$h+}
-unit fpexprpars;
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, System.Contnrs;
+{$ELSE}
   Classes, SysUtils, contnrs;
+{$ENDIF}
 
 Type
   // tokens
@@ -801,7 +808,12 @@ function ArgToFloat(Arg: TFPExpressionResult): TExprFloat;
 
 implementation
 
-uses typinfo;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Typinfo;
+{$ELSE}
+  typinfo;
+{$ENDIF}
 
 { TFPExpressionParser }
 

+ 6 - 0
packages/fcl-base/nodejsapp.pas → packages/fcl-base/src/nodejsapp.pas

@@ -14,14 +14,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit NodeJSApp;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFNDEF FPC_DOTTEDUNITS} 
+  NodeApi.JS, System.Classes, System.SysUtils, System.Types, JSApi.JS, Fcl.CustApp;
+{$ELSE}
   NodeJS, Classes, SysUtils, Types, JS, CustApp;
+{$ENDIF}
 
 type
   

+ 24 - 0
packages/fcl-base/pascodegen.pp → packages/fcl-base/src/pascodegen.pp

@@ -1,11 +1,33 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2003 by the Free Pascal development team
+
+    Pascal code generator class.
+
+    Port to pas2js by Mattias Gaertner [email protected]
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit pascodegen;
+{$ENDIF}
 
 {$mode objfpc}{$H+}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils;
+{$ELSE}
   Classes, SysUtils;
+{$ENDIF}
 
 Type
   TCodegenLogType = (cltInfo);
@@ -77,6 +99,8 @@ Type
   end;
 
 implementation
+
+
 { TPascalCodeGenerator }
 procedure TPascalCodeGenerator.Indent;
 begin

+ 25 - 2
packages/fcl-base/serviceworkerapp.pas → packages/fcl-base/src/serviceworkerapp.pas

@@ -1,15 +1,38 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2003 by the Free Pascal development team
+
+    Service Worker Application class.
+
+    Port to pas2js by Mattias Gaertner [email protected]
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
 {
   A service worker functions like a proxy server, allowing to modify requests
   and responses, and replace them with items from its own cache, and more.
 }
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit ServiceWorkerApp;
+{$ENDIF}
 
 {$mode objfpc}
 
 interface
 
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, System.Types, JSApi.JS, BrowserApi.WebOrWorker, BrowserApi.Worker, Fcl.CustApp;
+{$ELSE}
   Classes, SysUtils, Types, JS, weborworker, webworker, CustApp;
+{$ENDIF}
 
 type
 
@@ -151,10 +174,10 @@ begin
     // when even the fallback response is not available,
     // there is nothing we can do, but we must always
     // return a Response object
-    Result:=TJSResponse.new('Network error happened', js.new([
+    Result:=TJSResponse.new('Network error happened', {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.new([
       'status', 408,
       'headers',
-        js.new(['Content-Type', 'text/plain' ])
+        {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.new(['Content-Type', 'text/plain' ])
       ]) );
   end;
 end;