Quellcode durchsuchen

+ add putboolean and getboolean convenience methods to tentfile
* use putboolean and getboolean where approbiate

git-svn-id: trunk@37972 -

svenbarth vor 7 Jahren
Ursprung
Commit
d50848174a

+ 12 - 12
compiler/aasmtai.pas

@@ -1243,7 +1243,7 @@ implementation
         inherited Create;
         sym:=ppufile.getasmsymbol;
         size:=ppufile.getaint;
-        is_global:=boolean(ppufile.getbyte);
+        is_global:=ppufile.getboolean;
       end;
 
 
@@ -1252,7 +1252,7 @@ implementation
         inherited ppuwrite(ppufile);
         ppufile.putasmsymbol(sym);
         ppufile.putaint(size);
-        ppufile.putbyte(byte(is_global));
+        ppufile.putboolean(is_global);
       end;
 
 
@@ -1326,7 +1326,7 @@ implementation
         inherited ppuload(t,ppufile);
         sym:=ppufile.getasmsymbol;
         size:=ppufile.getlongint;
-        is_global:=boolean(ppufile.getbyte);
+        is_global:=ppufile.getboolean;
       end;
 
 
@@ -1335,7 +1335,7 @@ implementation
         inherited ppuwrite(ppufile);
         ppufile.putasmsymbol(sym);
         ppufile.putlongint(size);
-        ppufile.putbyte(byte(is_global));
+        ppufile.putboolean(is_global);
       end;
 
 
@@ -2423,7 +2423,7 @@ implementation
         inherited ppuload(t,ppufile);
         temppos:=ppufile.getlongint;
         tempsize:=ppufile.getlongint;
-        allocation:=boolean(ppufile.getbyte);
+        allocation:=ppufile.getboolean;
 {$ifdef EXTDEBUG}
         problem:=nil;
 {$endif EXTDEBUG}
@@ -2435,7 +2435,7 @@ implementation
         inherited ppuwrite(ppufile);
         ppufile.putlongint(temppos);
         ppufile.putlongint(tempsize);
-        ppufile.putbyte(byte(allocation));
+        ppufile.putboolean(allocation);
       end;
 
 
@@ -2503,7 +2503,7 @@ implementation
         inherited ppuload(t,ppufile);
         ppufile.getdata(reg,sizeof(Tregister));
         ratype:=tregalloctype(ppufile.getbyte);
-        keep:=boolean(ppufile.getbyte);
+        keep:=ppufile.getboolean;
       end;
 
 
@@ -2512,7 +2512,7 @@ implementation
         inherited ppuwrite(ppufile);
         ppufile.putdata(reg,sizeof(Tregister));
         ppufile.putbyte(byte(ratype));
-        ppufile.putbyte(byte(keep));
+        ppufile.putboolean(keep);
       end;
 
 
@@ -2863,7 +2863,7 @@ implementation
 {$ifdef x86}
         ppufile.getdata(segprefix,sizeof(Tregister));
 {$endif x86}
-        is_jmp:=boolean(ppufile.getbyte);
+        is_jmp:=ppufile.getboolean;
       end;
 
 
@@ -2880,7 +2880,7 @@ implementation
 {$ifdef x86}
         ppufile.putdata(segprefix,sizeof(Tregister));
 {$endif x86}
-        ppufile.putbyte(byte(is_jmp));
+        ppufile.putboolean(is_jmp);
       end;
 
 
@@ -3067,7 +3067,7 @@ implementation
         aligntype:=ppufile.getbyte;
         fillsize:=0;
         fillop:=ppufile.getbyte;
-        use_op:=boolean(ppufile.getbyte);
+        use_op:=ppufile.getboolean;
       end;
 
 
@@ -3076,7 +3076,7 @@ implementation
         inherited ppuwrite(ppufile);
         ppufile.putbyte(aligntype);
         ppufile.putbyte(fillop);
-        ppufile.putbyte(byte(use_op));
+        ppufile.putboolean(use_op);
       end;
 
 

+ 14 - 0
compiler/entfile.pas

@@ -275,6 +275,7 @@ type
     function getaword:{$ifdef generic_cpu}qword{$else}aword{$endif};
     function  getreal:entryreal;
     function  getrealsize(sizeofreal : longint):entryreal;
+    function  getboolean:boolean;inline;
     function  getstring:string;
     function  getpshortstring:pshortstring;
     function  getansistring:ansistring;
@@ -301,6 +302,7 @@ type
     procedure putptruint(v:TConstPtrUInt);
     procedure putaword(i:aword);
     procedure putreal(d:entryreal);
+    procedure putboolean(b:boolean);inline;
     procedure putstring(const s:string);
     procedure putansistring(const s:ansistring);
     procedure putnormalset(const b);
@@ -952,6 +954,12 @@ begin
 end;
 
 
