+ Read BackTrace from UseScreen

This commit is contained in:
pierre 2000-03-08 16:48:07 +00:00
parent 97a5b84098
commit 4ebe6eb7be

View File

@ -80,7 +80,7 @@ const
CompilerStatusDialog : PCompilerStatusDialog = nil; CompilerStatusDialog : PCompilerStatusDialog = nil;
procedure DoCompile(Mode: TCompileMode); procedure DoCompile(Mode: TCompileMode);
function NeedRecompile: boolean; function NeedRecompile(verbose : boolean): boolean;
procedure ParseUserScreen; procedure ParseUserScreen;
procedure RegisterFPCompile; procedure RegisterFPCompile;
@ -122,6 +122,38 @@ var
Text,Attr : String; Text,Attr : String;
DisplayCompilerWindow : boolean; DisplayCompilerWindow : boolean;
procedure SearchBackTrace;
var AText,ModuleName,st : String;
p2,row : longint;
begin
if pos(' 0x',Text)=1 then
begin
AText:=Text;
Delete(Text,1,10);
While pos(' ',Text)=1 do
Delete(Text,1,1);
if pos('of ',Text)>0 then
begin
ModuleName:=Copy(Text,pos('of ',Text)+3,255);
While ModuleName[Length(ModuleName)]=' ' do
Delete(ModuleName,Length(ModuleName),1);
end
else
ModuleName:='';
if pos('line ',Text)>0 then
begin
Text:=Copy(Text,Pos('line ',Text)+5,255);
st:=Copy(Text,1,Pos(' ',Text)-1);
Val(st,row);
end
else
row:=0;
CompilerMessageWindow^.AddMessage(V_Fatal,AText
,ModuleName,row,1);
DisplayCompilerWindow:=true;
end;
end;
procedure InsertInMessages(Const TypeStr : String;_Type : longint;EnableDisplay : boolean); procedure InsertInMessages(Const TypeStr : String;_Type : longint;EnableDisplay : boolean);
var p,p2,col,row : longint; var p,p2,col,row : longint;
St,ModuleName : string; St,ModuleName : string;
@ -136,10 +168,10 @@ var
Val(Copy(st,1,pos(',',st)-1),row); Val(Copy(st,1,pos(',',st)-1),row);
st:=Copy(st,Pos(',',st)+1,255); st:=Copy(st,Pos(',',st)+1,255);
Val(Copy(st,1,pos(')',st)-1),col); Val(Copy(st,1,pos(')',st)-1),col);
If EnableDisplay then
DisplayCompilerWindow:=true;
CompilerMessageWindow^.AddMessage(_type,Copy(Text,pos(':',Text)+1,255) CompilerMessageWindow^.AddMessage(_type,Copy(Text,pos(':',Text)+1,255)
,ModuleName,row,col); ,ModuleName,row,col);
If EnableDisplay then
DisplayCompilerWindow:=true;
end; end;
end; end;
@ -150,9 +182,10 @@ begin
for Y:=0 to UserScreen^.GetHeight do for Y:=0 to UserScreen^.GetHeight do
begin begin
UserScreen^.GetLine(Y,Text,Attr); UserScreen^.GetLine(Y,Text,Attr);
SearchBackTrace;
InsertInMessages(' Fatal:',v_Fatal,true); InsertInMessages(' Fatal:',v_Fatal,true);
InsertInMessages(' Error:',v_Error,true); InsertInMessages(' Error:',v_Error,true);
InsertInMessages(' Warning:',v_Warning,true); InsertInMessages(' Warning:',v_Warning,false);
InsertInMessages(' Note:',v_Note,false); InsertInMessages(' Note:',v_Note,false);
InsertInMessages(' Info:',v_Info,false); InsertInMessages(' Info:',v_Info,false);
InsertInMessages(' Hint:',v_Hint,false); InsertInMessages(' Hint:',v_Hint,false);
@ -162,6 +195,7 @@ begin
if not CompilerMessageWindow^.GetState(sfVisible) then if not CompilerMessageWindow^.GetState(sfVisible) then
CompilerMessageWindow^.Show; CompilerMessageWindow^.Show;
CompilerMessageWindow^.MakeFirst; CompilerMessageWindow^.MakeFirst;
CompilerMessageWindow^.MsgLB^.SelectFirstError;
end; end;
end; end;
@ -610,7 +644,14 @@ begin
ErrorBox('Can''t compile unsaved file.',nil); ErrorBox('Can''t compile unsaved file.',nil);
Exit; Exit;
end; end;
PrevMainFile:=MainFile; { Show Compiler Messages Window }
if not CompilerMessageWindow^.GetState(sfVisible) then
CompilerMessageWindow^.Show;
CompilerMessageWindow^.MakeFirst;
CompilerMessageWindow^.ClearMessages;
{ Tell why we compile }
NeedRecompile(true);
MainFile:=FileName; MainFile:=FileName;
WriteSwitches(SwitchesPath); WriteSwitches(SwitchesPath);
{ leaving open browsers leads to crashes !! (PM) } { leaving open browsers leads to crashes !! (PM) }
@ -624,11 +665,6 @@ begin
EXEFile:=DirOf(MainFile)+NameOf(MainFile)+ExeExt; EXEFile:=DirOf(MainFile)+NameOf(MainFile)+ExeExt;
{ Reset } { Reset }
CtrlBreakHit:=false; CtrlBreakHit:=false;
{ Show Compiler Messages Window }
if not CompilerMessageWindow^.GetState(sfVisible) then
CompilerMessageWindow^.Show;
CompilerMessageWindow^.MakeFirst;
CompilerMessageWindow^.ClearMessages;
{ Create Compiler Status Dialog } { Create Compiler Status Dialog }
CompilationPhase:=cpCompiling; CompilationPhase:=cpCompiling;
New(CompilerStatusDialog, Init); New(CompilerStatusDialog, Init);
@ -735,9 +771,14 @@ begin
Application^.Delete(CompilerStatusDialog); Application^.Delete(CompilerStatusDialog);
Dispose(CompilerStatusDialog, Done); Dispose(CompilerStatusDialog, Done);
CompilerStatusDialog:=nil; CompilerStatusDialog:=nil;
{ endcompilation returns true if the messagewindow should be removed } { end compilation returns true if the messagewindow should be removed }
if CompilationPhase=cpDone then if CompilationPhase=cpDone then
CompilerMessageWindow^.Hide; begin
CompilerMessageWindow^.Hide;
{ This is the last compiled main file }
PrevMainFile:=MainFile;
MainHasDebugInfo:=DebugInfoSwitches^.GetCurrSelParam<>'-';
end;
{ Update the app } { Update the app }
Message(Application,evCommand,cmUpdate,nil); Message(Application,evCommand,cmUpdate,nil);
{$ifdef TEMPHEAP} {$ifdef TEMPHEAP}
@ -758,12 +799,12 @@ begin
{ ^^^ we need this trick to reactivate the desktop } { ^^^ we need this trick to reactivate the desktop }
EditorModified:=false; EditorModified:=false;
{ Try to read Browser info in again if compilation failure !! } { Try to read Browser info in again if compilation failure !! }
if Not Assigned(Modules) and if Not Assigned(Modules) and (CompilationPhase<>cpDone) and
((DesktopFileFlags and dfSymbolInformation)<>0) then ((DesktopFileFlags and dfSymbolInformation)<>0) then
ReadSymbolsFile(BrowserName); ReadSymbolsFile(BrowserName);
end; end;
function NeedRecompile: boolean; function NeedRecompile(verbose : boolean): boolean;
var Need: boolean; var Need: boolean;
I: sw_integer; I: sw_integer;
SF: PSourceFile; SF: PSourceFile;
@ -774,7 +815,14 @@ begin
else else
begin begin
Need:=(PrevMainFile<>GetMainFile) and (PrevMainFile<>''); Need:=(PrevMainFile<>GetMainFile) and (PrevMainFile<>'');
if Need=false then if Need then
begin
if verbose then
CompilerMessageWindow^.AddMessage(V_info,
'First compilation of '+GetMainFile,
'',0,0);
end
else
for I:=0 to SourceFiles^.Count-1 do for I:=0 to SourceFiles^.Count-1 do
begin begin
SF:=SourceFiles^.At(I); SF:=SourceFiles^.At(I);
@ -792,6 +840,10 @@ begin
(ObjTime<>-1)) then (ObjTime<>-1)) then
begin begin
Need:=true; Need:=true;
if verbose then
CompilerMessageWindow^.AddMessage(V_info,
'Recompiling because of '+SF^.GetSourceFileName,
SF^.GetSourceFileName,1,1);
Break; Break;
end; end;
end; end;
@ -813,7 +865,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.51 2000-03-07 21:54:26 pierre Revision 1.52 2000-03-08 16:48:07 pierre
+ Read BackTrace from UseScreen
Revision 1.51 2000/03/07 21:54:26 pierre
+ ParseUserScreen + ParseUserScreen
Revision 1.50 2000/02/06 23:41:42 pierre Revision 1.50 2000/02/06 23:41:42 pierre