* better bufferfile.reset error handling

This commit is contained in:
peter 1998-07-01 15:26:57 +00:00
parent 6d5e917e60
commit 97f61a43f4
2 changed files with 16 additions and 14 deletions

View File

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

View File

@ -1164,12 +1164,11 @@ unit scanner;
begin begin
fsplit(fn,d,n,e); fsplit(fn,d,n,e);
current_module^.current_inputfile:=new(pinputfile,init(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^.sourcefiles.register_file(current_module^.current_inputfile);
current_module^.current_index:=current_module^.current_inputfile^.ref_index; current_module^.current_index:=current_module^.current_inputfile^.ref_index;
status.currentsource:=current_module^.current_inputfile^.name^+current_module^.current_inputfile^.ext^; 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; inputbuffer:=current_module^.current_inputfile^.buf;
reload; reload;
preprocstack:=nil; preprocstack:=nil;
@ -1267,7 +1266,10 @@ unit scanner;
end. end.
{ {
$Log$ $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 * first version of rtti support
Revision 1.26 1998/06/16 08:56:30 peter Revision 1.26 1998/06/16 08:56:30 peter