+function tentryfile.getboolean:boolean;
+begin
+  result:=boolean(getbyte);
+end;
+
+
 function tentryfile.getstring:string;
 begin
   result[0]:=chr(getbyte);
@@ -1272,6 +1280,12 @@ begin
 end;
 
 
+procedure tentryfile.putboolean(b:boolean);
+begin
+  putbyte(byte(b));
+end;
+
+
 procedure tentryfile.putstring(const s:string);
   begin
     putdata(s,length(s)+1);

+ 4 - 4
compiler/fppu.pas

@@ -674,8 +674,8 @@ var
         if tmacro(p).is_used or is_initial then
           begin
             ppufile.putstring(p.name);
-            ppufile.putbyte(byte(is_initial));
-            ppufile.putbyte(byte(tmacro(p).is_used));
+            ppufile.putboolean(is_initial);
+            ppufile.putboolean(tmacro(p).is_used);
           end;
       end;
 
@@ -937,8 +937,8 @@ var
         while not ppufile.endofentry do
          begin
            hs:=ppufile.getstring;
-           was_initial:=boolean(ppufile.getbyte);
-           was_used:=boolean(ppufile.getbyte);
+           was_initial:=ppufile.getboolean;
+           was_used:=ppufile.getboolean;
            mac:=tmacro(initialmacrosymtable.Find(hs));
            if assigned(mac) then
              begin

+ 2 - 2
compiler/jvm/njvmcnv.pas

@@ -1617,14 +1617,14 @@ implementation
   constructor tjvmasnode.ppuload(t: tnodetype; ppufile: tcompilerppufile);
     begin
       inherited;
-      classreftypecast:=boolean(ppufile.getbyte);
+      classreftypecast:=ppufile.getboolean;
     end;
 
 
   procedure tjvmasnode.ppuwrite(ppufile: tcompilerppufile);
     begin
       inherited ppuwrite(ppufile);
-      ppufile.putbyte(byte(classreftypecast));
+      ppufile.putboolean(classreftypecast);
     end;
 
 

+ 4 - 4
compiler/nld.pas

@@ -1215,8 +1215,8 @@ implementation
         inherited ppuload(t,ppufile);
         ppufile.getderef(typedefderef);
         ppufile.getderef(typesymderef);
-        allowed:=boolean(ppufile.getbyte);
-        helperallowed:=boolean(ppufile.getbyte);
+        allowed:=ppufile.getboolean;
+        helperallowed:=ppufile.getboolean;
       end;
 
 
@@ -1225,8 +1225,8 @@ implementation
         inherited ppuwrite(ppufile);
         ppufile.putderef(typedefderef);
         ppufile.putderef(typesymderef);
-        ppufile.putbyte(byte(allowed));
-        ppufile.putbyte(byte(helperallowed));
+        ppufile.putboolean(allowed);
+        ppufile.putboolean(helperallowed);
       end;
 
 

+ 2 - 2
compiler/nset.pas

@@ -500,7 +500,7 @@ implementation
       var
         b : byte;
       begin
-        ppufile.putbyte(byte(p^.label_type = ltConstString));
+        ppufile.putboolean(p^.label_type = ltConstString);
         if (p^.label_type = ltConstString) then
           begin
             p^._low_str.ppuwrite(ppufile);
@@ -528,7 +528,7 @@ implementation
         p : pcaselabel;
       begin
         new(p);
-        if boolean(ppufile.getbyte) then
+        if ppufile.getboolean then
           begin
             p^.label_type := ltConstString;
             p^._low_str := cstringconstnode.ppuload(stringconstn,ppufile);

+ 8 - 8
compiler/symsym.pas

@@ -1600,7 +1600,7 @@ implementation
          varstate:=vs_readwritten;
          varspez:=tvarspez(ppufile.getbyte);
          varregable:=tvarregable(ppufile.getbyte);
-         addr_taken:=boolean(ppufile.getbyte);
+         addr_taken:=ppufile.getboolean;
          ppufile.getderef(vardefderef);
          ppufile.getsmallset(varoptions);
       end;
@@ -1632,7 +1632,7 @@ implementation
          oldintfcrc:=ppufile.do_crc;
          ppufile.do_crc:=false;
          ppufile.putbyte(byte(varregable));
-         ppufile.putbyte(byte(addr_taken));
+         ppufile.putboolean(addr_taken);
          ppufile.do_crc:=oldintfcrc;
          ppufile.putderef(vardefderef);
          ppufile.putsmallset(varoptions);
@@ -2133,7 +2133,7 @@ implementation
       begin
          inherited ppuload(paravarsym,ppufile);
          paranr:=ppufile.getword;
