ソースを参照

* TScannerFile.SetInvalid added that will also reset inputfile

peter 23 年 前
コミット
fb64d51f69
4 ファイル変更39 行追加14 行削除
  1. 6 3
      compiler/fmodule.pas
  2. 5 2
      compiler/fppu.pas
  3. 9 6
      compiler/parser.pas
  4. 19 3
      compiler/scanner.pas

+ 6 - 3
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

+ 5 - 2
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

+ 9 - 6
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

+ 19 - 3
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