Browse Source

nodepas2js: fixed loading default cfg

git-svn-id: trunk@40509 -
Mattias Gaertner 6 years ago
parent
commit
a97fd7e819

+ 4 - 10
packages/pastojs/src/pas2jscompiler.pp

@@ -713,7 +713,6 @@ end;
 
 { TPas2JSCompilerSupport }
 
-
 constructor TPas2JSCompilerSupport.Create(aCompiler: TPas2JSCompiler);
 begin
   FCompiler:=aCompiler;
@@ -735,8 +734,6 @@ begin
   inherited Destroy;
 end;
 
-
-
 { TPCUSupport }
 
 procedure TPCUSupport.RaiseInternalError(id: TMaxPrecInt; Msg: string);
@@ -2641,12 +2638,10 @@ begin
 end;
 
 procedure TPas2jsCompiler.LoadConfig(CfgFilename: string);
-
 begin
   ConfigSupport.LoadConfig(CfgFileName);
 end;
 
-
 procedure TPas2JSConfigSupport.LoadConfig(Const aFileName: String);
 type
 
@@ -2837,7 +2832,6 @@ begin
     Compiler.Log.LogMsgIgnoreFilter(nEndOfReadingConfigFile,[QuoteStr(aFilename)]);
 end;
 
-
 procedure TPas2JSConfigSupport.LoadDefaultConfig;
 
 var
@@ -3082,7 +3076,7 @@ end;
 procedure TPas2jsCompiler.HandleOptionInfo(aValue: string);
 
 Var
-  infoMsg: String;
+  InfoMsg: String;
 
   procedure AppendInfo(Add: string);
   begin
@@ -3150,7 +3144,7 @@ begin
       end;
     'c':
       // write list of supported JS processors
-      for pr  in TPasToJsProcessor do
+      for pr in TPasToJsProcessor do
         Log.LogPlain(PasToJsProcessorNames[pr]);
     'o':
       begin
@@ -3168,8 +3162,8 @@ begin
     end;
     inc(p);
     end;
-  if infoMsg<>'' then
-    Log.LogPlain(infoMsg);
+  if InfoMsg<>'' then
+    Log.LogPlain(InfoMsg);
 end;
 
 procedure TPas2jsCompiler.ReadParam(Param: string; Quick, FromCmdLine: boolean);

+ 5 - 4
packages/pastojs/src/pas2jscompilercfg.pp

@@ -16,14 +16,17 @@
   Abstract:
     Config file handling for compiler, depends on filesystem.
 }
-unit pas2jscompilercfg;
+unit Pas2JSCompilerCfg;
 
 {$mode objfpc}{$H+}
 
 interface
 
 uses
-  Classes, SysUtils, pas2JSCompiler, pas2jsfs;
+  {$IFDEF NodeJS}
+  NodeJSFS,
+  {$ENDIF}
+  Classes, SysUtils, Pas2jsFileUtils, Pas2JSFS, Pas2jsCompiler;
 
 Type
   TPas2JSFileConfigSupport = Class(TPas2JSConfigSupport)
@@ -33,8 +36,6 @@ Type
 
 implementation
 
-uses pas2jsfileutils;
-
 function TPas2JSFileConfigSupport.GetReader(aFileName: string): TSourceLineReader;
 
 Var

+ 2 - 2
packages/pastojs/src/pas2jscompilerpp.pp

@@ -14,9 +14,9 @@
  **********************************************************************
 
   Abstract:
-    Pas2JS compiler Preprocessor support. Can depend on filesystem.
+    Pas2JS compiler Postprocessor support. Can depend on filesystem.
 }
-unit pas2jscompilerpp;
+unit Pas2JSCompilerPP;
 
 {$mode objfpc}{$H+}
 

+ 3 - 1
packages/pastojs/src/pas2jslibcompiler.pp

@@ -21,7 +21,9 @@ unit pas2jslibcompiler;
 interface
 
 uses
-  SysUtils, Classes, FPPJsSrcMap, Pas2jsFileCache, Pas2JSCompiler, Pas2jsPCUCompiler, pas2jscompilercfg, pas2jscompilerpp;
+  SysUtils, Classes,
+  FPPJsSrcMap, Pas2jsFileCache, Pas2JSCompiler, Pas2jsPCUCompiler,
+  Pas2JSCompilerCfg, Pas2JSCompilerPP;
 
 { ---------------------------------------------------------------------
   Compiler descendant, usable in library

+ 3 - 1
utils/pas2js/nodepas2js.pp

@@ -6,7 +6,8 @@ program nodepas2js;
 uses
   JS, NodeJSApp,
   Classes, SysUtils,
-  Pas2jsFileUtils, Pas2jsLogger, pas2jscompiler, Pas2jsfscompiler;
+  Pas2jsFileUtils, Pas2jsLogger,
+  Pas2jsCompiler, Pas2JSFSCompiler, Pas2JSCompilerCfg;
 
 type
 
@@ -66,6 +67,7 @@ begin
   inherited Create(TheOwner);
   StopOnException:=True;
   FCompiler:=TPas2jsFSCompiler.Create;
+  FCompiler.ConfigSupport:=TPas2JSFileConfigSupport.Create(FCompiler);
 end;
 
 destructor TPas2jsCLI.Destroy;

+ 2 - 1
utils/pas2js/pas2js.pp

@@ -12,7 +12,8 @@ uses
   cthreads, cwstring,
   {$ENDIF}
   Classes, SysUtils, CustApp,
-  Pas2jsFileUtils, Pas2jsLogger, Pas2jsCompiler, pas2jspcucompiler, pas2jscompilerpp, pas2JScompilercfg;
+  Pas2jsFileUtils, Pas2jsLogger, Pas2jsCompiler,
+  Pas2JSPCUCompiler, Pas2JSCompilerPP, Pas2JSCompilerCfg;
 
 Type