+ add putboolean and getboolean convenience methods to tentfile

* use putboolean and getboolean where approbiate

git-svn-id: trunk@37972 -
This commit is contained in:
svenbarth 2018-01-14 21:36:02 +00:00
parent 9eb5f07538
commit d50848174a
10 changed files with 57 additions and 45 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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