Browse Source

* fixed reading of constants from token streams

git-svn-id: trunk@14792 -
florian 15 years ago
parent
commit
e7bff9f5c1
1 changed files with 23 additions and 14 deletions
  1. 23 14
      compiler/utils/ppudump.pp

+ 23 - 14
compiler/utils/ppudump.pp

@@ -32,9 +32,9 @@ uses
   tokens;
   tokens;
 
 
 const
 const
-  Version   = 'Version 2.3.1';
+  Version   = 'Version 2.5.1';
   Title     = 'PPU-Analyser';
   Title     = 'PPU-Analyser';
-  Copyright = 'Copyright (c) 1998-2007 by the Free Pascal Development Team';
+  Copyright = 'Copyright (c) 1998-2010 by the Free Pascal Development Team';
 
 
 { verbosity }
 { verbosity }
   v_none           = $0;
   v_none           = $0;
@@ -886,6 +886,9 @@ var
   first  : boolean;
   first  : boolean;
   tokenbufsize : longint;
   tokenbufsize : longint;
   tokenbuf : pbyte;
   tokenbuf : pbyte;
+  len : sizeint;
+  wstring : widestring;
+  astring : ansistring;
 begin
 begin
   writeln(space,'** Definition Id ',ppufile.getlongint,' **');
   writeln(space,'** Definition Id ',ppufile.getlongint,' **');
   writeln(space,s);
   writeln(space,s);
@@ -942,24 +945,30 @@ begin
             _CWSTRING :
             _CWSTRING :
               begin
               begin
                 inc(i);
                 inc(i);
-              {
-                replaytokenbuf.read(wlen,sizeof(SizeInt));
-                setlengthwidestring(patternw,wlen);
-                replaytokenbuf.read(patternw^.data^,patternw^.len*sizeof(tcompilerwidechar));
-                pattern:='';
-              }
+                len:=psizeint(@tokenbuf[i])^;
+                inc(i,sizeof(sizeint));
+                setlength(wstring,len);
+                move(tokenbuf[i],wstring[1],len*2);
+                write(' ',wstring);
+                inc(i,len*2);
+              end;
+            _CSTRING:
+              begin
+                inc(i);
+                len:=psizeint(@tokenbuf[i])^;
+                inc(i,sizeof(sizeint));
+                setlength(astring,len);
+                move(tokenbuf[i],astring[1],len);
+                write(' ',astring);
+                inc(i,len);
               end;
               end;
             _CCHAR,
             _CCHAR,
-            _CSTRING,
             _INTCONST,
             _INTCONST,
             _REALNUMBER :
             _REALNUMBER :
               begin
               begin
                 inc(i);
                 inc(i);
-              {
-                replaytokenbuf.read(pattern[0],1);
-                replaytokenbuf.read(pattern[1],length(pattern));
-                orgpattern:='';
-              }
+                write(' ',pshortstring(@tokenbuf[i])^);
+                inc(i,tokenbuf[i]+1);
               end;
               end;
             _ID :
             _ID :
               begin
               begin