utils: fix ppudump generic tokenbuf reading

git-svn-id: trunk@16727 -
This commit is contained in:
paul 2011-01-07 17:47:23 +00:00
parent f5965a9ce4
commit 4e93ecda3d

View File

@ -871,6 +871,7 @@ type
mask : tdefstate; mask : tdefstate;
str : string[30]; str : string[30];
end; end;
ptoken=^ttoken;
const const
defopt : array[1..ord(high(tdefoption))] of tdefopt=( defopt : array[1..ord(high(tdefoption))] of tdefopt=(
(mask:df_unique; str:'Unique Type'), (mask:df_unique; str:'Unique Type'),
@ -893,6 +894,7 @@ var
first : boolean; first : boolean;
tokenbufsize : longint; tokenbufsize : longint;
tokenbuf : pbyte; tokenbuf : pbyte;
token : ttoken;
len : sizeint; len : sizeint;
wstring : widestring; wstring : widestring;
astring : ansistring; astring : ansistring;
@ -945,13 +947,14 @@ begin
write(space,' Tokens: '); write(space,' Tokens: ');
while i<tokenbufsize do while i<tokenbufsize do
begin begin
if ttoken(tokenbuf[i])<>_GENERICSPECIALTOKEN then token:=ptoken(@tokenbuf[i])^;
write(arraytokeninfo[ttoken(tokenbuf[i])].str); if token<>_GENERICSPECIALTOKEN then
case ttoken(tokenbuf[i]) of write(arraytokeninfo[token].str);
inc(i,SizeOf(token));
case token of
_CWCHAR, _CWCHAR,
_CWSTRING : _CWSTRING :
begin begin
inc(i);
len:=psizeint(@tokenbuf[i])^; len:=psizeint(@tokenbuf[i])^;
inc(i,sizeof(sizeint)); inc(i,sizeof(sizeint));
setlength(wstring,len); setlength(wstring,len);
@ -961,7 +964,6 @@ begin
end; end;
_CSTRING: _CSTRING:
begin begin
inc(i);
len:=psizeint(@tokenbuf[i])^; len:=psizeint(@tokenbuf[i])^;
inc(i,sizeof(sizeint)); inc(i,sizeof(sizeint));
setlength(astring,len); setlength(astring,len);
@ -973,14 +975,12 @@ begin
_INTCONST, _INTCONST,
_REALNUMBER : _REALNUMBER :
begin begin
inc(i);
write(' ',pshortstring(@tokenbuf[i])^); write(' ',pshortstring(@tokenbuf[i])^);
inc(i,tokenbuf[i]+1); inc(i,tokenbuf[i]+1);
end; end;
_ID : _ID :
begin begin
inc(i); inc(i,SizeOf(ttoken)); // idtoken
inc(i);
write(' ',pshortstring(@tokenbuf[i])^); write(' ',pshortstring(@tokenbuf[i])^);
inc(i,tokenbuf[i]+1); inc(i,tokenbuf[i]+1);
{ {
@ -991,7 +991,6 @@ begin
end; end;
_GENERICSPECIALTOKEN: _GENERICSPECIALTOKEN:
begin begin
inc(i);
case tspecialgenerictoken(tokenbuf[i]) of case tspecialgenerictoken(tokenbuf[i]) of
ST_LOADSETTINGS: ST_LOADSETTINGS:
begin begin
@ -1031,8 +1030,6 @@ begin
continue; continue;
} }
end; end;
else
inc(i);
end; end;
if i<tokenbufsize then if i<tokenbufsize then