Przeglądaj źródła

* better bufferfile.reset error handling

peter 27 lat temu
rodzic
commit
97f61a43f4
2 zmienionych plików z 16 dodań i 14 usunięć
  1. 10 10
      compiler/cobjects.pas
  2. 6 4
      compiler/scanner.pas

+ 10 - 10
compiler/cobjects.pas

@@ -102,8 +102,6 @@ unit cobjects;
           { it's not tested if p is in the list !      }
           procedure remove(p : plinkedlist_item);
 
-
-
           { is the linkedlist empty ? }
           function  empty:boolean;
        end;
@@ -133,13 +131,9 @@ unit cobjects;
           constructor init;
           destructor done;
 
-
-
           { true is the container empty }
           function empty:boolean;
 
-
-
           { inserts a string }
           procedure insert(const s : string);
           procedure insert_with_tokeninfo(const s : string;const file_info : tfileposinfo);
@@ -183,7 +177,7 @@ unit cobjects;
            destructor done;virtual;
 
            { opens the file for input, other accesses are rejected }
-           procedure reset;
+           function  reset:boolean;
 
            { opens the file for output, other accesses are rejected }
            procedure rewrite;
@@ -831,7 +825,7 @@ end;
          buf:=p;
       end;
 
-    procedure tbufferedfile.reset;
+    function tbufferedfile.reset:boolean;
 
       var
          ofm : byte;
@@ -840,7 +834,10 @@ end;
          iomode:=1;
          getmem(buf,bufsize);
          filemode:=0;
-         system.reset(f,1);
+         {$I-}
+          system.reset(f,1);
+         {$I+}
+         reset:=(ioresult=0);
          filemode:=ofm;
       end;
 
@@ -1125,7 +1122,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.9  1998-06-03 23:40:37  peter
+  Revision 1.10  1998-07-01 15:26:59  peter
+    * better bufferfile.reset error handling
+
+  Revision 1.9  1998/06/03 23:40:37  peter
     + unlimited file support, release tempclose
 
   Revision 1.8  1998/05/20 09:42:33  pierre

+ 6 - 4
compiler/scanner.pas

@@ -1164,12 +1164,11 @@ unit scanner;
      begin
         fsplit(fn,d,n,e);
         current_module^.current_inputfile:=new(pinputfile,init(d,n,e));
-        current_module^.current_inputfile^.reset;
+        if not current_module^.current_inputfile^.reset then
+         Message(scan_f_cannot_open_input);
         current_module^.sourcefiles.register_file(current_module^.current_inputfile);
         current_module^.current_index:=current_module^.current_inputfile^.ref_index;
         status.currentsource:=current_module^.current_inputfile^.name^+current_module^.current_inputfile^.ext^;
-        if ioresult<>0 then
-         Message(scan_f_cannot_open_input);
         inputbuffer:=current_module^.current_inputfile^.buf;
         reload;
         preprocstack:=nil;
@@ -1267,7 +1266,10 @@ unit scanner;
 end.
 {
   $Log$
-  Revision 1.27  1998-06-25 08:48:19  florian
+  Revision 1.28  1998-07-01 15:26:57  peter
+    * better bufferfile.reset error handling
+
+  Revision 1.27  1998/06/25 08:48:19  florian
     * first version of rtti support
 
   Revision 1.26  1998/06/16 08:56:30  peter