pas2js: -i showing modeswitches

git-svn-id: trunk@44134 -
This commit is contained in:
Mattias Gaertner 2020-02-09 10:24:40 +00:00
parent a905a074b0
commit 5a0ea9d884
4 changed files with 57 additions and 8 deletions
packages
utils/pas2js

View File

@ -1156,9 +1156,6 @@ const
'DispatchStrField' // vsDispatchStrField
);
const
AllLanguageModes = [msFPC,msObjFPC,msDelphi,msTP7,msMac,msISO,msExtPas];
const
MessageTypeNames : Array[TMessageType] of string = (
'Fatal','Error','Warning','Note','Hint','Info','Debug'
@ -1167,7 +1164,7 @@ const
const
// all mode switches supported by FPC
msAllModeSwitches = [low(TModeSwitch)..High(TModeSwitch)];
msAllModes = [msFpc..msGPC];
AllLanguageModes = [msFPC..msGPC];
DelphiModeSwitches = [msDelphi,msClass,msObjpas,msResult,msStringPchar,
msPointer2Procedure,msAutoDeref,msTPProcVar,msInitFinal,msDefaultAnsistring,

View File

@ -3725,7 +3725,7 @@ begin
'm':
begin
// write list of supported modeswitches
for ms in (msAllPas2jsModeSwitches-msAllModes) do
for ms in (msAllPas2jsModeSwitches-AllLanguageModes) do
Log.LogPlain(SModeSwitchNames[ms]);
end;
'o':
@ -4882,6 +4882,33 @@ begin
end;
procedure TPas2jsCompiler.WriteInfo;
var
Flags: string;
procedure AppendFlag(const s: string);
begin
if s='' then exit;
if Flags='' then
Flags:=Space(Log.Indent)
else
Flags:=Flags+',';
if length(Flags)+length(s)>Log.LineLen then
begin
Log.LogPlain(Flags);
Flags:=Space(Log.Indent);
end;
Flags:=Flags+s;
end;
procedure FlushFlags;
begin
if Flags='' then exit;
Log.LogPlain(Flags);
Flags:='';
end;
var
ms: TModeSwitch;
begin
WriteVersionLine;
Log.LogLn;
@ -4895,10 +4922,30 @@ begin
Log.LogPlain('Supported CPU instruction sets:');
Log.LogPlain(' ECMAScript5, ECMAScript6');
Log.LogLn;
Log.LogPlain('Recognized compiler and RTL features:');
Log.LogPlain(' RTTI,CLASSES,EXCEPTIONS,EXITCODE,RANDOM,DYNARRAYS,COMMANDARGS,');
Log.LogPlain(' UNICODESTRINGS');
Flags:='';
AppendFlag('INITFINAL');
AppendFlag('RTTI');
AppendFlag('CLASSES');
AppendFlag('EXCEPTIONS');
AppendFlag('EXITCODE');
AppendFlag('WIDESTRINGS');
AppendFlag('RANDOM');
AppendFlag('DYNARRAYS');
AppendFlag('COMMANDARGS');
AppendFlag('RESOURCES');
AppendFlag('UNICODESTRINGS');
FlushFlags;
Log.LogLn;
Log.LogPlain('Recognized modeswitches:');
Flags:='';
for ms in (msAllPas2jsModeSwitches-AllLanguageModes) do
AppendFlag(SModeSwitchNames[ms]);
FlushFlags;
Log.LogLn;
Log.LogPlain('Supported Optimizations:');
Log.LogPlain(' EnumNumbers');
Log.LogPlain(' RemoveNotUsedPrivates');

View File

@ -119,12 +119,14 @@ type
private
FDebugLog: TPas2JSStream;
FEncoding: string;
FIndent: integer;
FLastMsgCol: integer;
FLastMsgFile: string;
FLastMsgLine: integer;
FLastMsgNumber: integer;
FLastMsgTxt: string;
FLastMsgType: TMessageType;
FLineLen: integer;
FMsgNumberDisabled: TIntegerDynArray;// sorted ascending
FMsg: TFPList; // list of TPas2jsMessage
FOnFormatPath: TPScannerFormatPathEvent;
@ -212,6 +214,8 @@ type
property LastMsgTxt: string read FLastMsgTxt write FLastMsgTxt;
property LastMsgNumber: integer read FLastMsgNumber write FLastMsgNumber;
property DebugLog: TPas2jsStream read FDebugLog write FDebugLog;
property LineLen: integer read FLineLen write FLineLen; // used by LogPlainText
property Indent: integer read FIndent write FIndent; // used by LogPlainText
end;
function CompareP2JMessage(Item1, Item2: {$IFDEF Pas2JS}JSValue{$ELSE}Pointer{$ENDIF}): Integer;
@ -723,6 +727,8 @@ constructor TPas2jsLogger.Create;
begin
FMsg:=TFPList.Create;
FShowMsgTypes:=DefaultLogMsgTypes;
FLineLen:=78;
FIndent:=2;
end;
destructor TPas2jsLogger.Destroy;

View File

@ -22,7 +22,6 @@ begin
P.Description := 'Convert pascal sources to javascript.';
P.Email := 'michael@freepascal.org';
P.NeedLibC:= false;
P.ShortName:='p2js';
P.Directory:=ADirectory;
P.Version:='3.3.1';