-         univpara:=boolean(ppufile.getbyte);
+         univpara:=ppufile.getboolean;
 
          { The var state of parameter symbols is fixed after writing them so
            we write them to the unit file.
@@ -2159,7 +2159,7 @@ implementation
       begin
          inherited ppuwrite(ppufile);
          ppufile.putword(paranr);
-         ppufile.putbyte(byte(univpara));
+         ppufile.putboolean(univpara);
 
          { The var state of parameter symbols is fixed after writing them so
            we write them to the unit file.
@@ -2698,8 +2698,8 @@ implementation
     constructor tmacro.ppuload(ppufile:tcompilerppufile);
       begin
          inherited ppuload(macrosym,ppufile);
-         defined:=boolean(ppufile.getbyte);
-         is_compiler_var:=boolean(ppufile.getbyte);
+         defined:=ppufile.getboolean;
+         is_compiler_var:=ppufile.getboolean;
          is_used:=false;
          buflen:= ppufile.getlongint;
          if buflen > 0 then
@@ -2721,8 +2721,8 @@ implementation
     procedure tmacro.ppuwrite(ppufile:tcompilerppufile);
       begin
          inherited ppuwrite(ppufile);
-         ppufile.putbyte(byte(defined));
-         ppufile.putbyte(byte(is_compiler_var));
+         ppufile.putboolean(defined);
+         ppufile.putboolean(is_compiler_var);
          ppufile.putlongint(buflen);
          if buflen > 0 then
            ppufile.putdata(buftext^,buflen);

+ 2 - 2
compiler/symtype.pas

@@ -890,7 +890,7 @@ implementation
 
     begin
       getexprint.overflow:=false;
-      getexprint.signed:=boolean(getbyte);
+      getexprint.signed:=getboolean;
       getexprint.svalue:=getint64;
     end;
 
@@ -1081,7 +1081,7 @@ implementation
     begin
       if v.overflow then
         internalerror(200706102);
-      putbyte(byte(v.signed));
+      putboolean(v.signed);
       putint64(v.svalue);
     end;
 

+ 7 - 9
compiler/utils/ppuutils/ppudump.pp

@@ -1007,7 +1007,7 @@ function getexprint:Tconstexprint;
 
 begin
   getexprint.overflow:=false;
-  getexprint.signed:=boolean(ppufile.getbyte);
+  getexprint.signed:=ppufile.getboolean;
   getexprint.svalue:=ppufile.getint64;
 end;
 
@@ -2803,7 +2803,7 @@ begin
              write  ([space,' DefaultConst : ']);
              readderef('',TPpuParamDef(def).DefaultValue);
              writeln([space,'       ParaNr : ',getword]);
-             writeln([space,'        Univ  : ',boolean(getbyte)]);
+             writeln([space,'        Univ  : ',getboolean]);
              writeln([space,'     VarState : ',getbyte]);
              writeln([space,'         Refs : ',getbyte]);
              if (vo_has_explicit_paraloc in varoptions) then
@@ -2834,8 +2834,8 @@ begin
          ibmacrosym :
            begin
              readcommonsym('Macro symbol ');
-             writeln([space,'       Defined: ',boolean(getbyte)]);
-             writeln([space,'  Compiler var: ',boolean(getbyte)]);
+             writeln([space,'       Defined: ',getboolean]);
+             writeln([space,'  Compiler var: ',getboolean]);
              len:=getlongint;
              writeln([space,'  Value length: ',len]);
              if len > 0 then
@@ -3735,13 +3735,11 @@ begin
                while not EndOfEntry do
                  begin
                     Write('Conditional ',getstring);
-                    b:=getbyte;
-                    if boolean(b)=true then
+                    if getboolean then
                       write(' defined at startup')
                     else
                       write(' not defined at startup');
-                    b:=getbyte;
-                    if boolean(b)=true then
+                    if getboolean then
                       writeln(' was used')
                     else
                       writeln;
@@ -3982,7 +3980,7 @@ begin
       WriteError('!! Error in PPU');
       exit;
     end;
-  if boolean(ppufile.getbyte) then
+  if ppufile.getboolean then
     begin
       readsymtableoptions('interface macro');
       {skip the definition section for macros (since they are never used) }

+ 2 - 2
compiler/x86/symi86.pas

@@ -77,7 +77,7 @@ procedure ti86absolutevarsym.ppuload_platform(ppufile: tcompilerppufile);
   begin
     inherited;
     if abstyp=toaddr then
-      absseg:=boolean(ppufile.getbyte)
+      absseg:=ppufile.getboolean
     else
       absseg:=false;
   end;
@@ -87,7 +87,7 @@ procedure ti86absolutevarsym.ppuwrite_platform(ppufile: tcompilerppufile);
   begin
     inherited;
     if abstyp=toaddr then
-      ppufile.putbyte(byte(absseg));
+      ppufile.putboolean(absseg);
   end;
 
 end.