Browse Source

* -JRnone disables resource parsing altogether

git-svn-id: trunk@47375 -
michael 4 years ago
parent
commit
e6b327b920

+ 4 - 2
packages/fcl-passrc/src/pscanner.pp

@@ -656,7 +656,8 @@ type
     po_ExtConstWithoutExpr,  // allow typed const without expression in external class and with external modifier
     po_StopOnUnitInterface,  // parse only a unit name and stop at interface keyword
     po_IgnoreUnknownResource,// Ignore resources for which no handler is registered.
-    po_AsyncProcs            // allow async procedure modifier
+    po_AsyncProcs,            // allow async procedure modifier
+    po_DisableResources      // Disable resources altogether
     );
   TPOptions = set of TPOption;
 
@@ -4087,7 +4088,8 @@ begin
       'POINTERMATH':
         DoBoolDirective(bsPointerMath);
       'R' :
-        HandleResource(Param);
+        if not (po_DisableResources in Options) then
+          HandleResource(Param);
       'RANGECHECKS':
         DoBoolDirective(bsRangeChecks);
       'SCOPEDENUMS':

+ 5 - 3
packages/pastojs/src/pas2jscompiler.pp

@@ -154,7 +154,7 @@ type
     rvcUnit
     );
   TP2JSResourceStringFile = (rsfNone,rsfUnit,rsfProgram);
-  TResourceMode = (rmNone,rmHTML,rmJS);
+  TResourceMode = (Skip,rmNone,rmHTML,rmJS);
 
 const
   DefaultP2jsCompilerOptions = [coShowErrors,coWriteableConst,coUseStrict,coSourceMapXSSIHeader];
@@ -1101,6 +1101,8 @@ begin
   Scanner.CurrentValueSwitch[vsInterfaces]:=InterfaceTypeNames[Compiler.InterfaceType];
   if coAllowCAssignments in Compiler.Options then
     Scanner.Options:=Scanner.Options+[po_cassignments];
+  if Compiler.ResourceMode=rmNone then
+    Scanner.Options:= Scanner.Options+[po_DisableResources];
   // Note: some Scanner.Options are set by TPasResolver
   for i:=0 to Compiler.Defines.Count-1 do
     begin
@@ -4717,8 +4719,8 @@ begin
   w('     -Jrnone: Do not write resource string file');
   w('     -Jrunit: Write resource string file per unit with all resource strings');
   w('     -Jrprogram: Write resource string file per program with all used resource strings in program');
-  w('   -Jr<x> Control writing of linked resources');
-  w('     -JRnone: Do not write resources');
+  w('   -JR<x> Control writing of linked resources');
+  w('     -JRnone: Skip resource directives');
   w('     -JRjs: Write resources in Javascript structure');
   w('     -JRhtml[=filename] : Write resources as preload links in HTML file (default is projectfile-res.html)');
   w('   -Jpcmd<command>: Run postprocessor. For each generated js execute command passing the js as stdin and read the new js from stdout. This option can be added multiple times to call several postprocessors in succession.');

+ 2 - 1
packages/pastojs/src/pas2jsfiler.pp

@@ -134,7 +134,8 @@ const
     'ExtClassConstWithoutExpr',
     'StopOnUnitInterface',
     'IgnoreUnknownResource',
-    'AsyncProcs');
+    'AsyncProcs',
+    'DisableResources');
 
   PCUDefaultModeSwitches: TModeSwitches = [
     msObjfpc,