From fb64d51f69a09ea12b43dff8b82595dcb0321a98 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 11 Aug 2002 14:28:19 +0000 Subject: [PATCH] * TScannerFile.SetInvalid added that will also reset inputfile --- compiler/fmodule.pas | 9 ++++++--- compiler/fppu.pas | 7 +++++-- compiler/parser.pas | 15 +++++++++------ compiler/scanner.pas | 22 +++++++++++++++++++--- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/compiler/fmodule.pas b/compiler/fmodule.pas index 9b4a222749..d615a4374c 100644 --- a/compiler/fmodule.pas +++ b/compiler/fmodule.pas @@ -434,7 +434,7 @@ uses externals.free; externals:=nil; if assigned(scanner) then - tscannerfile(scanner).invalid:=true; + tscannerfile(scanner).SetInvalid; used_units.free; dependent_units.free; resourcefiles.Free; @@ -488,7 +488,7 @@ uses pm : tdependent_unit; begin if assigned(scanner) then - tscannerfile(scanner).invalid:=true; + tscannerfile(scanner).SetInvalid; if assigned(globalsymtable) then begin globalsymtable.free; @@ -595,7 +595,10 @@ uses end. { $Log$ - Revision 1.24 2002-08-11 13:24:11 peter + Revision 1.25 2002-08-11 14:28:19 peter + * TScannerFile.SetInvalid added that will also reset inputfile + + Revision 1.24 2002/08/11 13:24:11 peter * saving of asmsymbols in ppu supported * asmsymbollist global is removed and moved into a new class tasmlibrarydata that will hold the info of a .a file which diff --git a/compiler/fppu.pas b/compiler/fppu.pas index 783dec5b0a..663acea8f4 100644 --- a/compiler/fppu.pas +++ b/compiler/fppu.pas @@ -1092,7 +1092,7 @@ uses current_scanner.tempcloseinputfile; name:=mainsource^; if assigned(scanner) then - tscannerfile(scanner).invalid:=true; + tscannerfile(scanner).SetInvalid; { compile this module } current_module:=self; compile(name); @@ -1259,7 +1259,10 @@ uses end. { $Log$ - Revision 1.18 2002-08-11 13:24:11 peter + Revision 1.19 2002-08-11 14:28:19 peter + * TScannerFile.SetInvalid added that will also reset inputfile + + Revision 1.18 2002/08/11 13:24:11 peter * saving of asmsymbols in ppu supported * asmsymbollist global is removed and moved into a new class tasmlibrarydata that will hold the info of a .a file which diff --git a/compiler/parser.pas b/compiler/parser.pas index 2887a9d909..6927185635 100644 --- a/compiler/parser.pas +++ b/compiler/parser.pas @@ -71,7 +71,7 @@ implementation aktprocsym:=nil; aktprocdef:=nil; - current_library:=nil; + objectlibrary:=nil; current_module:=nil; compiled_module:=nil; procinfo:=nil; @@ -262,7 +262,7 @@ implementation olddebuglist, oldwithdebuglist, oldconsts : taasmoutput; - oldcurrent_library : tasmlibrarydata; + oldobjectlibrary : tasmlibrarydata; { resourcestrings } OldResourceStrings : tResourceStrings; { akt.. things } @@ -331,7 +331,7 @@ implementation oldexports:=exportssection; oldresource:=resourcesection; oldresourcestringlist:=resourcestringlist; - oldcurrent_library:=current_library; + oldobjectlibrary:=objectlibrary; OldResourceStrings:=ResourceStrings; { save akt... state } { handle the postponed case first } @@ -478,7 +478,7 @@ implementation { restore previous scanner !! } current_module.scanner:=prev_scanner; if assigned(prev_scanner) then - prev_scanner.invalid:=true; + prev_scanner.SetInvalid; if (compile_level>1) then begin @@ -513,7 +513,7 @@ implementation resourcestringlist:=oldresourcestringlist; { object data } ResourceStrings:=OldResourceStrings; - current_library:=oldcurrent_library; + objectlibrary:=oldobjectlibrary; { restore symtable state } refsymtable:=oldrefsymtable; symtablestack:=oldsymtablestack; @@ -611,7 +611,10 @@ implementation end. { $Log$ - Revision 1.37 2002-08-11 13:24:12 peter + Revision 1.38 2002-08-11 14:28:19 peter + * TScannerFile.SetInvalid added that will also reset inputfile + + Revision 1.37 2002/08/11 13:24:12 peter * saving of asmsymbols in ppu supported * asmsymbollist global is removed and moved into a new class tasmlibrarydata that will hold the info of a .a file which diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 7f373aa45f..045b279c7c 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -79,6 +79,9 @@ interface end; tscannerfile = class + private + FInvalid : boolean; { flag if sourcefiles have been destroyed ! } + public inputfile : tinputfile; { current inputfile list } inputbuffer, { input buffer } @@ -97,7 +100,6 @@ interface lastasmgetchar : char; ignoredirectives : tstringlist; { ignore directives, used to give warnings only once } preprocstack : tpreprocstack; - invalid : boolean; { flag if sourcefiles have been destroyed ! } macros : Tdictionary; in_asm_string : boolean; @@ -107,6 +109,7 @@ interface constructor Create(const fn:string); destructor Destroy;override; { File buffer things } + procedure setinvalid; function openinputfile:boolean; procedure closeinputfile; function tempopeninputfile:boolean; @@ -148,6 +151,7 @@ interface procedure readtoken; function readpreproc:ttoken; function asmgetchar:char; + property Invalid:boolean read FInvalid; end; {$ifdef PREPROCWRITE} @@ -911,7 +915,7 @@ implementation nexttoken:=NOTOKEN; lastasmgetchar:=#0; ignoredirectives:=TStringList.Create; - invalid:=false; + Finvalid:=false; in_asm_string:=false; macros:=tdictionary.create; end; @@ -996,6 +1000,15 @@ implementation end; + procedure tscannerfile.setinvalid; + begin + { mark the tscannerfile as invalid and reset inputfile + so it can not be reused } + Finvalid:=true; + inputfile:=nil; + end; + + function tscannerfile.openinputfile:boolean; begin openinputfile:=inputfile.open; @@ -2783,7 +2796,10 @@ exit_label: end. { $Log$ - Revision 1.42 2002-08-10 14:46:31 carl + Revision 1.43 2002-08-11 14:28:19 peter + * TScannerFile.SetInvalid added that will also reset inputfile + + Revision 1.42 2002/08/10 14:46:31 carl + moved target_cpu_string to cpuinfo * renamed asmmode enum. * assembler reader has now less ifdef's