fix for #14775. Improved support for non-english compiler messages. ParseFPCMessage usage is removed

git-svn-id: trunk@22095 -
This commit is contained in:
dmitry 2009-10-10 19:11:33 +00:00
parent 484862674f
commit 35755d6e3d
2 changed files with 21 additions and 14 deletions

View File

@ -11344,6 +11344,15 @@ begin
end;
end;
function GetFPCMessage(ALine: TLazMessageLine; var FileName: String; var CaretPos: TPoint; var ErrType: TFPCErrorType): Boolean;
begin
FileName:=ALine.Filename;
CaretPos.x:=ALine.Column;
CaretPos.y:=ALine.LineNumber;
ErrType:=FPCErrorTypeNameToType(ALine.Parts.Values['Type']);
Result:=True;
end;
function TMainIDE.DoJumpToCompilerMessage(Index:integer;
FocusEditor: boolean): boolean;
var MaxMessages: integer;
@ -11353,7 +11362,7 @@ var MaxMessages: integer;
MsgType: TFPCErrorType;
SrcEdit: TSourceEditor;
OpenFlags: TOpenFlags;
CurMsg, CurDir: string;
CurDir: string;
NewFilename: String;
begin
Result:=false;
@ -11364,8 +11373,8 @@ begin
// search relevant message (first error, first fatal)
Index:=0;
while (Index<MaxMessages) do begin
CurMsg:=MessagesView.VisibleItems[Index].Msg;
if ParseFPCMessage(CurMsg,Filename,LogCaretXY,MsgType) then
// ParseFPCMessage doesn't support multilingual messages, by GetFPCMessage
if GetFPCMessage(MessagesView.VisibleItems[Index],Filename,LogCaretXY,MsgType) then
begin
if MsgType in [etError,etFatal,etPanic] then break;
end;
@ -11379,9 +11388,9 @@ begin
if MessagesView.ExecuteMsgLinePlugin(imqfoJump) then exit;
// default: jump to source position
MessagesView.GetVisibleMessageAt(Index,CurMsg,CurDir);
if ParseFPCMessage(CurMsg,Filename,LogCaretXY,MsgType)
if GetFPCMessage(MessagesView.VisibleItems[Index],Filename,LogCaretXY,MsgType)
then begin
CurDir:=MessagesView.VisibleItems[Index].Directory;
if (not FilenameIsAbsolute(Filename)) and (CurDir<>'') then begin
// the directory was just hidden, re-append it
NewFilename:=AppendPathDelim(CurDir)+Filename;
@ -11441,7 +11450,6 @@ procedure TMainIDE.DoJumpToNextError(DirectionDown: boolean);
var
Index: integer;
MaxMessages: integer;
CurMsg: String;
Filename: string;
LogCaretXY: TPoint;
MsgType: TFPCErrorType;
@ -11471,8 +11479,7 @@ begin
if(Index=OldIndex) or (RoundCount>1) then exit;
// check if it is an error
CurMsg:=MessagesView.VisibleItems[Index].Msg;
if (ParseFPCMessage(CurMsg,Filename,LogCaretXY,MsgType)) then
if GetFPCMessage(MessagesView.VisibleItems[Index],Filename,LogCaretXY,MsgType) then
begin
if MsgType in [etError,etFatal,etPanic] then break;
end;

View File

@ -552,9 +552,9 @@ var i, j, FilenameEndPos: integer;
fLastMessageType:=omtFPC;
if CompStr('Panic',s,p) then
fLastErrorType:=etPanic
else if CompStr('Fatal: ',s,p) then
else if CompStr('Fatal: ',s,p) or CompStr(FErrorNames[etFatal], s, p) then
fLastErrorType:=etFatal
else if CompStr('Error: ',s,p) then
else if CompStr('Error: ',s,p) or CompStr(FErrorNames[etError], s, p) then
fLastErrorType:=etError
else if CompStr('Closing script ppas.sh',s,p) then begin
// linker error
@ -565,7 +565,7 @@ var i, j, FilenameEndPos: integer;
CurrentMessageParts.Values['Stage']:='Linker'
else
CurrentMessageParts.Values['Stage']:='FPC';
CurrentMessageParts.Values['Type']:=FErrorNames[fLastErrorType];
CurrentMessageParts.Values['Type']:=FPCErrorTypeNames[fLastErrorType];
NewLine:=copy(s,p,length(s));
if fLastErrorType in [etPanic,etFatal] then begin
@ -599,11 +599,11 @@ var i, j, FilenameEndPos: integer;
function CheckForNoteMessages(p: integer): boolean;
begin
Result:=false;
if CompStr('Note: ',s,p) then begin
if CompStr('Note: ',s,p) or CompStr(FErrorNames[etNote], s, p) then begin
DoAddFilteredLine(copy(s,p,length(s)));
fLastErrorType:=etNote;
CurrentMessageParts.Values['Stage']:='FPC';
CurrentMessageParts.Values['Type']:=FErrorNames[fLastErrorType];
CurrentMessageParts.Values['Type']:=FPCErrorTypeNames[fLastErrorType];
Result:=true;
exit;
end;
@ -879,7 +879,7 @@ begin
fLastErrorType:=MsgType;
fLastMessageType:=omtFPC;
CurrentMessageParts.Values['Stage']:='FPC';
CurrentMessageParts.Values['Type']:=FErrorNames[fLastErrorType];
CurrentMessageParts.Values['Type']:=FPCErrorTypeNames[fLastErrorType];
CurrentMessageParts.Values['Line']:=
copy(s,LineNumberStartPos,LineNumberEndPos-LineNumberStartPos);
CurrentMessageParts.Values['Column']:=