mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 20:29:16 +02:00
+ unlimited file support, release tempclose
This commit is contained in:
parent
6f2206fbeb
commit
f29aaf6d8a
@ -174,7 +174,7 @@ unit cobjects;
|
||||
tempclosed : boolean;
|
||||
tempmode : byte;
|
||||
temppos : longint;
|
||||
|
||||
|
||||
{ inits a buffer with the size bufsize which is assigned to }
|
||||
{ the file filename }
|
||||
constructor init(const filename : string;_bufsize : longint);
|
||||
@ -214,12 +214,10 @@ unit cobjects;
|
||||
{ closes the file and releases the buffer }
|
||||
procedure close;
|
||||
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
{ temporary closing }
|
||||
procedure tempclose;
|
||||
procedure tempreopen;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
|
||||
|
||||
{ goto the given position }
|
||||
procedure seek(l : longint);
|
||||
|
||||
@ -1083,52 +1081,54 @@ end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
procedure tbufferedfile.tempclose;
|
||||
|
||||
begin
|
||||
if iomode<>0 then
|
||||
begin
|
||||
temppos:=system.filepos(f);
|
||||
tempmode:=iomode;
|
||||
tempclosed:=true;
|
||||
system.close(f);
|
||||
iomode:=0;
|
||||
end
|
||||
else
|
||||
tempclosed:=false;
|
||||
if iomode<>0 then
|
||||
begin
|
||||
temppos:=system.filepos(f);
|
||||
tempmode:=iomode;
|
||||
tempclosed:=true;
|
||||
system.close(f);
|
||||
iomode:=0;
|
||||
end
|
||||
else
|
||||
tempclosed:=false;
|
||||
end;
|
||||
|
||||
procedure tbufferedfile.tempreopen;
|
||||
|
||||
var
|
||||
ofm : byte;
|
||||
|
||||
|
||||
begin
|
||||
if tempclosed then
|
||||
begin
|
||||
if tempmode=1 then
|
||||
begin
|
||||
ofm:=filemode;
|
||||
iomode:=1;
|
||||
filemode:=0;
|
||||
system.reset(f,1);
|
||||
filemode:=ofm;
|
||||
end
|
||||
else if tempmode=2 then
|
||||
begin
|
||||
iomode:=2;
|
||||
system.rewrite(f,1);
|
||||
end;
|
||||
case tempmode of
|
||||
1 : begin
|
||||
ofm:=filemode;
|
||||
iomode:=1;
|
||||
filemode:=0;
|
||||
system.reset(f,1);
|
||||
filemode:=ofm;
|
||||
end;
|
||||
2 : begin
|
||||
iomode:=2;
|
||||
system.rewrite(f,1);
|
||||
end;
|
||||
end;
|
||||
system.seek(f,temppos);
|
||||
tempclosed:=false;
|
||||
end;
|
||||
end;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
|
||||
end.
|
||||
{
|
||||
$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
|
||||
* unit in interface uses and implementation uses gives error now
|
||||
* only one error for unknown symbol (uses lastsymknown boolean)
|
||||
|
@ -192,15 +192,11 @@ unit pmodules;
|
||||
Message1(unit_f_cant_compile_unit,hp^.modulename^)
|
||||
else
|
||||
begin
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if assigned(oldhp^.current_inputfile) then
|
||||
oldhp^.current_inputfile^.tempclose;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
compile(hp^.mainsource^,compile_system);
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if not oldhp^.compiled then
|
||||
if (not oldhp^.compiled) and assigned(oldhp^.current_inputfile) then
|
||||
oldhp^.current_inputfile^.tempreopen;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
@ -274,15 +270,11 @@ unit pmodules;
|
||||
Message1(unit_f_cant_compile_unit,hp^.modulename^)
|
||||
else
|
||||
begin
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if assigned(oldhp^.current_inputfile) then
|
||||
oldhp^.current_inputfile^.tempclose;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
compile(hp^.mainsource^,compile_system);
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if not oldhp^.compiled then
|
||||
if (not oldhp^.compiled) and assigned(oldhp^.current_inputfile) then
|
||||
oldhp^.current_inputfile^.tempreopen;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
@ -335,13 +327,9 @@ unit pmodules;
|
||||
Message1(unit_f_cant_compile_unit,hp^.unitname^)
|
||||
else
|
||||
begin
|
||||
{ifdef TEST_TEMPCLOSE}
|
||||
oldhp^.current_inputfile^.tempclose;
|
||||
{endif TEST_TEMPCLOSE}
|
||||
compile(hp^.mainsource^,compile_system);
|
||||
{ifdef TEST_TEMPCLOSE}
|
||||
oldhp^.current_inputfile^.tempclose;
|
||||
{endif TEST_TEMPCLOSE}
|
||||
end;
|
||||
exit;
|
||||
end; *)
|
||||
@ -411,15 +399,11 @@ unit pmodules;
|
||||
Message1(unit_f_cant_compile_unit,hp^.modulename^)
|
||||
else
|
||||
begin
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if assigned(old_current_module^.current_inputfile) then
|
||||
old_current_module^.current_inputfile^.tempclose;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
compile(hp^.mainsource^,compile_system);
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if not old_current_module^.compiled then
|
||||
if (not old_current_module^.compiled) and assigned(old_current_module^.current_inputfile) then
|
||||
old_current_module^.current_inputfile^.tempreopen;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -480,16 +464,12 @@ unit pmodules;
|
||||
hp^.sourcefiles.done;
|
||||
hp^.sourcefiles.init;
|
||||
{$endif not UseBrowser}
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if assigned(old_current_module^.current_inputfile) then
|
||||
old_current_module^.current_inputfile^.tempclose;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
Message1(parser_d_compiling_second_time,hp^.mainsource^);
|
||||
compile(hp^.mainsource^,compile_system);
|
||||
{$ifdef TEST_TEMPCLOSE}
|
||||
if not old_current_module^.compiled then
|
||||
if (not old_current_module^.compiled) and assigned(old_current_module^.current_inputfile) then
|
||||
old_current_module^.current_inputfile^.tempreopen;
|
||||
{$endif TEST_TEMPCLOSE}
|
||||
end;
|
||||
current_module^.compiled:=true;
|
||||
end;
|
||||
@ -1001,7 +981,10 @@ unit pmodules;
|
||||
end.
|
||||
{
|
||||
$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
|
||||
* rename bis,von -> high,low
|
||||
* moved some systemunit loading/creating to psystem.pas
|
||||
|
Loading…
Reference in New Issue
Block a user