Selaa lähdekoodia

* Handle Control-C exception more cleanly

peter 20 vuotta sitten
vanhempi
commit
2ec108a9c7
3 muutettua tiedostoa jossa 42 lisäystä ja 9 poistoa
  1. 5 2
      compiler/catch.pas
  2. 15 6
      compiler/compiler.pas
  3. 22 1
      compiler/verbose.pas

+ 5 - 2
compiler/catch.pas

@@ -75,7 +75,7 @@ Function CatchSignal(Sig : longint):longint;
 begin
   case Sig of
     SIGINT :
-      raise Exception.Create('Ctrl-C Signaled!');
+      raise EControlCAbort.Create;
   end;
 {$ifndef unix}
   CatchSignal:=0;
@@ -94,7 +94,10 @@ end.
 
 {
   $Log$
-  Revision 1.23  2005-02-14 17:13:06  peter
+  Revision 1.24  2005-02-15 19:15:45  peter
+    * Handle Control-C exception more cleanly
+
+  Revision 1.23  2005/02/14 17:13:06  peter
     * truncate log
 
   Revision 1.22  2005/01/31 21:30:56  olle

+ 15 - 6
compiler/compiler.pas

@@ -410,11 +410,17 @@ begin
      end;
   except
 
-    Message(general_e_compilation_aborted);
-
-    DoneVerbose;
-
-    Raise;
+    on EControlCAbort do
+      begin
+        Message(general_e_compilation_aborted);
+        DoneVerbose;
+      end;
+    on Exception do
+      begin
+        Message(general_e_compilation_aborted);
+        DoneVerbose;
+        Raise;
+      end;
   end;
 {$ifdef SHOWUSEDMEM}
   {$ifdef HASGETHEAPSTATUS}
@@ -435,7 +441,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.56  2005-02-14 17:13:06  peter
+  Revision 1.57  2005-02-15 19:15:45  peter
+    * Handle Control-C exception more cleanly
+
+  Revision 1.56  2005/02/14 17:13:06  peter
     * truncate log
 
   Revision 1.55  2005/02/13 20:11:16  peter

+ 22 - 1
compiler/verbose.pas

@@ -27,6 +27,7 @@ unit verbose;
 interface
 
     uses
+      sysutils,
       cutils,
       globals,finput,
       cmsgs;
@@ -67,6 +68,11 @@ interface
     const
       msgfilename : string = '';
 
+    type
+      EControlCAbort=class(Exception)
+        constructor Create;
+      end;
+
     procedure SetRedirectFile(const fn:string);
     function  SetVerbosity(const s:string):boolean;
     procedure PrepareReport;
@@ -106,6 +112,7 @@ interface
     procedure DoneVerbose;
 
 
+
 implementation
 
     uses
@@ -114,6 +121,17 @@ implementation
 var
   compiling_module : tmodulebase;
 
+
+{****************************************************************************
+                          Control-C Exception
+****************************************************************************}
+
+     constructor EControlCAbort.Create;
+       begin
+         inherited Create('Ctrl-C Signaled!');
+       end;
+
+
 {****************************************************************************
                        Extra Handlers for default compiler
 ****************************************************************************}
@@ -876,7 +894,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.38  2005-02-14 17:13:09  peter
+  Revision 1.39  2005-02-15 19:15:45  peter
+    * Handle Control-C exception more cleanly
+
+  Revision 1.38  2005/02/14 17:13:09  peter
     * truncate log
 
   Revision 1.37  2005/02/07 17:25:28  peter