소스 검색

* FCL-Base namespaced version

Michaël Van Canneyt 1 년 전
부모
커밋
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;
 unit BrowserApp;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, System.Types, JSApi.JS, BrowserApi.Web, Fcl.CustApp;
+{$ELSE}
   Classes, SysUtils, Types, JS, web, CustApp;
   Classes, SysUtils, Types, JS, web, CustApp;
+{$ENDIF}
 
 
 type
 type
   TServiceWorkerRegisteredEvent = reference to procedure(Registration: TJSServiceWorkerRegistration);
   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.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit CustApp;
 unit CustApp;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, System.Types, JSApi.JS;
+{$ELSE}
   Classes, SysUtils, Types, JS;
   Classes, SysUtils, Types, JS;
+{$ENDIF}
 
 
 Const
 Const
   SErrInvalidOption: String = 'Invalid option at position %s: "%s"';
   SErrInvalidOption: String = 'Invalid option at position %s: "%s"';
@@ -234,7 +240,7 @@ begin
       end
       end
       else begin
       else begin
         ExceptObject:=nil;
         ExceptObject:=nil;
-        ExceptObjectJS := JS.JSExceptValue;
+        ExceptObjectJS := {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.JSExceptValue;
         HandleException(Self);
         HandleException(Self);
       end;
       end;
     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.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
-
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit debugcapture;
 unit debugcapture;
+{$ENDIF}
 
 
 {$mode ObjFPC}
 {$mode ObjFPC}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Types, System.Classes, System.SysUtils;
+{$ELSE}
   Types, Classes, SysUtils;
   Types, Classes, SysUtils;
+{$ENDIF}
 
 
 Const
 Const
   DefaultURL = '/debugcapture';
   DefaultURL = '/debugcapture';

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

@@ -24,7 +24,14 @@
       <Other>
       <Other>
         <CustomOptions Value="-Jc"/>
         <CustomOptions Value="-Jc"/>
         <CompilerPath Value="$(pas2js)"/>
         <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>
       </Other>
+      <SkipCompiler Value="True"/>
     </CompilerOptions>
     </CompilerOptions>
     <Description Value="Free Pascal Component Library - Base
     <Description Value="Free Pascal Component Library - Base
 Port to pas2js."/>
 Port to pas2js."/>
@@ -33,15 +40,15 @@ Port to pas2js."/>
     <Files Count="5">
     <Files Count="5">
       <Item1>
       <Item1>
         <Filename Value="custapp.pas"/>
         <Filename Value="custapp.pas"/>
-        <UnitName Value="custapp"/>
+        <UnitName Value="CustApp"/>
       </Item1>
       </Item1>
       <Item2>
       <Item2>
         <Filename Value="nodejsapp.pas"/>
         <Filename Value="nodejsapp.pas"/>
-        <UnitName Value="nodejsapp"/>
+        <UnitName Value="NodeJSApp"/>
       </Item2>
       </Item2>
       <Item3>
       <Item3>
         <Filename Value="browserapp.pas"/>
         <Filename Value="browserapp.pas"/>
-        <UnitName Value="browserapp"/>
+        <UnitName Value="BrowserApp"/>
       </Item3>
       </Item3>
       <Item4>
       <Item4>
         <Filename Value="fpexprpars.pas"/>
         <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
 interface
 
 
 uses
 uses
-  CustApp, NodeJSApp, browserapp;
+  CustApp, NodeJSApp, BrowserApp, fpexprpars, ServiceWorkerApp;
 
 
 implementation
 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.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
+unit fpexprpars;
+{$ENDIF}
+
 {$mode objfpc}
 {$mode objfpc}
 {$h+}
 {$h+}
-unit fpexprpars;
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils, System.Contnrs;
+{$ELSE}
   Classes, SysUtils, contnrs;
   Classes, SysUtils, contnrs;
+{$ENDIF}
 
 
 Type
 Type
   // tokens
   // tokens
@@ -801,7 +808,12 @@ function ArgToFloat(Arg: TFPExpressionResult): TExprFloat;
 
 
 implementation
 implementation
 
 
-uses typinfo;
+uses 
+{$IFDEF FPC_DOTTEDUNITS}
+  System.Typinfo;
+{$ELSE}
+  typinfo;
+{$ENDIF}
 
 
 { TFPExpressionParser }
 { 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.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit NodeJSApp;
 unit NodeJSApp;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFNDEF FPC_DOTTEDUNITS} 
+  NodeApi.JS, System.Classes, System.SysUtils, System.Types, JSApi.JS, Fcl.CustApp;
+{$ELSE}
   NodeJS, Classes, SysUtils, Types, JS, CustApp;
   NodeJS, Classes, SysUtils, Types, JS, CustApp;
+{$ENDIF}
 
 
 type
 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;
 unit pascodegen;
+{$ENDIF}
 
 
 {$mode objfpc}{$H+}
 {$mode objfpc}{$H+}
 
 
 interface
 interface
 
 
 uses
 uses
+{$IFDEF FPC_DOTTEDUNITS} 
+  System.Classes, System.SysUtils;
+{$ELSE}
   Classes, SysUtils;
   Classes, SysUtils;
+{$ENDIF}
 
 
 Type
 Type
   TCodegenLogType = (cltInfo);
   TCodegenLogType = (cltInfo);
@@ -77,6 +99,8 @@ Type
   end;
   end;
 
 
 implementation
 implementation
+
+
 { TPascalCodeGenerator }
 { TPascalCodeGenerator }
 procedure TPascalCodeGenerator.Indent;
 procedure TPascalCodeGenerator.Indent;
 begin
 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
   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.
   and responses, and replace them with items from its own cache, and more.
 }
 }
+{$IFNDEF FPC_DOTTEDUNITS} 
 unit ServiceWorkerApp;
 unit ServiceWorkerApp;
+{$ENDIF}
 
 
 {$mode objfpc}
 {$mode objfpc}
 
 
 interface
 interface
 
 
 uses
 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;
   Classes, SysUtils, Types, JS, weborworker, webworker, CustApp;
+{$ENDIF}
 
 
 type
 type
 
 
@@ -151,10 +174,10 @@ begin
     // when even the fallback response is not available,
     // when even the fallback response is not available,
     // there is nothing we can do, but we must always
     // there is nothing we can do, but we must always
     // return a Response object
     // 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,
       'status', 408,
       'headers',
       'headers',
-        js.new(['Content-Type', 'text/plain' ])
+        {$IFDEF FPC_DOTTEDUNITS}JSApi.{$ENDIF}JS.new(['Content-Type', 'text/plain' ])
       ]) );
       ]) );
   end;
   end;
 end;
 end;