Răsfoiți Sursa

* catch EOSError, EIOError and IOutOfMemory exceptions inside the compiler
so a proper error message is written (resolves #19871),
EOutOfMemory is not handle perfectly because it could be that the exception
handling requires again a memory allocation

git-svn-id: trunk@18132 -

florian 14 ani în urmă
părinte
comite
562961fd42
5 a modificat fișierele cu 489 adăugiri și 450 ștergeri
  1. 12 11
      compiler/comphook.pas
  2. 30 1
      compiler/compiler.pas
  3. 4 0
      compiler/msg/errore.msg
  4. 4 2
      compiler/msgidx.inc
  5. 439 436
      compiler/msgtxt.inc

+ 12 - 11
compiler/comphook.pas

@@ -107,20 +107,21 @@ type
   { Special file for bug report }
     reportbugfile : text;
   end;
+
+type
+  EControlCAbort=class(Exception)
+    constructor Create;
+  end;
+  ECompilerAbort=class(Exception)
+    constructor Create;
+  end;
+  ECompilerAbortSilent=class(Exception)
+    constructor Create;
+  end;
+
 var
   status : tcompilerstatus;
 
-    type
-      EControlCAbort=class(Exception)
-        constructor Create;
-      end;
-      ECompilerAbort=class(Exception)
-        constructor Create;
-      end;
-      ECompilerAbortSilent=class(Exception)
-        constructor Create;
-      end;
-
 { Default Functions }
 Function  def_status:boolean;
 Function  def_comment(Level:Longint;const s:ansistring):boolean;

+ 30 - 1
compiler/compiler.pas

@@ -281,7 +281,6 @@ begin
      end;
      DoneVerbose;
   except
-
     on EControlCAbort do
       begin
         try
@@ -312,6 +311,36 @@ begin
       begin
         DoneVerbose;
       end;
+    on EOutOfMemory do
+      begin
+        try
+          Message(general_f_no_memory_left);
+        except
+          on ECompilerAbort do
+            ;
+        end;
+        DoneVerbose;
+      end;
+    on e : EInOutError do
+      begin
+        try
+          Message1(general_f_ioerror,e.message);
+        except
+          on ECompilerAbort do
+            ;
+        end;
+        DoneVerbose;
+      end;
+    on e : EOSError do
+      begin
+        try
+          Message1(general_f_oserror,e.message);
+        except
+          on ECompilerAbort do
+            ;
+        end;
+        DoneVerbose;
+      end;
     on Exception do
       begin
         { General catchall, normally not used }

+ 4 - 0
compiler/msg/errore.msg

@@ -124,6 +124,10 @@ general_i_number_of_hints=01022_I_$1 hint(s) issued
 % Total number of hints issued during compilation.
 general_i_number_of_notes=01023_I_$1 note(s) issued
 % Total number of notes issued during compilation.
+general_f_ioerror=01024_F_I/O error: $1
+% During compilation an I/O error happened which allows no further compilation.
+general_f_oserror=01025_F_Operating system error: $1
+% During compilation an operanting system error happened which allows no further compilation.
 % \end{description}
 #
 # Scanner

+ 4 - 2
compiler/msgidx.inc

@@ -23,6 +23,8 @@ const
   general_i_number_of_warnings=01021;
   general_i_number_of_hints=01022;
   general_i_number_of_notes=01023;
+  general_f_ioerror=01024;
+  general_f_oserror=01025;
   scan_f_end_of_file=02000;
   scan_f_string_exceeds_line=02001;
   scan_f_illegal_char=02002;
@@ -895,9 +897,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 60714;
+  MsgTxtSize = 60771;
 
   MsgIdxMax : array[1..20] of longint=(
-    24,89,311,103,85,54,111,23,202,63,
+    26,89,311,103,85,54,111,23,202,63,
     49,20,1,1,1,1,1,1,1,1
   );

Fișier diff suprimat deoarece este prea mare
+ 439 - 436
compiler/msgtxt.inc


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff