From 432f5059fc4bb05d16c285bbb2979eaa610588f2 Mon Sep 17 00:00:00 2001 From: yury Date: Tue, 23 Apr 2013 09:49:41 +0000 Subject: [PATCH] * 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 - --- compiler/utils/ppuutils/ppudump.pp | 33 ++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp index 94a2cb40ed..b727235fc7 100644 --- a/compiler/utils/ppuutils/ppudump.pp +++ b/compiler/utils/ppuutils/ppudump.pp @@ -36,11 +36,11 @@ uses globtype, widestr, tokens, + version, ppuout, ppujson; const - Version = 'Version 2.7.1'; Title = 'PPU-Analyser'; Copyright = 'Copyright (c) 1998-2013 by the Free Pascal Development Team'; @@ -3141,7 +3141,7 @@ end; procedure WriteLogo; begin - writeln(Title+' '+Version); + writeln(Title+' Version '+version_string); writeln(Copyright); writeln; end; @@ -3152,7 +3152,9 @@ begin writeln('usage: ppudump [options] ...'); writeln; writeln('[options] can be:'); - writeln(' -J output in JSON format'); + writeln(' -F Set output format to '); + writeln(' t - text format (default)'); + writeln(' j - JSON format'); writeln(' -M Exit with ExitCode=2 if more information is available'); writeln(' -V Set verbosity to '); writeln(' H - Show header info'); @@ -3187,9 +3189,23 @@ begin begin para:=paramstr(startpara); case upcase(para[2]) of - 'J' : begin - nostdout:=True; - pout:=TPpuJsonOutput.Create(Output); + 'F' : begin + FreeAndNil(pout); + 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; 'M' : error_on_more:=true; 'V' : begin @@ -3206,6 +3222,11 @@ begin end; 'H' : help; '?' : help; + else + begin + WriteError('Invalid option: ' + para); + Halt(1); + end; end; inc(startpara); end;