+ unlimited file support, release tempclose

This commit is contained in:
peter 1998-06-03 23:40:37 +00:00
parent 6f2206fbeb
commit f29aaf6d8a
2 changed files with 39 additions and 56 deletions

View File

@ -174,7 +174,7 @@ unit cobjects;
tempclosed : boolean; tempclosed : boolean;
tempmode : byte; tempmode : byte;
temppos : longint; temppos : longint;
{ inits a buffer with the size bufsize which is assigned to } { inits a buffer with the size bufsize which is assigned to }
{ the file filename } { the file filename }
constructor init(const filename : string;_bufsize : longint); constructor init(const filename : string;_bufsize : longint);
@ -214,12 +214,10 @@ unit cobjects;
{ closes the file and releases the buffer } { closes the file and releases the buffer }
procedure close; procedure close;
{$ifdef TEST_TEMPCLOSE}
{ temporary closing } { temporary closing }
procedure tempclose; procedure tempclose;
procedure tempreopen; procedure tempreopen;
{$endif TEST_TEMPCLOSE}
{ goto the given position } { goto the given position }
procedure seek(l : longint); procedure seek(l : longint);
@ -1083,52 +1081,54 @@ end;
end; end;
end; end;
{$ifdef TEST_TEMPCLOSE}
procedure tbufferedfile.tempclose; procedure tbufferedfile.tempclose;
begin begin
if iomode<>0 then if iomode<>0 then
begin begin
temppos:=system.filepos(f); temppos:=system.filepos(f);
tempmode:=iomode; tempmode:=iomode;
tempclosed:=true; tempclosed:=true;
system.close(f); system.close(f);
iomode:=0; iomode:=0;
end end
else else
tempclosed:=false; tempclosed:=false;
end; end;
procedure tbufferedfile.tempreopen; procedure tbufferedfile.tempreopen;
var var
ofm : byte; ofm : byte;
begin begin
if tempclosed then if tempclosed then
begin begin
if tempmode=1 then case tempmode of
begin 1 : begin
ofm:=filemode; ofm:=filemode;
iomode:=1; iomode:=1;
filemode:=0; filemode:=0;
system.reset(f,1); system.reset(f,1);
filemode:=ofm; filemode:=ofm;
end end;
else if tempmode=2 then 2 : begin
begin iomode:=2;
iomode:=2; system.rewrite(f,1);
system.rewrite(f,1); end;
end; end;
system.seek(f,temppos); system.seek(f,temppos);
tempclosed:=false;
end; end;
end; end;
{$endif TEST_TEMPCLOSE}
end. end.
{ {
$Log$ $Log$
Revision 1.8 1998-05-20 09:42:33 pierre 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
+ UseTokenInfo now default + UseTokenInfo now default
* unit in interface uses and implementation uses gives error now * unit in interface uses and implementation uses gives error now
* only one error for unknown symbol (uses lastsymknown boolean) * only one error for unknown symbol (uses lastsymknown boolean)

View File

@ -192,15 +192,11 @@ unit pmodules;
Message1(unit_f_cant_compile_unit,hp^.modulename^) Message1(unit_f_cant_compile_unit,hp^.modulename^)
else else
begin begin
{$ifdef TEST_TEMPCLOSE}
if assigned(oldhp^.current_inputfile) then if assigned(oldhp^.current_inputfile) then
oldhp^.current_inputfile^.tempclose; oldhp^.current_inputfile^.tempclose;
{$endif TEST_TEMPCLOSE}
compile(hp^.mainsource^,compile_system); compile(hp^.mainsource^,compile_system);
{$ifdef TEST_TEMPCLOSE} if (not oldhp^.compiled) and assigned(oldhp^.current_inputfile) then
if not oldhp^.compiled then
oldhp^.current_inputfile^.tempreopen; oldhp^.current_inputfile^.tempreopen;
{$endif TEST_TEMPCLOSE}
end; end;
exit; exit;
end; end;
@ -274,15 +270,11 @@ unit pmodules;
Message1(unit_f_cant_compile_unit,hp^.modulename^) Message1(unit_f_cant_compile_unit,hp^.modulename^)
else else
begin begin
{$ifdef TEST_TEMPCLOSE}
if assigned(oldhp^.current_inputfile) then if assigned(oldhp^.current_inputfile) then
oldhp^.current_inputfile^.tempclose; oldhp^.current_inputfile^.tempclose;
{$endif TEST_TEMPCLOSE}
compile(hp^.mainsource^,compile_system); compile(hp^.mainsource^,compile_system);
{$ifdef TEST_TEMPCLOSE} if (not oldhp^.compiled) and assigned(oldhp^.current_inputfile) then
if not oldhp^.compiled then
oldhp^.current_inputfile^.tempreopen; oldhp^.current_inputfile^.tempreopen;
{$endif TEST_TEMPCLOSE}
end; end;
exit; exit;
end; end;
@ -335,13 +327,9 @@ unit pmodules;
Message1(unit_f_cant_compile_unit,hp^.unitname^) Message1(unit_f_cant_compile_unit,hp^.unitname^)
else else
begin begin
{ifdef TEST_TEMPCLOSE}
oldhp^.current_inputfile^.tempclose; oldhp^.current_inputfile^.tempclose;
{endif TEST_TEMPCLOSE}
compile(hp^.mainsource^,compile_system); compile(hp^.mainsource^,compile_system);
{ifdef TEST_TEMPCLOSE}
oldhp^.current_inputfile^.tempclose; oldhp^.current_inputfile^.tempclose;
{endif TEST_TEMPCLOSE}
end; end;
exit; exit;
end; *) end; *)
@ -411,15 +399,11 @@ unit pmodules;
Message1(unit_f_cant_compile_unit,hp^.modulename^) Message1(unit_f_cant_compile_unit,hp^.modulename^)
else else
begin begin
{$ifdef TEST_TEMPCLOSE}
if assigned(old_current_module^.current_inputfile) then if assigned(old_current_module^.current_inputfile) then
old_current_module^.current_inputfile^.tempclose; old_current_module^.current_inputfile^.tempclose;
{$endif TEST_TEMPCLOSE}
compile(hp^.mainsource^,compile_system); compile(hp^.mainsource^,compile_system);
{$ifdef TEST_TEMPCLOSE} if (not old_current_module^.compiled) and assigned(old_current_module^.current_inputfile) then
if not old_current_module^.compiled then
old_current_module^.current_inputfile^.tempreopen; old_current_module^.current_inputfile^.tempreopen;
{$endif TEST_TEMPCLOSE}
end; end;
end end
else else
@ -480,16 +464,12 @@ unit pmodules;
hp^.sourcefiles.done; hp^.sourcefiles.done;
hp^.sourcefiles.init; hp^.sourcefiles.init;
{$endif not UseBrowser} {$endif not UseBrowser}
{$ifdef TEST_TEMPCLOSE}
if assigned(old_current_module^.current_inputfile) then if assigned(old_current_module^.current_inputfile) then
old_current_module^.current_inputfile^.tempclose; old_current_module^.current_inputfile^.tempclose;
{$endif TEST_TEMPCLOSE}
Message1(parser_d_compiling_second_time,hp^.mainsource^); Message1(parser_d_compiling_second_time,hp^.mainsource^);
compile(hp^.mainsource^,compile_system); compile(hp^.mainsource^,compile_system);
{$ifdef TEST_TEMPCLOSE} if (not old_current_module^.compiled) and assigned(old_current_module^.current_inputfile) then
if not old_current_module^.compiled then
old_current_module^.current_inputfile^.tempreopen; old_current_module^.current_inputfile^.tempreopen;
{$endif TEST_TEMPCLOSE}
end; end;
current_module^.compiled:=true; current_module^.compiled:=true;
end; end;
@ -1001,7 +981,10 @@ unit pmodules;
end. end.
{ {
$Log$ $Log$
Revision 1.18 1998-06-03 22:49:00 peter Revision 1.19 1998-06-03 23:40:38 peter
+ unlimited file support, release tempclose
Revision 1.18 1998/06/03 22:49:00 peter
+ wordbool,longbool + wordbool,longbool
* rename bis,von -> high,low * rename bis,von -> high,low
* moved some systemunit loading/creating to psystem.pas * moved some systemunit loading/creating to psystem.pas