* moved more inputfile things from tscannerfile to tinputfile

* changed ifdef Sourceline to cs_asm_source
This commit is contained in:
peter 1998-09-03 11:24:00 +00:00
parent e6649d5f16
commit 2f528ca8d9
4 changed files with 347 additions and 291 deletions

View File

@ -32,12 +32,21 @@ unit files;
{$ifdef FPC} {$ifdef FPC}
maxunits = 1024; maxunits = 1024;
InputFileBufSize=32*1024; InputFileBufSize=32*1024;
linebufincrease=512;
{$else} {$else}
maxunits = 128; maxunits = 128;
InputFileBufSize=1024; InputFileBufSize=1024;
linebufincrease=64;
{$endif} {$endif}
type type
{$ifdef FPC}
tlongintarr = array[0..1000000] of longint;
{$else}
tlongintarr = array[0..16000] of longint;
{$endif}
plongintarr = ^tlongintarr;
pinputfile = ^tinputfile; pinputfile = ^tinputfile;
tinputfile = object tinputfile = object
path,name : pstring; { path and filename } path,name : pstring; { path and filename }
@ -47,17 +56,17 @@ unit files;
is_macro, is_macro,
endoffile, { still bytes left to read } endoffile, { still bytes left to read }
closed : boolean; { is the file closed } closed : boolean; { is the file closed }
inputbufsize : longint; { max size of the input buffer }
savebufstart, { save fields for scanner } buf : pchar; { buffer }
savebufsize, bufstart, { buffer start position in the file }
bufsize, { amount of bytes in the buffer }
maxbufsize : longint; { size in memory for the buffer }
saveinputpointer : pchar; { save fields for scanner variables }
savelastlinepos, savelastlinepos,
saveline_no : longint; saveline_no : longint;
saveinputbuffer, linebuf : plongintarr; { line buffer to retrieve lines }
saveinputpointer : pchar;
linebuf : plongint; { line buffer to retrieve lines }
maxlinebuf : longint; maxlinebuf : longint;
ref_count : longint; { to handle the browser refs } ref_count : longint; { to handle the browser refs }
@ -66,9 +75,16 @@ unit files;
constructor init(const fn:string); constructor init(const fn:string);
destructor done; destructor done;
{$ifdef SourceLine} procedure setpos(l:longint);
procedure seekbuf(fpos:longint);
procedure readbuf;
function open:boolean;
procedure close;
procedure tempclose;
function tempopen:boolean;
procedure setmacro(p:pchar;len:longint);
procedure setline(line,linepos:longint);
function getlinestr(l:longint):string; function getlinestr(l:longint):string;
{$endif SourceLine}
end; end;
pfilemanager = ^tfilemanager; pfilemanager = ^tfilemanager;
@ -118,7 +134,6 @@ unit files;
{ used in firstpass for faster settings } { used in firstpass for faster settings }
scanner : pointer; scanner : pointer;
current_index : word;
path, { path where the module is find/created } path, { path where the module is find/created }
modulename, { name of the module in uppercase } modulename, { name of the module in uppercase }
@ -183,22 +198,21 @@ unit files;
is_macro:=false; is_macro:=false;
endoffile:=false; endoffile:=false;
closed:=true; closed:=true;
inputbufsize:=InputFileBufSize; buf:=nil;
saveinputbuffer:=nil; bufstart:=0;
bufsize:=0;
maxbufsize:=InputFileBufSize;
{ save fields }
saveinputpointer:=nil; saveinputpointer:=nil;
savebufstart:=0;
savebufsize:=0;
saveline_no:=0; saveline_no:=0;
savelastlinepos:=0; savelastlinepos:=0;
{ indexing refs } { indexing refs }
ref_next:=nil; ref_next:=nil;
ref_count:=0; ref_count:=0;
ref_index:=0; ref_index:=0;
{$ifdef SourceLine}
{ line buffer } { line buffer }
linebuf:=nil; linebuf:=nil;
maxlinebuf:=0; maxlinebuf:=0;
{$endif SourceLine}
end; end;
@ -206,24 +220,204 @@ unit files;
begin begin
stringdispose(path); stringdispose(path);
stringdispose(name); stringdispose(name);
{$ifdef SourceLine}
{ free memory } { free memory }
if assigned(linebuf) then if assigned(linebuf) then
freemem(linebuf,maxlinebuf shl 2); freemem(linebuf,maxlinebuf shl 2);
{$endif SourceLine}
end; end;
{$ifdef SourceLine} procedure tinputfile.setpos(l:longint);
begin
bufstart:=l;
end;
procedure tinputfile.seekbuf(fpos:longint);
begin
if closed then
exit;
seek(f,fpos);
bufstart:=fpos;
bufsize:=0;
end;
procedure tinputfile.readbuf;
{$ifdef TP}
var
w : word;
{$endif}
begin
if is_macro then
endoffile:=true;
if closed then
exit;
inc(bufstart,bufsize);
{$ifdef TP}
blockread(f,buf^,maxbufsize-1,w);
bufsize:=w;
{$else}
blockread(f,buf^,maxbufsize-1,bufsize);
{$endif}
buf[bufsize]:=#0;
endoffile:=not(bufsize=maxbufsize-1);
end;
function tinputfile.open:boolean;
var
ofm : byte;
begin
open:=false;
if not closed then
Close;
ofm:=filemode;
filemode:=0;
Assign(f,path^+name^);
{$I-}
reset(f,1);
{$I+}
filemode:=ofm;
if ioresult<>0 then
exit;
{ file }
endoffile:=false;
closed:=false;
Getmem(buf,MaxBufsize);
bufstart:=0;
bufsize:=0;
open:=true;
end;
procedure tinputfile.close;
var
i : word;
begin
if is_macro then
begin
Freemem(buf,maxbufsize);
is_macro:=false;
closed:=true;
exit;
end;
if not closed then
begin
{$I-}
system.close(f);
{$I+}
i:=ioresult;
Freemem(buf,maxbufsize);
closed:=true;
end;
buf:=nil;
bufstart:=0;
end;
procedure tinputfile.tempclose;
var
i : word;
begin
if is_macro then
exit;
if not closed then
begin
{$I-}
system.close(f);
{$I+}
i:=ioresult;
Freemem(buf,maxbufsize);
buf:=nil;
closed:=true;
end;
end;
function tinputfile.tempopen:boolean;
var
ofm : byte;
begin
tempopen:=false;
if is_macro then
begin
tempopen:=true;
exit;
end;
if not closed then
exit;
ofm:=filemode;
filemode:=0;
Assign(f,path^+name^);
{$I-}
reset(f,1);
{$I+}
filemode:=ofm;
if ioresult<>0 then
exit;
closed:=false;
{ get new mem }
Getmem(buf,maxbufsize);
{ restore state }
seek(f,BufStart);
bufsize:=0;
readbuf;
tempopen:=true;
end;
procedure tinputfile.setmacro(p:pchar;len:longint);
begin
{ create new buffer }
getmem(buf,len+1);
move(p^,buf^,len);
buf[len]:=#0;
{ reset }
bufstart:=0;
bufsize:=len;
maxbufsize:=len+1;
is_macro:=true;
endoffile:=true;
closed:=true;
end;
procedure tinputfile.setline(line,linepos:longint);
var
oldlinebuf : plongintarr;
begin
if line<1 then
exit;
while (line>=maxlinebuf) do
begin
oldlinebuf:=linebuf;
{ create new linebuf and move old info }
getmem(linebuf,(maxlinebuf+linebufincrease) shl 2);
if assigned(oldlinebuf) then
begin
move(oldlinebuf^,linebuf^,maxlinebuf shl 2);
freemem(oldlinebuf,maxlinebuf shl 2);
end;
fillchar(linebuf^[maxlinebuf],linebufincrease shl 2,0);
inc(maxlinebuf,linebufincrease);
end;
linebuf^[line]:=linepos;
end;
function tinputfile.getlinestr(l:longint):string; function tinputfile.getlinestr(l:longint):string;
var var
c : char; c : char;
i,fpos : longint; i,
fpos : longint;
p : pchar;
begin begin
getlinestr:=''; getlinestr:='';
if l<maxlinebuf then if l<maxlinebuf then
begin begin
fpos:=plongint(longint(linebuf)+line_no*2)^; fpos:=linebuf^[l];
if closed then
open;
{ in current buf ? } { in current buf ? }
if (fpos<bufstart) or (fpos>bufstart+bufsize) then if (fpos<bufstart) or (fpos>bufstart+bufsize) then
begin begin
@ -232,23 +426,25 @@ unit files;
end; end;
{ the begin is in the buf now simply read until #13,#10 } { the begin is in the buf now simply read until #13,#10 }
i:=0; i:=0;
p:=@buf[fpos-bufstart];
inputpointer:=inputbuffer; repeat
c:=inputpointer^; c:=p^;
while (i<255) and not(c in [#13,#10]) do if c=#0 then
begin begin
readbuf;
p:=buf;
c:=p^;
end;
if c in [#10,#13] then
break;
inc(i); inc(i);
getlinestr[i]:=c; getlinestr[i]:=c;
c:=inputpointer^; inc(longint(p));
if c=#0 then until (i=255);
reload
else
inc(longint(inputpointer));
end;
getlinestr[0]:=chr(i); getlinestr[0]:=chr(i);
end; end;
end; end;
{$endif SourceLine}
{**************************************************************************** {****************************************************************************
TFILEMANAGER TFILEMANAGER
@ -568,7 +764,6 @@ unit files;
linkofiles.init; linkofiles.init;
linkstaticlibs.init; linkstaticlibs.init;
linksharedlibs.init; linksharedlibs.init;
current_index:=0;
ppufile:=nil; ppufile:=nil;
scanner:=nil; scanner:=nil;
map:=nil; map:=nil;
@ -665,7 +860,11 @@ unit files;
end. end.
{ {
$Log$ $Log$
Revision 1.41 1998-08-26 15:35:30 peter Revision 1.42 1998-09-03 11:24:00 peter
* moved more inputfile things from tscannerfile to tinputfile
* changed ifdef Sourceline to cs_asm_source
Revision 1.41 1998/08/26 15:35:30 peter
* fixed scannerfiles for macros * fixed scannerfiles for macros
+ $I %<environment>% + $I %<environment>%

View File

@ -282,10 +282,10 @@ unit pmodules;
Message1(unit_f_cant_compile_unit,current_module^.modulename^) Message1(unit_f_cant_compile_unit,current_module^.modulename^)
else else
begin begin
current_scanner^.tempclose; current_scanner^.tempcloseinputfile;
compile(current_module^.mainsource^,compile_system); compile(current_module^.mainsource^,compile_system);
if (not old_current_module^.compiled) then if (not old_current_module^.compiled) then
current_scanner^.tempopen; current_scanner^.tempopeninputfile;
end; end;
end end
else else
@ -915,7 +915,11 @@ unit pmodules;
end. end.
{ {
$Log$ $Log$
Revision 1.45 1998-08-31 12:26:28 peter Revision 1.46 1998-09-03 11:24:01 peter
* moved more inputfile things from tscannerfile to tinputfile
* changed ifdef Sourceline to cs_asm_source
Revision 1.45 1998/08/31 12:26:28 peter
* m68k and palmos updates from surebugfixes * m68k and palmos updates from surebugfixes
Revision 1.44 1998/08/26 15:35:33 peter Revision 1.44 1998/08/26 15:35:33 peter

View File

@ -553,17 +553,16 @@ const
{ first look in the path of _d then currentmodule } { first look in the path of _d then currentmodule }
path:=search(name+ext,path+';'+current_scanner^.inputfile^.path^+';'+includesearchpath,found); path:=search(name+ext,path+';'+current_scanner^.inputfile^.path^+';'+includesearchpath,found);
{ shutdown current file } { shutdown current file }
current_scanner^.tempclose; current_scanner^.tempcloseinputfile;
{ load new file } { load new file }
hp:=new(pinputfile,init(path+name+ext)); hp:=new(pinputfile,init(path+name+ext));
current_scanner^.addfile(hp); current_scanner^.addfile(hp);
if not current_scanner^.open then if not current_scanner^.openinputfile then
Message1(scan_f_cannot_open_includefile,hs); Message1(scan_f_cannot_open_includefile,hs);
Message1(scan_u_start_include_file,current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^); Message1(scan_u_start_include_file,current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
current_scanner^.reload; current_scanner^.reload;
{ register for refs } { register for refs }
current_module^.sourcefiles.register_file(hp); current_module^.sourcefiles.register_file(hp);
current_module^.current_index:=hp^.ref_index;
end; end;
end; end;
@ -916,7 +915,11 @@ const
{ {
$Log$ $Log$
Revision 1.25 1998-09-02 15:13:31 peter Revision 1.26 1998-09-03 11:24:02 peter
* moved more inputfile things from tscannerfile to tinputfile
* changed ifdef Sourceline to cs_asm_source
Revision 1.25 1998/09/02 15:13:31 peter
* fixed typo in directive table * fixed typo in directive table
Revision 1.24 1998/09/01 12:52:06 peter Revision 1.24 1998/09/01 12:52:06 peter

View File

@ -33,10 +33,8 @@ unit scanner;
const const
{$ifdef TP} {$ifdef TP}
maxmacrolen=1024; maxmacrolen=1024;
linebufincrease=64;
{$else} {$else}
maxmacrolen=16*1024; maxmacrolen=16*1024;
linebufincrease=512;
{$endif} {$endif}
id_len = 14; id_len = 14;
@ -146,16 +144,14 @@ unit scanner;
tscannerfile = object tscannerfile = object
inputfile : pinputfile; { current inputfile list } inputfile : pinputfile; { current inputfile list }
{ these fields are called save* in inputfile, and are here inputbuffer, { input buffer }
for speed reasons (PFV) }
bufstart,
bufsize,
line_no,
lastlinepos : longint;
inputbuffer,
inputpointer : pchar; inputpointer : pchar;
inputstart : longint;
lasttokenpos : longint; line_no, { line }
lastlinepos : longint;
lasttokenpos : longint; { token }
lasttoken : ttoken; lasttoken : ttoken;
do_special, { 1=point after nr, 2=caret after id } do_special, { 1=point after nr, 2=caret after id }
@ -167,18 +163,15 @@ unit scanner;
constructor init(const fn:string); constructor init(const fn:string);
destructor done; destructor done;
{ File buffer things } { File buffer things }
function open:boolean; function openinputfile:boolean;
procedure close; procedure closeinputfile;
procedure tempclose; function tempopeninputfile:boolean;
function tempopen:boolean; procedure tempcloseinputfile;
procedure seekbuf(fpos:longint);
procedure readbuf;
procedure saveinputfile; procedure saveinputfile;
procedure restoreinputfile; procedure restoreinputfile;
procedure nextfile; procedure nextfile;
procedure addfile(hp:pinputfile); procedure addfile(hp:pinputfile);
procedure reload; procedure reload;
procedure setbuf(p:pchar;l:longint);
procedure insertmacro(p:pchar;len:longint); procedure insertmacro(p:pchar;len:longint);
{ Scanner things } { Scanner things }
procedure gettokenpos; procedure gettokenpos;
@ -305,20 +298,23 @@ implementation
begin begin
inputfile:=new(pinputfile,init(fn)); inputfile:=new(pinputfile,init(fn));
current_module^.sourcefiles.register_file(inputfile); current_module^.sourcefiles.register_file(inputfile);
current_module^.current_index:=inputfile^.ref_index; { reset localinput }
{ load inputfile values } inputbuffer:=nil;
restoreinputfile; inputpointer:=nil;
inputstart:=0;
{ reset scanner } { reset scanner }
preprocstack:=nil; preprocstack:=nil;
comment_level:=0; comment_level:=0;
do_special:=0; do_special:=0;
yylexcount:=0; yylexcount:=0;
block_type:=bt_general; block_type:=bt_general;
line_no:=0;
lastlinepos:=0;
lasttokenpos:=0; lasttokenpos:=0;
lasttoken:=_END; lasttoken:=_END;
lastasmgetchar:=#0; lastasmgetchar:=#0;
{ load block } { load block }
if not open then if not openinputfile then
Message1(scan_f_cannot_open_input,fn); Message1(scan_f_cannot_open_input,fn);
reload; reload;
end; end;
@ -329,178 +325,61 @@ implementation
checkpreprocstack; checkpreprocstack;
{ close file } { close file }
if not inputfile^.closed then if not inputfile^.closed then
close; closeinputfile;
end; end;
procedure tscannerfile.seekbuf(fpos:longint); function tscannerfile.openinputfile:boolean;
begin begin
with inputfile^ do openinputfile:=inputfile^.open;
begin { load buffer }
if closed then inputbuffer:=inputfile^.buf;
exit; inputpointer:=inputfile^.buf;
seek(f,fpos); inputstart:=inputfile^.bufstart;
bufstart:=fpos;
bufsize:=0;
end;
end;
procedure tscannerfile.readbuf;
{$ifdef TP}
var
w : word;
{$endif}
begin
with inputfile^ do
begin
if is_macro then
endoffile:=true;
if closed then
exit;
inc(bufstart,bufsize);
{$ifdef TP}
blockread(f,inputbuffer^,inputbufsize-1,w);
bufsize:=w;
{$else}
blockread(f,inputbuffer^,inputbufsize-1,bufsize);
{$endif}
inputbuffer[bufsize]:=#0;
endoffile:=not(bufsize=inputbufsize-1);
end;
end;
function tscannerfile.open:boolean;
var
ofm : byte;
begin
with inputfile^ do
begin
open:=false;
if not closed then
Close;
ofm:=filemode;
filemode:=0;
Assign(f,path^+name^);
{$I-}
reset(f,1);
{$I+}
filemode:=ofm;
if ioresult<>0 then
exit;
{ file }
endoffile:=false;
closed:=false;
Getmem(inputbuffer,inputbufsize);
inputpointer:=inputbuffer;
bufstart:=0;
bufsize:=0;
{ line } { line }
line_no:=0; line_no:=0;
lastlinepos:=0; lastlinepos:=0;
lasttokenpos:=0; lasttokenpos:=0;
open:=true;
end;
end; end;
procedure tscannerfile.close; procedure tscannerfile.closeinputfile;
var
i : word;
begin begin
with inputfile^ do inputfile^.close;
begin { reset buffer }
if is_macro then
begin
Freemem(inputbuffer,inputbufsize);
is_macro:=false;
closed:=true;
exit;
end;
if not closed then
begin
{$I-}
system.close(f);
{$I+}
i:=ioresult;
Freemem(inputbuffer,inputbufsize);
closed:=true;
end;
inputbuffer:=nil; inputbuffer:=nil;
inputpointer:=nil; inputpointer:=nil;
inputstart:=0;
{ reset line }
line_no:=0;
lastlinepos:=0; lastlinepos:=0;
lasttokenpos:=0; lasttokenpos:=0;
bufstart:=0;
end;
end; end;
procedure tscannerfile.tempclose; function tscannerfile.tempopeninputfile:boolean;
var
i : word;
begin begin
with inputfile^ do tempopeninputfile:=inputfile^.tempopen;
{ reload buffer }
inputbuffer:=inputfile^.buf;
inputpointer:=inputfile^.buf;
inputstart:=inputfile^.bufstart;
end;
procedure tscannerfile.tempcloseinputfile;
begin begin
inc(bufstart,inputpointer-inputbuffer); inputfile^.setpos(inputstart+(inputpointer-inputbuffer));
if is_macro then inputfile^.tempclose;
exit; { reset buffer }
if not closed then
begin
{$I-}
system.close(f);
{$I+}
i:=ioresult;
Freemem(inputbuffer,inputbufsize);
inputbuffer:=nil; inputbuffer:=nil;
inputpointer:=nil; inputpointer:=nil;
closed:=true; inputstart:=0;
end;
end;
end;
function tscannerfile.tempopen:boolean;
var
ofm : byte;
begin
with inputfile^ do
begin
tempopen:=false;
if is_macro then
begin
tempopen:=true;
exit;
end;
if not closed then
exit;
ofm:=filemode;
filemode:=0;
Assign(f,path^+name^);
{$I-}
reset(f,1);
{$I+}
filemode:=ofm;
if ioresult<>0 then
exit;
closed:=false;
{ get new mem }
Getmem(inputbuffer,inputbufsize);
inputpointer:=inputbuffer;
{ restore state }
seek(f,BufStart);
bufsize:=0;
readbuf;
tempopen:=true;
end;
end; end;
procedure tscannerfile.saveinputfile; procedure tscannerfile.saveinputfile;
begin begin
inputfile^.savebufstart:=bufstart;
inputfile^.savebufsize:=bufsize;
inputfile^.saveinputbuffer:=inputbuffer;
inputfile^.saveinputpointer:=inputpointer; inputfile^.saveinputpointer:=inputpointer;
inputfile^.savelastlinepos:=lastlinepos; inputfile^.savelastlinepos:=lastlinepos;
inputfile^.saveline_no:=line_no; inputfile^.saveline_no:=line_no;
@ -509,12 +388,9 @@ implementation
procedure tscannerfile.restoreinputfile; procedure tscannerfile.restoreinputfile;
begin begin
bufstart:=inputfile^.savebufstart; inputpointer:=inputfile^.saveinputpointer;
bufsize:=inputfile^.savebufsize;
lastlinepos:=inputfile^.savelastlinepos; lastlinepos:=inputfile^.savelastlinepos;
line_no:=inputfile^.saveline_no; line_no:=inputfile^.saveline_no;
inputbuffer:=inputfile^.saveinputbuffer;
inputpointer:=inputfile^.saveinputpointer;
end; end;
@ -556,13 +432,20 @@ implementation
if not endoffile then if not endoffile then
begin begin
readbuf; readbuf;
inputpointer:=buf;
inputbuffer:=buf;
inputstart:=bufstart;
{ first line? }
if line_no=0 then if line_no=0 then
begin
line_no:=1; line_no:=1;
inputpointer:=inputbuffer; if cs_asm_source in aktglobalswitches then
inputfile^.setline(line_no,bufstart);
end;
end end
else else
begin begin
close; closeinputfile;
{ no next module, than EOF } { no next module, than EOF }
if not assigned(inputfile^.next) then if not assigned(inputfile^.next) then
begin begin
@ -571,11 +454,9 @@ implementation
end; end;
{ load next file and reopen it } { load next file and reopen it }
nextfile; nextfile;
tempopen; tempopeninputfile;
{ status } { status }
Message1(scan_d_back_in,inputfile^.name^); Message1(scan_d_back_in,name^);
{ load some current_module fields }
current_module^.current_index:=inputfile^.ref_index;
end; end;
{ load next char } { load next char }
c:=inputpointer^; c:=inputpointer^;
@ -585,60 +466,41 @@ implementation
end; end;
procedure tscannerfile.setbuf(p:pchar;l:longint);
begin
with inputfile^ do
begin
inputbufsize:=l;
inputbuffer:=p;
inputpointer:=p;
end;
end;
procedure tscannerfile.insertmacro(p:pchar;len:longint); procedure tscannerfile.insertmacro(p:pchar;len:longint);
{ load the values of tokenpos and lasttokenpos }
var var
macbuf : pchar;
hp : pinputfile; hp : pinputfile;
begin begin
{ save old postion } { save old postion }
dec(longint(inputpointer)); dec(longint(inputpointer));
current_scanner^.tempclose; tempcloseinputfile;
{ create macro 'file' } { create macro 'file' }
hp:=new(pinputfile,init('Macro')); hp:=new(pinputfile,init('Macro'));
addfile(hp); addfile(hp);
getmem(macbuf,len+1);
setbuf(macbuf,len+1);
{ fill buffer }
with inputfile^ do with inputfile^ do
begin begin
move(p^,inputbuffer^,len); setmacro(p,len);
inputbuffer[len]:=#0; { local buffer }
{ reset } inputbuffer:=buf;
inputpointer:=inputbuffer; inputpointer:=buf;
bufstart:=0; inputstart:=bufstart;
bufsize:=len; end;
{ reset line }
line_no:=0; line_no:=0;
lastlinepos:=0; lastlinepos:=0;
lasttokenpos:=0; lasttokenpos:=0;
is_macro:=true;
endoffile:=true;
closed:=true;
{ load new c } { load new c }
c:=inputpointer^; c:=inputpointer^;
inc(longint(inputpointer)); inc(longint(inputpointer));
end; end;
end;
procedure tscannerfile.gettokenpos; procedure tscannerfile.gettokenpos;
{ load the values of tokenpos and lasttokenpos } { load the values of tokenpos and lasttokenpos }
begin begin
lasttokenpos:=bufstart+(inputpointer-inputbuffer); lasttokenpos:=inputstart+(inputpointer-inputbuffer);
tokenpos.line:=line_no; tokenpos.line:=line_no;
tokenpos.column:=lasttokenpos-lastlinepos; tokenpos.column:=lasttokenpos-lastlinepos;
tokenpos.fileindex:=current_module^.current_index; tokenpos.fileindex:=inputfile^.ref_index;
aktfilepos:=tokenpos; aktfilepos:=tokenpos;
end; end;
@ -671,10 +533,8 @@ implementation
procedure tscannerfile.linebreak; procedure tscannerfile.linebreak;
var var
cur : char; cur : char;
{$ifdef SourceLine} oldtokenpos,
hp : plongint; oldaktfilepos : tfileposinfo;
{$endif SourceLine}
oldtokenpos,oldaktfilepos : tfileposinfo;
begin begin
with inputfile^ do with inputfile^ do
begin begin
@ -696,22 +556,8 @@ implementation
lastlinepos:=bufstart+(inputpointer-inputbuffer); lastlinepos:=bufstart+(inputpointer-inputbuffer);
inc(line_no); inc(line_no);
{ update linebuffer } { update linebuffer }
{$ifdef SourceLine} if cs_asm_source in aktglobalswitches then
if line_no>maxlinebuf then inputfile^.setline(line_no,lastlinepos);
begin
{ create new linebuf and move old info }
getmem(hp,maxlinebuf+linebufincrease);
if assigned(linebuf) then
begin
move(linebuf^,hp^,maxlinebuf shl 2);
freemem(linebuf,maxlinebuf);
end;
{ set new linebuf }
linebuf:=hp;
inc(maxlinebuf,linebufincrease);
end;
plongint(longint(linebuf)+line_no*2)^:=lastlinepos;
{$endif SourceLine}
{ update for status and call the show status routine, { update for status and call the show status routine,
but don't touch aktfilepos ! } but don't touch aktfilepos ! }
oldaktfilepos:=aktfilepos; oldaktfilepos:=aktfilepos;
@ -1623,7 +1469,11 @@ exit_label:
end. end.
{ {
$Log$ $Log$
Revision 1.48 1998-09-01 12:51:02 peter Revision 1.49 1998-09-03 11:24:03 peter
* moved more inputfile things from tscannerfile to tinputfile
* changed ifdef Sourceline to cs_asm_source
Revision 1.48 1998/09/01 12:51:02 peter
* close also resets lastlinepos * close also resets lastlinepos
Revision 1.47 1998/09/01 09:01:52 peter Revision 1.47 1998/09/01 09:01:52 peter