|
@@ -33,6 +33,9 @@ uses
|
|
{$ifdef fpc}
|
|
{$ifdef fpc}
|
|
keyboard,video,mouse,
|
|
keyboard,video,mouse,
|
|
{$endif fpc}
|
|
{$endif fpc}
|
|
|
|
+{$ifdef HasSignal}
|
|
|
|
+ fpcatch,
|
|
|
|
+{$endif HasSignal}
|
|
Dos,Objects,
|
|
Dos,Objects,
|
|
BrowCol,
|
|
BrowCol,
|
|
Drivers,Views,App,Dialogs,
|
|
Drivers,Views,App,Dialogs,
|
|
@@ -43,9 +46,9 @@ uses
|
|
ASCIITab,
|
|
ASCIITab,
|
|
{$endif FVISION}
|
|
{$endif FVISION}
|
|
WUtils,WViews,WHTMLScn,WHelp,
|
|
WUtils,WViews,WHTMLScn,WHelp,
|
|
- FPIDE,FPCalc,FPCompil,
|
|
|
|
|
|
+ FPIDE,FPCalc,FPCompil,FPString,
|
|
FPIni,FPViews,FPConst,FPVars,FPUtils,FPHelp,FPSwitch,FPUsrScr,
|
|
FPIni,FPViews,FPConst,FPVars,FPUtils,FPHelp,FPSwitch,FPUsrScr,
|
|
- FPTools,{$ifndef NODEBUG}FPDebug,{$endif}FPTemplt,FPCatch,FPRedir,FPDesk,
|
|
|
|
|
|
+ FPTools,{$ifndef NODEBUG}FPDebug,{$endif}FPTemplt,FPRedir,FPDesk,
|
|
FPCodTmp,FPCodCmp;
|
|
FPCodTmp,FPCodCmp;
|
|
|
|
|
|
|
|
|
|
@@ -139,6 +142,7 @@ begin
|
|
{$ifdef Unix}
|
|
{$ifdef Unix}
|
|
'T' : DebuggeeTTY:=Copy(Param,2,High(Param));
|
|
'T' : DebuggeeTTY:=Copy(Param,2,High(Param));
|
|
{$endif Unix}
|
|
{$endif Unix}
|
|
|
|
+ 'M' : TryToMaximizeScreen:=true;
|
|
{$endif fpc}
|
|
{$endif fpc}
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
@@ -213,9 +217,31 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
var CanExit : boolean;
|
|
var CanExit : boolean;
|
|
|
|
+ SetJmpRes : longint;
|
|
|
|
+ StoreExitProc : pointer;
|
|
|
|
+ ErrS : String;
|
|
|
|
+ P : record
|
|
|
|
+ l1 : longint;
|
|
|
|
+ s : pstring;
|
|
|
|
+ end;
|
|
{$ifdef win32}
|
|
{$ifdef win32}
|
|
ShowMouseExe : string;
|
|
ShowMouseExe : string;
|
|
{$endif win32}
|
|
{$endif win32}
|
|
|
|
+const
|
|
|
|
+ ExitIntercepted : boolean = false;
|
|
|
|
+ SeenExitCode : longint =0;
|
|
|
|
+ SeenErrorAddr : pointer = nil;
|
|
|
|
+
|
|
|
|
+procedure InterceptExit;
|
|
|
|
+begin
|
|
|
|
+ if StopJmpValid then
|
|
|
|
+ begin
|
|
|
|
+ ExitIntercepted:=true;
|
|
|
|
+ SeenExitCode:=ExitCode;
|
|
|
|
+ SeenErrorAddr:=ErrorAddr;
|
|
|
|
+ LongJmp(StopJmp,1);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
|
|
BEGIN
|
|
BEGIN
|
|
{$ifdef DEV}HeapLimit:=4096;{$endif}
|
|
{$ifdef DEV}HeapLimit:=4096;{$endif}
|
|
@@ -274,14 +300,53 @@ BEGIN
|
|
ShowReadme:=false; { do not show next time }
|
|
ShowReadme:=false; { do not show next time }
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ StoreExitProc:=ExitProc;
|
|
|
|
+ ExitProc:=@InterceptExit;
|
|
|
|
+
|
|
repeat
|
|
repeat
|
|
- IDEApp.Run;
|
|
|
|
|
|
+ SetJmpRes:=setjmp(StopJmp);
|
|
|
|
+ StopJmpValid:=true;
|
|
|
|
+ if SetJmpRes=0 then
|
|
|
|
+ IDEApp.Run
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ if (SetJmpRes=1) and ExitIntercepted then
|
|
|
|
+ begin
|
|
|
|
+ { If ExitProc=@InterceptExit then
|
|
|
|
+ ExitProc:=StoreExitProc;}
|
|
|
|
+ Str(SeenExitCode,ErrS);
|
|
|
|
+ if Assigned(Application) then
|
|
|
|
+ begin
|
|
|
|
+ P.l1:=SeenExitCode;
|
|
|
|
+ ErrS:=hexstr(longint(SeenErrorAddr),8);
|
|
|
|
+ P.s:=@ErrS;
|
|
|
|
+ WarningBox(error_programexitedwitherror,@P);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ writeln('Abnormal exit error: ',ErrS);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ Str(SetJmpRes,ErrS);
|
|
|
|
+ { Longjmp was called by fpcatch }
|
|
|
|
+ if Assigned(Application) then
|
|
|
|
+ begin
|
|
|
|
+ P.l1:=SetJmpRes;
|
|
|
|
+ WarningBox(error_programexitedwithsignal,@P);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ writeln('Signal error: ',ErrS);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
if (AutoSaveOptions and asEditorFiles)=0 then
|
|
if (AutoSaveOptions and asEditorFiles)=0 then
|
|
CanExit:=IDEApp.AskSaveAll
|
|
CanExit:=IDEApp.AskSaveAll
|
|
else
|
|
else
|
|
CanExit:=IDEApp.SaveAll;
|
|
CanExit:=IDEApp.SaveAll;
|
|
|
|
+ StopJmpValid:=false;
|
|
until CanExit;
|
|
until CanExit;
|
|
|
|
|
|
|
|
+ If ExitProc=pointer(@InterceptExit) then
|
|
|
|
+ ExitProc:=StoreExitProc;
|
|
IDEApp.AutoSave;
|
|
IDEApp.AutoSave;
|
|
|
|
|
|
DoneDesktopFile;
|
|
DoneDesktopFile;
|
|
@@ -319,7 +384,10 @@ BEGIN
|
|
END.
|
|
END.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.3 2002-01-09 09:46:10 pierre
|
|
|
|
|
|
+ Revision 1.4 2002-03-20 14:53:37 pierre
|
|
|
|
+ + rescue handlers in main loop
|
|
|
|
+
|
|
|
|
+ Revision 1.3 2002/01/09 09:46:10 pierre
|
|
* fix problems with -S option
|
|
* fix problems with -S option
|
|
|
|
|
|
Revision 1.2 2001/08/05 12:23:00 peter
|
|
Revision 1.2 2001/08/05 12:23:00 peter
|