Browse Source

* store the current verbosity as part of the settings so that they're stored as part of a generic token stream as well

Sven/Sarah Barth 7 months ago
parent
commit
558a7ef1ed
4 changed files with 18 additions and 5 deletions
  1. 4 0
      compiler/globals.pas
  2. 1 1
      compiler/ppu.pas
  3. 12 4
      compiler/scanner.pas
  4. 1 0
      compiler/utils/ppuutils/ppudump.pp

+ 4 - 0
compiler/globals.pas

@@ -179,6 +179,8 @@ Const
          packrecords     : shortint;
          packrecords     : shortint;
          maxfpuregisters : shortint;
          maxfpuregisters : shortint;
 
 
+         verbosity       : longint;
+
          cputype,
          cputype,
          optimizecputype,
          optimizecputype,
          asmcputype      : tcputype;
          asmcputype      : tcputype;
@@ -514,6 +516,8 @@ Const
 {$endif i8086}
 {$endif i8086}
         maxfpuregisters : 0;
         maxfpuregisters : 0;
 
 
+        verbosity : V_Default;
+
 { Note: GENERIC_CPU is used together with generic subdirectory to
 { Note: GENERIC_CPU is used together with generic subdirectory to
   be able to compile some of the units without any real CPU.
   be able to compile some of the units without any real CPU.
   This is used to generate a CPU independant PPUDUMP utility. PM }
   This is used to generate a CPU independant PPUDUMP utility. PM }

+ 1 - 1
compiler/ppu.pas

