* ppudump:

- Use -Ft and Fj options to set the text and JSON output formats.
  - Get version string from compiler sources.

git-svn-id: trunk@24306 -
This commit is contained in:
yury 2013-04-23 09:49:41 +00:00
parent 6bb05dbc06
commit 432f5059fc

View File

@ -36,11 +36,11 @@ uses
globtype, globtype,
widestr, widestr,
tokens, tokens,
version,
ppuout, ppuout,
ppujson; ppujson;
const const
Version = 'Version 2.7.1';
Title = 'PPU-Analyser'; Title = 'PPU-Analyser';
Copyright = 'Copyright (c) 1998-2013 by the Free Pascal Development Team'; Copyright = 'Copyright (c) 1998-2013 by the Free Pascal Development Team';
@ -3141,7 +3141,7 @@ end;
procedure WriteLogo; procedure WriteLogo;
begin begin
writeln(Title+' '+Version); writeln(Title+' Version '+version_string);
writeln(Copyright); writeln(Copyright);
writeln; writeln;
end; end;
@ -3152,7 +3152,9 @@ begin
writeln('usage: ppudump [options] <filename1> <filename2>...'); writeln('usage: ppudump [options] <filename1> <filename2>...');
writeln; writeln;
writeln('[options] can be:'); writeln('[options] can be:');
writeln(' -J output in JSON format'); writeln(' -F<format> Set output format to <format>');
writeln(' t - text format (default)');
writeln(' j - JSON format');
writeln(' -M Exit with ExitCode=2 if more information is available'); writeln(' -M Exit with ExitCode=2 if more information is available');
writeln(' -V<verbose> Set verbosity to <verbose>'); writeln(' -V<verbose> Set verbosity to <verbose>');
writeln(' H - Show header info'); writeln(' H - Show header info');
@ -3187,9 +3189,23 @@ begin
begin begin
para:=paramstr(startpara); para:=paramstr(startpara);
case upcase(para[2]) of case upcase(para[2]) of
'J' : begin 'F' : begin
nostdout:=True; FreeAndNil(pout);
pout:=TPpuJsonOutput.Create(Output); if Length(para) > 2 then
case upcase(para[3]) of
'T':
nostdout:=False;
'J':
begin
nostdout:=True;
pout:=TPpuJsonOutput.Create(Output);
end;
else
begin
WriteError('Invalid output format: ' + para[3]);
Halt(1);
end;
end;
end; end;
'M' : error_on_more:=true; 'M' : error_on_more:=true;
'V' : begin 'V' : begin
@ -3206,6 +3222,11 @@ begin
end; end;
'H' : help; 'H' : help;
'?' : help; '?' : help;
else
begin
WriteError('Invalid option: ' + para);
Halt(1);
end;
end; end;
inc(startpara); inc(startpara);
end; end;