@@ -48,7 +48,7 @@ const
   CurrentPPUVersion = 208;
   CurrentPPUVersion = 208;
   { for any other changes to the ppu format, increase this version number
   { for any other changes to the ppu format, increase this version number
     (it's a cardinal) }
     (it's a cardinal) }
-  CurrentPPULongVersion = 27;
+  CurrentPPULongVersion = 28;
 
 
 { unit flags }
 { unit flags }
   uf_big_endian          = $000004;
   uf_big_endian          = $000004;

+ 12 - 4
compiler/scanner.pas

@@ -91,11 +91,12 @@ interface
          tokenbuf_needs_swapping : boolean;
          tokenbuf_needs_swapping : boolean;
          next     : treplaystack;
          next     : treplaystack;
          pending  : tpendingstate;
          pending  : tpendingstate;
+         verbosity : longint;
          constructor Create(atoken: ttoken;aidtoken:ttoken;
          constructor Create(atoken: ttoken;aidtoken:ttoken;
            const aorgpattern,apattern:string;const acstringpattern:ansistring;
            const aorgpattern,apattern:string;const acstringpattern:ansistring;
            apatternw:pcompilerwidestring;asettings:tsettings;
            apatternw:pcompilerwidestring;asettings:tsettings;
            atokenbuf:tdynamicarray;change_endian:boolean;const apending:tpendingstate;
            atokenbuf:tdynamicarray;change_endian:boolean;const apending:tpendingstate;
-           anext:treplaystack);
+           averbosity:longint;anext:treplaystack);
          destructor destroy;override;
          destructor destroy;override;
        end;
        end;
 
 
@@ -2974,7 +2975,8 @@ type
     constructor treplaystack.Create(atoken:ttoken;aidtoken:ttoken;
     constructor treplaystack.Create(atoken:ttoken;aidtoken:ttoken;
       const aorgpattern,apattern:string;const acstringpattern:ansistring;
       const aorgpattern,apattern:string;const acstringpattern:ansistring;
       apatternw:pcompilerwidestring;asettings:tsettings;
       apatternw:pcompilerwidestring;asettings:tsettings;
-      atokenbuf:tdynamicarray;change_endian:boolean;const apending:tpendingstate;anext:treplaystack);
+      atokenbuf:tdynamicarray;change_endian:boolean;const apending:tpendingstate;
+      averbosity:longint;anext:treplaystack);
       begin
       begin
         token:=atoken;
         token:=atoken;
         idtoken:=aidtoken;
         idtoken:=aidtoken;
@@ -2989,6 +2991,7 @@ type
           end;
           end;
         settings:=asettings;
         settings:=asettings;
         pending:=apending;
         pending:=apending;
+        verbosity:=averbosity;
         tokenbuf:=atokenbuf;
         tokenbuf:=atokenbuf;
         tokenbuf_needs_swapping:=change_endian;
         tokenbuf_needs_swapping:=change_endian;
         next:=anext;
         next:=anext;
@@ -3450,10 +3453,10 @@ type
               >0: round to this size }
               >0: round to this size }
             setalloc:=tokenreadshortint;
             setalloc:=tokenreadshortint;
             packenum:=tokenreadshortint;
             packenum:=tokenreadshortint;
-
             packrecords:=tokenreadshortint;
             packrecords:=tokenreadshortint;
             maxfpuregisters:=tokenreadshortint;
             maxfpuregisters:=tokenreadshortint;
 
 
+            verbosity:=tokenreadlongint;
 
 
             cputype:=tcputype(tokenreadenum(sizeof(tcputype)));
             cputype:=tcputype(tokenreadenum(sizeof(tcputype)));
             optimizecputype:=tcputype(tokenreadenum(sizeof(tcputype)));
             optimizecputype:=tcputype(tokenreadenum(sizeof(tcputype)));
@@ -3537,6 +3540,7 @@ type
             tokenwriteshortint(packenum);
             tokenwriteshortint(packenum);
             tokenwriteshortint(packrecords);
             tokenwriteshortint(packrecords);
             tokenwriteshortint(maxfpuregisters);
             tokenwriteshortint(maxfpuregisters);
+            tokenwritelongint(verbosity);
 
 
             tokenwriteenum(cputype,sizeof(tcputype));
             tokenwriteenum(cputype,sizeof(tcputype));
             tokenwriteenum(optimizecputype,sizeof(tcputype));
             tokenwriteenum(optimizecputype,sizeof(tcputype));
@@ -3581,6 +3585,8 @@ type
         if not assigned(recordtokenbuf) then
         if not assigned(recordtokenbuf) then
           internalerror(200511176);
           internalerror(200511176);
         t:=_GENERICSPECIALTOKEN;
         t:=_GENERICSPECIALTOKEN;
+        { ensure that all fields of settings are up to date }
+        current_settings.verbosity:=status.verbosity;
         { settings changed? }
         { settings changed? }
         { last field pmessage is handled separately below in
         { last field pmessage is handled separately below in
           ST_LOADMESSAGES }
           ST_LOADMESSAGES }
@@ -3714,7 +3720,7 @@ type
         { save current scanner state }
         { save current scanner state }
         replaystack:=treplaystack.create(token,idtoken,orgpattern,pattern,
         replaystack:=treplaystack.create(token,idtoken,orgpattern,pattern,
           cstringpattern,patternw,current_settings,replaytokenbuf,change_endian_for_replay,
           cstringpattern,patternw,current_settings,replaytokenbuf,change_endian_for_replay,
-          pendingstate,replaystack);
+          pendingstate,status.verbosity,replaystack);
 {$ifdef check_inputpointer_limits}
 {$ifdef check_inputpointer_limits}
         if assigned(hidden_inputpointer) then
         if assigned(hidden_inputpointer) then
           dec_inputpointer;
           dec_inputpointer;
@@ -3781,6 +3787,7 @@ type
             pendingstate:=replaystack.pending;
             pendingstate:=replaystack.pending;
             if assigned(pendingstate.nextmessagerecord) then
             if assigned(pendingstate.nextmessagerecord) then
               FreeLocalVerbosity(pendingstate.nextmessagerecord);
               FreeLocalVerbosity(pendingstate.nextmessagerecord);
+            recordpendingverbosityfullswitch(replaystack.verbosity);
             pendingstate.nextmessagerecord:=current_settings.pmessage;
             pendingstate.nextmessagerecord:=current_settings.pmessage;
             current_settings.pmessage:=nil;
             current_settings.pmessage:=nil;
             popreplaystack;
             popreplaystack;
@@ -3865,6 +3872,7 @@ type
                         replaytokenbuf.read(current_settings,copy_size);
                         replaytokenbuf.read(current_settings,copy_size);
                         }
                         }
                         tokenreadsettings(current_settings,copy_size);
                         tokenreadsettings(current_settings,copy_size);
+                        recordpendingverbosityfullswitch(current_settings.verbosity);
                       end;
                       end;
                     ST_LOADMESSAGES:
                     ST_LOADMESSAGES:
                       begin
                       begin

+ 1 - 0
compiler/utils/ppuutils/ppudump.pp

@@ -2620,6 +2620,7 @@ const
        writeln(['Pack enums ',new_settings.packenum]);
        writeln(['Pack enums ',new_settings.packenum]);
        writeln(['Pack records ',new_settings.packrecords]);
        writeln(['Pack records ',new_settings.packrecords]);
        writeln(['Max FPU registers ',new_settings.maxfpuregisters]);
        writeln(['Max FPU registers ',new_settings.maxfpuregisters]);
+       writeln('Verbosity '+hexstr(new_settings.verbosity,8));
 
 
        writeln(['CPU type ',new_settings.cputype]);
        writeln(['CPU type ',new_settings.cputype]);
        writeln(['CPU optimize type ',new_settings.optimizecputype]);
        writeln(['CPU optimize type ',new_settings.optimizecputype]);