瀏覽代碼

* released NEWINPUT

peter 27 年之前
父節點
當前提交
1bffd4e290

+ 7 - 15
compiler/aasm.pas

@@ -76,9 +76,8 @@ unit aasm;
        { the short name makes typing easier }
        { the short name makes typing easier }
        pai = ^tai;
        pai = ^tai;
        tai = object(tlinkedlist_item)
        tai = object(tlinkedlist_item)
-          typ    : tait;
-          line   : longint;
-          infile : pinputfile;
+          typ      : tait;
+          fileinfo : tfileposinfo;
           constructor init;
           constructor init;
        end;
        end;
 
 
@@ -309,17 +308,7 @@ uses
 
 
     constructor tai.init;
     constructor tai.init;
       begin
       begin
-{$ifdef GDB}
-  {$ifdef NEWINPUT}
-         infile:=pointer(current_module^.sourcefiles.get_file(aktfilepos.fileindex));
-         if assigned(infile) then
-           line:=aktfilepos.line;
-  {$else}
-         infile:=pointer(current_module^.current_inputfile);
-         if assigned(infile) then
-           line:=current_module^.current_inputfile^.line_no;
-  {$endif}
-{$endif GDB}
+        fileinfo:=aktfilepos;
       end;
       end;
 
 
 {****************************************************************************
 {****************************************************************************
@@ -843,7 +832,10 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  1998-07-07 11:19:50  peter
+  Revision 1.12  1998-07-14 14:46:36  peter
+    * released NEWINPUT
+
+  Revision 1.11  1998/07/07 11:19:50  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.10  1998/06/08 22:59:41  peter
   Revision 1.10  1998/06/08 22:59:41  peter

+ 44 - 59
compiler/ag68kgas.pas

@@ -53,14 +53,15 @@ unit ag68kgas;
       line_length = 70;
       line_length = 70;
 
 
     var
     var
-{$ifdef NEWINPUT}
-      infile : pinputfile;
-{$else}
-
-      infile : pextfile;
+{$ifdef GDB}
+      n_line  : byte;     { different types of source lines }
+      includecount : longint;
 {$endif}
 {$endif}
+      lastsec    : tsection; { last section type written }
+      lastsecidx,
+      lastfileindex,
+      lastline   : longint;
 
 
-      includecount,lastline : longint;
 
 
     function double2str(d : double) : string;
     function double2str(d : double) : string;
       var
       var
@@ -211,14 +212,6 @@ unit ag68kgas;
                              T68kGASASMOUTPUT
                              T68kGASASMOUTPUT
  ****************************************************************************}
  ****************************************************************************}
 
 
-    var
-{$ifdef GDB}
-       n_line : byte;
-{$endif}
-       lastsec : tsection;
-       lastsecidx : longint;
-
-
     const
     const
       ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
       ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
         (#9'.long'#9,'',#9'.short'#9,#9'.byte'#9);
         (#9'.long'#9,'',#9'.short'#9,#9'.byte'#9);
@@ -235,6 +228,8 @@ unit ag68kgas;
       pos,l,i   : longint;
       pos,l,i   : longint;
       found     : boolean;
       found     : boolean;
 {$ifdef GDB}
 {$ifdef GDB}
+      curr_n    : byte;
+      infile    : pinputfile;
       funcname  : pchar;
       funcname  : pchar;
       linecount : longint;
       linecount : longint;
 {$endif GDB}
 {$endif GDB}
@@ -255,37 +250,41 @@ unit ag68kgas;
             if not (hp^.typ in  [ait_external,ait_stabn,ait_stabs,
             if not (hp^.typ in  [ait_external,ait_stabn,ait_stabs,
                    ait_label,ait_cut,ait_align,ait_stab_function_name]) then
                    ait_label,ait_cut,ait_align,ait_stab_function_name]) then
              begin
              begin
-{$ifdef NEWINPUT}
-               if assigned(hp^.infile) and (pinputfile(hp^.infile)<>infile)  then
-{$else}
-               if assigned(hp^.infile) and (pextfile(hp^.infile)<>infile)  then
-{$endif NEWINPUT}
+             { file changed ? (must be before line info) }
+               if lastfileindex<>hp^.fileinfo.fileindex then
                 begin
                 begin
-                  infile:=hp^.infile;
-                  inc(includecount);
-                  if (hp^.infile^.path^<>'') then
+                  infile:=current_module^.sourcefiles.get_file(hp^.fileinfo.fileindex);
+                  if includecount=0 then
+                   curr_n:=n_sourcefile
+                  else
+                   curr_n:=n_includefile;
+                  if (infile^.path^<>'') then
                    begin
                    begin
-                     AsmWriteLn(#9'.stabs "'+FixPath(hp^.infile^.path^)+'",'+tostr(n_includefile)+
-                                ',0,0,Ltext'+ToStr(IncludeCount));
+                     AsmWriteLn(#9'.stabs "'+lower(BsToSlash(FixPath(infile^.path^)))+'",'+
+                       tostr(curr_n)+',0,0,'+'Ltext'+ToStr(IncludeCount));
                    end;
                    end;
-                  AsmWriteLn(#9'.stabs "'+FixFileName(hp^.infile^.name^+hp^.infile^.ext^)+'",'+tostr(n_includefile)+
-                             ',0,0,Ltext'+ToStr(IncludeCount));
+                  AsmWriteLn(#9'.stabs "'+lower(FixFileName(infile^.name^))+'",'+
+                    tostr(curr_n)+',0,0,'+'Ltext'+ToStr(IncludeCount));
                   AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
                   AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
+                  inc(includecount);
+                  lastfileindex:=hp^.fileinfo.fileindex;
                 end;
                 end;
-              { file name must be there before line number ! }
-               if (hp^.line<>lastline) and (hp^.line<>0) then
+             { line changed ? }
+               if (hp^.fileinfo.line<>lastline) and (hp^.fileinfo.line<>0) then
                 begin
                 begin
-                  if (n_line = n_textline) and assigned(funcname) and
+                  if (n_line=n_textline) and assigned(funcname) and
                      (target_os.use_function_relative_addresses) then
                      (target_os.use_function_relative_addresses) then
                    begin
                    begin
                      AsmWriteLn(target_asm.labelprefix+'l'+tostr(linecount)+':');
                      AsmWriteLn(target_asm.labelprefix+'l'+tostr(linecount)+':');
-                     AsmWriteLn(#9'.stabn '+tostr(n_line)+',0,'+tostr(hp^.line)+','+
-                                target_asm.labelprefix+'l'+tostr(linecount)+' - '+StrPas(FuncName));
+                     AsmWrite(#9'.stabn '+tostr(n_line)+',0,'+tostr(hp^.fileinfo.line)+','+
+                                target_asm.labelprefix+'l'+tostr(linecount)+' - ');
+                     AsmWritePChar(FuncName);
+                     AsmLn;
                      inc(linecount);
                      inc(linecount);
                    end
                    end
                   else
                   else
-                   AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(hp^.line));
-                  lastline:=hp^.line;
+                   AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(hp^.fileinfo.line));
+                  lastline:=hp^.fileinfo.line;
                 end;
                 end;
              end;
              end;
           end;
           end;
@@ -312,7 +311,6 @@ unit ag68kgas;
                            AsmWrite('$'+tostr(pai_section(hp)^.idataidx));
                            AsmWrite('$'+tostr(pai_section(hp)^.idataidx));
                           AsmLn;
                           AsmLn;
 {$ifdef GDB}
 {$ifdef GDB}
-
                           case pai_section(hp)^.sec of
                           case pai_section(hp)^.sec of
                            sec_code : n_line:=n_textline;
                            sec_code : n_line:=n_textline;
                            sec_data : n_line:=n_dataline;
                            sec_data : n_line:=n_dataline;
@@ -555,20 +553,24 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
     end;
     end;
 
 
     procedure tm68kgasasmlist.WriteAsmList;
     procedure tm68kgasasmlist.WriteAsmList;
-{$ifdef GDB}
     var
     var
       p:dirstr;
       p:dirstr;
       n:namestr;
       n:namestr;
       e:extstr;
       e:extstr;
-{$endif}
     begin
     begin
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
       if assigned(current_module^.mainsource) then
       if assigned(current_module^.mainsource) then
        comment(v_info,'Start writing gas-styled assembler output for '+current_module^.mainsource^);
        comment(v_info,'Start writing gas-styled assembler output for '+current_module^.mainsource^);
 {$endif}
 {$endif}
-      infile:=nil;
-      includecount:=0;
+
+      lastline:=0;
+      lastfileindex:=0;
+      LastSec:=sec_none;
 {$ifdef GDB}
 {$ifdef GDB}
+      includecount:=0;
+      n_line:=n_bssline;
+{$endif GDB}
+
       if assigned(current_module^.mainsource) then
       if assigned(current_module^.mainsource) then
        fsplit(current_module^.mainsource^,p,n,e)
        fsplit(current_module^.mainsource^,p,n,e)
       else
       else
@@ -579,26 +581,6 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
        end;
        end;
     { to get symify to work }
     { to get symify to work }
       AsmWriteLn(#9'.file "'+FixFileName(n+e)+'"');
       AsmWriteLn(#9'.file "'+FixFileName(n+e)+'"');
-    { stabs }
-      n_line:=n_bssline;
-      if (cs_debuginfo in aktswitches) then
-       begin
-         if (p<>'') then
-          AsmWriteLn(#9'.stabs "'+FixPath(p)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
-         AsmWriteLn(#9'.stabs "'+FixFileName(n+e)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
-         AsmWriteLn('Ltext0:');
-       end;
-      infile:=current_module^.sourcefiles.files;
-    { main source file is last in list }
-{$ifdef NEWINPUT}
-      while assigned(infile^.next) do
-       infile:=infile^.next;
-{$else}
-      while assigned(infile^._next) do
-       infile:=infile^._next;
-{$endif}
-      lastline:=0;
-{$endif GDB}
 
 
       { there should be nothing but externals so we don't need to process
       { there should be nothing but externals so we don't need to process
       WriteTree(externals); }
       WriteTree(externals); }
@@ -623,7 +605,10 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  1998-07-10 10:50:54  peter
+  Revision 1.7  1998-07-14 14:46:38  peter
+    * released NEWINPUT
+
+  Revision 1.6  1998/07/10 10:50:54  peter
     * m68k updates
     * m68k updates
 
 
   Revision 1.5  1998/06/05 17:46:04  peter
   Revision 1.5  1998/06/05 17:46:04  peter

+ 43 - 59
compiler/ag68kmit.pas

@@ -53,18 +53,16 @@ unit ag68kmit;
     const
     const
       line_length = 70;
       line_length = 70;
 
 
-{$ifdef GDB}
     var
     var
-{$ifdef NEWINPUT}
-      infile : pinputfile;
-{$else}
-
-      infile : pextfile;
+{$ifdef GDB}
+      n_line  : byte;     { different types of source lines }
+      includecount : longint;
 {$endif}
 {$endif}
+      lastsec    : tsection; { last section type written }
+      lastsecidx,
+      lastfileindex,
+      lastline   : longint;
 
 
-      includecount,
-      lastline : longint;
-{$endif GDB}
 
 
     function double2str(d : double) : string;
     function double2str(d : double) : string;
       var
       var
@@ -251,13 +249,6 @@ unit ag68kmit;
                              T68kGASASMOUTPUT
                              T68kGASASMOUTPUT
  ****************************************************************************}
  ****************************************************************************}
 
 
-    var
-{$ifdef GDB}
-      n_line  : byte;     { different types of source lines }
-{$endif}
-      lastsec : tsection; { last section type written }
-      lastsecidx : longint;
-
     const
     const
       ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
       ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
         (#9'.long'#9,'',#9'.short'#9,#9'.byte'#9);
         (#9'.long'#9,'',#9'.short'#9,#9'.byte'#9);
@@ -274,6 +265,8 @@ unit ag68kmit;
       pos,l,i   : longint;
       pos,l,i   : longint;
       found     : boolean;
       found     : boolean;
 {$ifdef GDB}
 {$ifdef GDB}
+      curr_n    : byte;
+      infile    : pinputfile;
       funcname  : pchar;
       funcname  : pchar;
       linecount : longint;
       linecount : longint;
 {$endif GDB}
 {$endif GDB}
@@ -294,37 +287,41 @@ unit ag68kmit;
             if not (hp^.typ in  [ait_external,ait_stabn,ait_stabs,
             if not (hp^.typ in  [ait_external,ait_stabn,ait_stabs,
                    ait_label,ait_cut,ait_align,ait_stab_function_name]) then
                    ait_label,ait_cut,ait_align,ait_stab_function_name]) then
              begin
              begin
-{$ifdef NEWINPUT}
-               if assigned(hp^.infile) and (pinputfile(hp^.infile)<>infile)  then
-{$else}
-               if assigned(hp^.infile) and (pextfile(hp^.infile)<>infile)  then
-{$endif NEWINPUT}
+             { file changed ? (must be before line info) }
+               if lastfileindex<>hp^.fileinfo.fileindex then
                 begin
                 begin
-                  infile:=hp^.infile;
-                  inc(includecount);
-                  if (hp^.infile^.path^<>'') then
+                  infile:=current_module^.sourcefiles.get_file(hp^.fileinfo.fileindex);
+                  if includecount=0 then
+                   curr_n:=n_sourcefile
+                  else
+                   curr_n:=n_includefile;
+                  if (infile^.path^<>'') then
                    begin
                    begin
-                     AsmWriteLn(#9'.stabs "'+FixPath(hp^.infile^.path^)+'",'+tostr(n_includefile)+
-                                ',0,0,Ltext'+ToStr(IncludeCount));
+                     AsmWriteLn(#9'.stabs "'+lower(BsToSlash(FixPath(infile^.path^)))+'",'+
+                       tostr(curr_n)+',0,0,'+'Ltext'+ToStr(IncludeCount));
                    end;
                    end;
-                  AsmWriteLn(#9'.stabs "'+FixFileName(hp^.infile^.name^+hp^.infile^.ext^)+'",'+tostr(n_includefile)+
-                             ',0,0,Ltext'+ToStr(IncludeCount));
+                  AsmWriteLn(#9'.stabs "'+lower(FixFileName(infile^.name^))+'",'+
+                    tostr(curr_n)+',0,0,'+'Ltext'+ToStr(IncludeCount));
                   AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
                   AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
+                  inc(includecount);
+                  lastfileindex:=hp^.fileinfo.fileindex;
                 end;
                 end;
-              { file name must be there before line number ! }
-               if (hp^.line<>lastline) and (hp^.line<>0) then
+             { line changed ? }
+               if (hp^.fileinfo.line<>lastline) and (hp^.fileinfo.line<>0) then
                 begin
                 begin
-                  if (n_line = n_textline) and assigned(funcname) and
+                  if (n_line=n_textline) and assigned(funcname) and
                      (target_os.use_function_relative_addresses) then
                      (target_os.use_function_relative_addresses) then
                    begin
                    begin
                      AsmWriteLn(target_asm.labelprefix+'l'+tostr(linecount)+':');
                      AsmWriteLn(target_asm.labelprefix+'l'+tostr(linecount)+':');
-                     AsmWriteLn(#9'.stabn '+tostr(n_line)+',0,'+tostr(hp^.line)+','+
-                                target_asm.labelprefix+'l'+tostr(linecount)+' - '+StrPas(FuncName));
+                     AsmWrite(#9'.stabn '+tostr(n_line)+',0,'+tostr(hp^.fileinfo.line)+','+
+                                target_asm.labelprefix+'l'+tostr(linecount)+' - ');
+                     AsmWritePChar(FuncName);
+                     AsmLn;
                      inc(linecount);
                      inc(linecount);
                    end
                    end
                   else
                   else
-                   AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(hp^.line));
-                  lastline:=hp^.line;
+                   AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(hp^.fileinfo.line));
+                  lastline:=hp^.fileinfo.line;
                 end;
                 end;
              end;
              end;
           end;
           end;
@@ -592,20 +589,24 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
     end;
     end;
 
 
     procedure tm68kmitasmlist.WriteAsmList;
     procedure tm68kmitasmlist.WriteAsmList;
-{$ifdef GDB}
     var
     var
       p:dirstr;
       p:dirstr;
       n:namestr;
       n:namestr;
       e:extstr;
       e:extstr;
-{$endif}
     begin
     begin
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
       if assigned(current_module^.mainsource) then
       if assigned(current_module^.mainsource) then
        comment(v_info,'Start writing gas-styled assembler output for '+current_module^.mainsource^);
        comment(v_info,'Start writing gas-styled assembler output for '+current_module^.mainsource^);
 {$endif}
 {$endif}
+
+      lastline:=0;
+      lastfileindex:=0;
+      LastSec:=sec_none;
 {$ifdef GDB}
 {$ifdef GDB}
-      infile:=nil;
       includecount:=0;
       includecount:=0;
+      n_line:=n_bssline;
+{$endif GDB}
+
       if assigned(current_module^.mainsource) then
       if assigned(current_module^.mainsource) then
        fsplit(current_module^.mainsource^,p,n,e)
        fsplit(current_module^.mainsource^,p,n,e)
       else
       else
@@ -616,26 +617,6 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
        end;
        end;
     { to get symify to work }
     { to get symify to work }
       AsmWriteLn(#9'.file "'+FixFileName(n+e)+'"');
       AsmWriteLn(#9'.file "'+FixFileName(n+e)+'"');
-    { stabs }
-      n_line:=n_bssline;
-      if (cs_debuginfo in aktswitches) then
-       begin
-         if (p<>'') then
-          AsmWriteLn(#9'.stabs "'+FixPath(p)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
-         AsmWriteLn(#9'.stabs "'+FixFileName(n+e)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
-         AsmWriteLn('Ltext0:');
-       end;
-      infile:=current_module^.sourcefiles.files;
-    { main source file is last in list }
-{$ifdef NEWINPUT}
-      while assigned(infile^.next) do
-       infile:=infile^.next;
-{$else}
-      while assigned(infile^._next) do
-       infile:=infile^._next;
-{$endif}
-      lastline:=0;
-{$endif GDB}
 
 
       { there should be nothing but externals so we don't need to process
       { there should be nothing but externals so we don't need to process
       WriteTree(externals); }
       WriteTree(externals); }
@@ -660,7 +641,10 @@ ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  1998-07-10 10:50:55  peter
+  Revision 1.7  1998-07-14 14:46:39  peter
+    * released NEWINPUT
+
+  Revision 1.6  1998/07/10 10:50:55  peter
     * m68k updates
     * m68k updates
 
 
   Revision 1.5  1998/06/05 17:46:05  peter
   Revision 1.5  1998/06/05 17:46:05  peter

+ 59 - 55
compiler/aopt386.inc

@@ -485,9 +485,9 @@ Begin
   If (Reg >= R_EAX) And (Reg <= R_EDI)
   If (Reg >= R_EAX) And (Reg <= R_EDI)
     Then
     Then
       Begin
       Begin
-        TmpState := PPaiProp(p1^.line)^.Regs[Reg].State+1;
-        FillChar(PPaiProp(p1^.line)^.Regs[Reg], SizeOf(TContent), 0);
-        PPaiProp(p1^.line)^.Regs[Reg].State := TmpState;
+        TmpState := PPaiProp(p1^.fileinfo.line)^.Regs[Reg].State+1;
+        FillChar(PPaiProp(p1^.fileinfo.line)^.Regs[Reg], SizeOf(TContent), 0);
+        PPaiProp(p1^.fileinfo.line)^.Regs[Reg].State := TmpState;
       End;
       End;
 End;
 End;
 
 
@@ -498,11 +498,11 @@ Begin
   Counter := R_EAX;
   Counter := R_EAX;
   FindZeroReg := True;
   FindZeroReg := True;
   While (Counter <= R_EDI) And
   While (Counter <= R_EDI) And
-        ((PPaiProp(p^.line)^.Regs[Counter].Typ <> Con_Const) or
-         (PPaiProp(p^.line)^.Regs[Counter].StartMod <> Pointer(0))) Do
+        ((PPaiProp(p^.fileinfo.line)^.Regs[Counter].Typ <> Con_Const) or
+         (PPaiProp(p^.fileinfo.line)^.Regs[Counter].StartMod <> Pointer(0))) Do
     Inc(Byte(Counter));
     Inc(Byte(Counter));
-  If (PPaiProp(p^.line)^.Regs[Counter].Typ = Con_Const) And
-     (PPaiProp(p^.line)^.Regs[Counter].StartMod = Pointer(0))
+  If (PPaiProp(p^.fileinfo.line)^.Regs[Counter].Typ = Con_Const) And
+     (PPaiProp(p^.fileinfo.line)^.Regs[Counter].StartMod = Pointer(0))
     Then Result := Counter
     Then Result := Counter
     Else FindZeroReg := False;
     Else FindZeroReg := False;
 End;*)
 End;*)
@@ -520,7 +520,7 @@ If (Ref.base <> R_NO) Or
         Then
         Then
 {write something to a parameter or a local variable}
 {write something to a parameter or a local variable}
           For Counter := R_EAX to R_EDI Do
           For Counter := R_EAX to R_EDI Do
-            With PPaiProp(p^.line)^.Regs[Counter] Do
+            With PPaiProp(p^.fileinfo.line)^.Regs[Counter] Do
               Begin
               Begin
                 If (Counter <> WhichRegNot) And
                 If (Counter <> WhichRegNot) And
                    (typ = Con_Ref) And
                    (typ = Con_Ref) And
@@ -534,7 +534,7 @@ If (Ref.base <> R_NO) Or
         Else
         Else
           {writing something to a pointer location}
           {writing something to a pointer location}
           For Counter := R_EAX to R_EDI Do
           For Counter := R_EAX to R_EDI Do
-            With PPaiProp(p^.line)^.Regs[Counter] Do
+            With PPaiProp(p^.fileinfo.line)^.Regs[Counter] Do
             If (Counter <> WhichRegNot) And
             If (Counter <> WhichRegNot) And
                (typ = Con_Ref) And
                (typ = Con_Ref) And
                (Not(cs_UncertainOpts in AktSwitches) Or
                (Not(cs_UncertainOpts in AktSwitches) Or
@@ -552,10 +552,10 @@ If (Ref.base <> R_NO) Or
     Begin
     Begin
       For Counter := R_EAX to R_EDI Do
       For Counter := R_EAX to R_EDI Do
         If (Counter <> WhichRegNot) And
         If (Counter <> WhichRegNot) And
-           (PPaiProp(p^.line)^.Regs[Counter].typ = Con_Ref) And
+           (PPaiProp(p^.fileinfo.line)^.Regs[Counter].typ = Con_Ref) And
            (Not(cs_UncertainOpts in AktSwitches) Or
            (Not(cs_UncertainOpts in AktSwitches) Or
             RefsEqual(Ref,
             RefsEqual(Ref,
-                     TReference(Pai386(PPaiProp(p^.line)^.Regs[Counter].StartMod)^.op1^))) Then
+                     TReference(Pai386(PPaiProp(p^.fileinfo.line)^.Regs[Counter].StartMod)^.op1^))) Then
           DestroyReg(p, Counter)
           DestroyReg(p, Counter)
     End;
     End;
 End;
 End;
@@ -577,8 +577,8 @@ Function RegsSameContent(p1, p2: Pai; Reg: TRegister): Boolean;
 Begin
 Begin
   Reg := Reg32(Reg);
   Reg := Reg32(Reg);
   RegsSameContent :=
   RegsSameContent :=
-    PPaiProp(p1^.line)^.Regs[Reg].State =
-    PPaiProp(p2^.line)^.Regs[Reg].State;
+    PPaiProp(p1^.fileinfo.line)^.Regs[Reg].State =
+    PPaiProp(p2^.fileinfo.line)^.Regs[Reg].State;
 End;
 End;
 
 
 Function InstructionsEqual(p1, p2: Pai): Boolean;
 Function InstructionsEqual(p1, p2: Pai): Boolean;
@@ -642,7 +642,7 @@ Begin
                 Begin
                 Begin
                   TmpP := Pai(newp^.previous);
                   TmpP := Pai(newp^.previous);
                   While Assigned (TmpP^.previous) And
                   While Assigned (TmpP^.previous) And
-                        PPaiProp(TmpP^.Line)^.CanBeRemoved Do
+                        PPaiProp(TmpP^.fileinfo.Line)^.CanBeRemoved Do
                     TmpP := Pai(TmpP^.previous);
                     TmpP := Pai(TmpP^.previous);
                   TmpResult := Assigned(TmpP) And
                   TmpResult := Assigned(TmpP) And
                                RegsSameContent(oldp, TmpP, Reg32(TRegister(Pai386(oldp)^.op1)))
                                RegsSameContent(oldp, TmpP, Reg32(TRegister(Pai386(oldp)^.op1)))
@@ -661,7 +661,7 @@ Begin
                     Begin
                     Begin
                       TmpP := Pai(newp^.previous);
                       TmpP := Pai(newp^.previous);
                       While Assigned (TmpP^.previous) And
                       While Assigned (TmpP^.previous) And
-                            PPaiProp(TmpP^.Line)^.CanBeRemoved Do
+                            PPaiProp(TmpP^.fileinfo.Line)^.CanBeRemoved Do
                         TmpP := Pai(TmpP^.previous);
                         TmpP := Pai(TmpP^.previous);
                       TmpResult := Assigned(TmpP) And
                       TmpResult := Assigned(TmpP) And
                                    RegsSameContent(oldp, TmpP, Base)
                                    RegsSameContent(oldp, TmpP, Base)
@@ -678,7 +678,7 @@ Begin
                     Begin
                     Begin
                       TmpP := Pai(newp^.previous);
                       TmpP := Pai(newp^.previous);
                       While Assigned (TmpP^.previous) And
                       While Assigned (TmpP^.previous) And
-                            PPaiProp(TmpP^.Line)^.CanBeRemoved Do
+                            PPaiProp(TmpP^.fileinfo.Line)^.CanBeRemoved Do
                         TmpP := Pai(TmpP^.previous);
                         TmpP := Pai(TmpP^.previous);
                       TmpResult := Assigned(TmpP) And
                       TmpResult := Assigned(TmpP) And
                                    RegsSameContent(oldp, TmpP, Index)
                                    RegsSameContent(oldp, TmpP, Index)
@@ -693,13 +693,13 @@ End;
 Begin {CheckSequence}
 Begin {CheckSequence}
   Reg := Reg32(Reg);
   Reg := Reg32(Reg);
   Found := 0;
   Found := 0;
-  hp2 := PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg].StartMod;
+  hp2 := PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg].StartMod;
   hp3 := p;
   hp3 := p;
-  EndMod := PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg].StartMod;
+  EndMod := PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg].StartMod;
   RegsNotYetChecked := [R_EAX..R_EDI];
   RegsNotYetChecked := [R_EAX..R_EDI];
-  For Counter := 2 to PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg].NrOfMods Do
+  For Counter := 2 to PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg].NrOfMods Do
     EndMod := Pai(EndMod^.Next);
     EndMod := Pai(EndMod^.Next);
-  While (Found <> PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg].NrOfMods) And
+  While (Found <> PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg].NrOfMods) And
          InstructionsEqual(hp2, hp3) And
          InstructionsEqual(hp2, hp3) And
          NoChangedRegInRef(EndMod, hp3) Do
          NoChangedRegInRef(EndMod, hp3) Do
     Begin
     Begin
@@ -707,10 +707,10 @@ Begin {CheckSequence}
       hp3 := Pai(hp3^.next);
       hp3 := Pai(hp3^.next);
       Inc(Found)
       Inc(Found)
     End;
     End;
-  If (Found <> PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg].NrOfMods)
+  If (Found <> PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg].NrOfMods)
      Then
      Then
        Begin
        Begin
-         If ((Found+1) = PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg].NrOfMods) And
+         If ((Found+1) = PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg].NrOfMods) And
            Assigned(hp2) And
            Assigned(hp2) And
            (Pai(hp2)^.typ = ait_instruction) And
            (Pai(hp2)^.typ = ait_instruction) And
            (Pai386(hp2)^._operator In [A_MOV, A_MOVZX]) And
            (Pai386(hp2)^._operator In [A_MOV, A_MOVZX]) And
@@ -743,7 +743,7 @@ Begin {CheckSequence}
                       Begin
                       Begin
                         CheckSequence := False;
                         CheckSequence := False;
                         If (Found > 0) Then
                         If (Found > 0) Then
-                          Found := PPaiProp(Pai(p)^.line)^.Regs[Reg].NrOfMods
+                          Found := PPaiProp(Pai(p)^.fileinfo.line)^.Regs[Reg].NrOfMods
                       End
                       End
                 End
                 End
               Else
               Else
@@ -760,7 +760,7 @@ Begin {CheckSequence}
                       Begin
                       Begin
                         CheckSequence := False;
                         CheckSequence := False;
                         If (Found > 0) Then
                         If (Found > 0) Then
-                          Found := PPaiProp(Pai(p)^.line)^.Regs[Reg].NrOfMods
+                          Found := PPaiProp(Pai(p)^.fileinfo.line)^.Regs[Reg].NrOfMods
                       End
                       End
                 End
                 End
           Else
           Else
@@ -775,7 +775,7 @@ Begin {CheckSequence}
   and that it was equal (otherwise CheckSequence would have returned false
   and that it was equal (otherwise CheckSequence would have returned false
   and the instruction wouldn't have been removed). If this "If found > 0"
   and the instruction wouldn't have been removed). If this "If found > 0"
   check is left out, incorrect optimizations are performed.}
   check is left out, incorrect optimizations are performed.}
-                Found := PPaiProp(Pai(p)^.line)^.Regs[Reg].NrOfMods
+                Found := PPaiProp(Pai(p)^.fileinfo.line)^.Regs[Reg].NrOfMods
             End
             End
        End
        End
      Else CheckSequence := True;
      Else CheckSequence := True;
@@ -788,7 +788,7 @@ Var Counter: TRegister;
 Begin {initializes/desrtoys all registers}
 Begin {initializes/desrtoys all registers}
   For Counter := R_EAX To R_EDI Do
   For Counter := R_EAX To R_EDI Do
     DestroyReg(p, Counter);
     DestroyReg(p, Counter);
-  PPaiProp(p^.line)^.DirFlag := F_Unknown;
+  PPaiProp(p^.fileinfo.line)^.DirFlag := F_Unknown;
 End;
 End;
 
 
 Procedure Destroy(PaiObj: Pai; opt: Longint; Op: Pointer);
 Procedure Destroy(PaiObj: Pai; opt: Longint; Op: Pointer);
@@ -821,10 +821,10 @@ Begin
         Then TmpProp := @PaiPropBlock^[InstrCnt]
         Then TmpProp := @PaiPropBlock^[InstrCnt]
         Else New(TmpProp);
         Else New(TmpProp);
       If (p <> First)
       If (p <> First)
-        Then TmpProp^ := PPaiProp(Pai(p^.previous)^.line)^
+        Then TmpProp^ := PPaiProp(Pai(p^.previous)^.fileinfo.line)^
         Else FillChar(TmpProp^, SizeOf(TmpProp^), 0);
         Else FillChar(TmpProp^, SizeOf(TmpProp^), 0);
-      TmpProp^.LineSave := p^.line;
-      PPaiProp(p^.line) := TmpProp;
+      TmpProp^.linesave := p^.fileinfo.line;
+      PPaiProp(p^.fileinfo.line) := TmpProp;
       For TmpReg := R_EAX To R_EDI Do
       For TmpReg := R_EAX To R_EDI Do
         Inc(NrOfInstrSinceLastMod[TmpReg]);
         Inc(NrOfInstrSinceLastMod[TmpReg]);
       Case p^.typ Of
       Case p^.typ Of
@@ -865,7 +865,7 @@ Begin
                         If (RegInRef(TmpReg, TReference(Pai386(p)^.op1^)))
                         If (RegInRef(TmpReg, TReference(Pai386(p)^.op1^)))
                           Then
                           Then
                             Begin
                             Begin
-                              With PPaiProp(Pai(p)^.line)^.Regs[TmpReg] Do
+                              With PPaiProp(Pai(p)^.fileinfo.line)^.Regs[TmpReg] Do
                                 Begin
                                 Begin
                                   Inc(State);
                                   Inc(State);
  {also store how many instructions are part of the sequence in the first
  {also store how many instructions are part of the sequence in the first
@@ -877,14 +877,14 @@ Begin
                                       StartMod := p;
                                       StartMod := p;
                                     End;
                                     End;
                                   Inc(NrOfMods, NrOfInstrSinceLastMod[TmpReg]);
                                   Inc(NrOfMods, NrOfInstrSinceLastMod[TmpReg]);
-                                  PPaiProp(Pai(StartMod)^.line)^.Regs[TmpReg].NrOfMods := NrOfMods;
+                                  PPaiProp(Pai(StartMod)^.fileinfo.line)^.Regs[TmpReg].NrOfMods := NrOfMods;
                                   NrOfInstrSinceLastMod[TmpReg] := 0;
                                   NrOfInstrSinceLastMod[TmpReg] := 0;
                                 End;
                                 End;
                             End
                             End
                           Else
                           Else
                             Begin
                             Begin
                               DestroyReg(p, TmpReg);
                               DestroyReg(p, TmpReg);
-                              With PPaiProp(Pai(p)^.line)^.Regs[TmpReg] Do
+                              With PPaiProp(Pai(p)^.fileinfo.line)^.Regs[TmpReg] Do
                                 Begin
                                 Begin
                                   Typ := Con_Ref;
                                   Typ := Con_Ref;
                                   StartMod := p;
                                   StartMod := p;
@@ -952,8 +952,8 @@ Begin
                         Case InstrProp.Ch[Cnt] Of
                         Case InstrProp.Ch[Cnt] Of
                           C_None:;
                           C_None:;
                           C_EAX..C_EDI: DestroyReg(p, TCh2Reg(InstrProp.Ch[Cnt]));
                           C_EAX..C_EDI: DestroyReg(p, TCh2Reg(InstrProp.Ch[Cnt]));
-                          C_CDirFlag: PPaiProp(Pai(p)^.line)^.DirFlag := F_NotSet;
-                          C_SDirFlag: PPaiProp(Pai(p)^.line)^.DirFlag := F_Set;
+                          C_CDirFlag: PPaiProp(Pai(p)^.fileinfo.line)^.DirFlag := F_NotSet;
+                          C_SDirFlag: PPaiProp(Pai(p)^.fileinfo.line)^.DirFlag := F_Set;
                           C_Op1: Destroy(p, Pai386(p)^.op1t, Pai386(p)^.op1);
                           C_Op1: Destroy(p, Pai386(p)^.op1t, Pai386(p)^.op1);
                           C_Op2: Destroy(p, Pai386(p)^.op2t, Pai386(p)^.op2);
                           C_Op2: Destroy(p, Pai386(p)^.op2t, Pai386(p)^.op2);
                           C_Op3: Destroy(p, Pai386(p)^.op2t, Pointer(Longint(TwoWords(Pai386(p)^.op2).word2)));
                           C_Op3: Destroy(p, Pai386(p)^.op2t, Pointer(Longint(TwoWords(Pai386(p)^.op2).word2)));
@@ -998,8 +998,8 @@ Begin
           Begin
           Begin
             Case Pai386(p)^._operator Of
             Case Pai386(p)^._operator Of
               A_CLD: If Assigned(p^.previous) And
               A_CLD: If Assigned(p^.previous) And
-                        (PPaiProp(Pai(p^.previous)^.line)^.DirFlag = F_NotSet) Then
-                          PPaiProp(Pai(p)^.line)^.CanBeRemoved := True;
+                        (PPaiProp(Pai(p^.previous)^.fileinfo.line)^.DirFlag = F_NotSet) Then
+                          PPaiProp(Pai(p)^.fileinfo.line)^.CanBeRemoved := True;
 {$IfDef OptimizeMovs}
 {$IfDef OptimizeMovs}
               A_MOV, A_MOVZX, A_MOVSX:
               A_MOV, A_MOVZX, A_MOVSX:
                 Begin
                 Begin
@@ -1011,10 +1011,11 @@ Begin
                       End;}
                       End;}
                     Top_Ref:
                     Top_Ref:
                       Begin {destination is always a register in this case}
                       Begin {destination is always a register in this case}
-                        With PPaiProp(p^.line)^.Regs[Reg32(Tregister(Pai386(p)^.op2))] Do
+                        With PPaiProp(p^.fileinfo.line)^.Regs[Reg32(Tregister(Pai386(p)^.op2))] Do
                           Begin
                           Begin
                             If Assigned(p^.previous) And
                             If Assigned(p^.previous) And
-                               (PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg32(TRegister(Pai386(p)^.op2))].typ = con_ref) Then
+                               (PPaiProp(Pai(p^.previous)^.fileinfo.line)^.
+                                 Regs[Reg32(TRegister(Pai386(p)^.op2))].typ = con_ref) Then
    {so we don't try to check a sequence when the register only contains a constant}
    {so we don't try to check a sequence when the register only contains a constant}
                                If CheckSequence(p, TRegister(Pai386(p)^.op2), Cnt) And
                                If CheckSequence(p, TRegister(Pai386(p)^.op2), Cnt) And
                                   (Cnt > 0)
                                   (Cnt > 0)
@@ -1050,7 +1051,7 @@ Begin
                                              If (hp1 = nil) And
                                              If (hp1 = nil) And
                                                 Not(RegInInstruction(Tregister(Pai386(hp2)^.op2), p))
                                                 Not(RegInInstruction(Tregister(Pai386(hp2)^.op2), p))
                                                Then hp1 := p;
                                                Then hp1 := p;
-                                             PPaiProp(p^.line)^.CanBeRemoved := True;
+                                             PPaiProp(p^.fileinfo.line)^.CanBeRemoved := True;
                                            End;
                                            End;
                                          p := Pai(p^.next);
                                          p := Pai(p^.next);
                                        End;
                                        End;
@@ -1059,13 +1060,13 @@ Begin
                                    End
                                    End
                                  Else
                                  Else
                                    If (Cnt > 0) And
                                    If (Cnt > 0) And
-                                      (PPaiProp(p^.line)^.CanBeRemoved) Then
+                                      (PPaiProp(p^.fileinfo.line)^.CanBeRemoved) Then
                                      Begin
                                      Begin
                                        hp2 := p;
                                        hp2 := p;
                                        For Cnt2 := 1 to Cnt Do
                                        For Cnt2 := 1 to Cnt Do
                                          Begin
                                          Begin
                                            If RegInInstruction(Tregister(Pai386(hp2)^.op2), p)
                                            If RegInInstruction(Tregister(Pai386(hp2)^.op2), p)
-                                             Then PPaiProp(p^.Line)^.CanBeRemoved := False;
+                                             Then PPaiProp(p^.fileinfo.line)^.CanBeRemoved := False;
                                            p := Pai(p^.Next)
                                            p := Pai(p^.Next)
                                          End;
                                          End;
                                        Continue;
                                        Continue;
@@ -1078,10 +1079,10 @@ Begin
                           Top_Reg:
                           Top_Reg:
                             Begin
                             Begin
                               If Assigned(p^.previous) Then
                               If Assigned(p^.previous) Then
-                                With PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg32(TRegister(Pai386(p)^.op2))] Do
+                                With PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg32(TRegister(Pai386(p)^.op2))] Do
                                   If (Typ = Con_Const) And
                                   If (Typ = Con_Const) And
                                      (StartMod = Pai386(p)^.op1) Then
                                      (StartMod = Pai386(p)^.op1) Then
-                                    PPaiProp(p^.line)^.CanBeRemoved := True;
+                                    PPaiProp(p^.fileinfo.line)^.CanBeRemoved := True;
                             End;
                             End;
                           Top_Ref:;
                           Top_Ref:;
                         End;
                         End;
@@ -1090,17 +1091,17 @@ Begin
                 End;
                 End;
 {$EndIf OptimizeMovs}
 {$EndIf OptimizeMovs}
               A_STD: If Assigned(p^.previous) And
               A_STD: If Assigned(p^.previous) And
-                        (PPaiProp(Pai(p^.previous)^.line)^.DirFlag = F_Set) Then
-                        PPaiProp(Pai(p)^.line)^.CanBeRemoved := True;
+                        (PPaiProp(Pai(p^.previous)^.fileinfo.line)^.DirFlag = F_Set) Then
+                        PPaiProp(Pai(p)^.fileinfo.line)^.CanBeRemoved := True;
               A_XOR:
               A_XOR:
                 Begin
                 Begin
                   If (Pai386(p)^.op1t = top_reg) And
                   If (Pai386(p)^.op1t = top_reg) And
                      (Pai386(p)^.op2t = top_reg) And
                      (Pai386(p)^.op2t = top_reg) And
                      (Pai386(p)^.op1 = Pai386(p)^.op2) And
                      (Pai386(p)^.op1 = Pai386(p)^.op2) And
                      Assigned(p^.previous) And
                      Assigned(p^.previous) And
-                     (PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg32(Tregister(Pai386(p)^.op1))].typ = con_const) And
-                     (PPaiProp(Pai(p^.previous)^.line)^.Regs[Reg32(Tregister(Pai386(p)^.op1))].StartMod = Pointer(0))
-                    Then PPaiProp(p^.line)^.CanBeRemoved := True
+                     (PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg32(Tregister(Pai386(p)^.op1))].typ = con_const) And
+                     (PPaiProp(Pai(p^.previous)^.fileinfo.line)^.Regs[Reg32(Tregister(Pai386(p)^.op1))].StartMod = Pointer(0))
+                    Then PPaiProp(p^.fileinfo.line)^.CanBeRemoved := True
                 End
                 End
             End
             End
           End;
           End;
@@ -1118,11 +1119,11 @@ Begin
   p := First;
   p := First;
   InstrCnt := 1;
   InstrCnt := 1;
   While (p <> Pai(Last^.Next)) Do
   While (p <> Pai(Last^.Next)) Do
-    If PPaiProp(p^.line)^.CanBeRemoved
+    If PPaiProp(p^.fileinfo.line)^.CanBeRemoved
       Then
       Then
         Begin
         Begin
           If (InstrCnt > NrOfPaiFast) Then
           If (InstrCnt > NrOfPaiFast) Then
-            Dispose(PPaiProp(p^.Line));
+            Dispose(PPaiProp(p^.fileinfo.line));
           hp1 := Pai(p^.Next);
           hp1 := Pai(p^.Next);
           AsmL^.Remove(p);
           AsmL^.Remove(p);
           Dispose(p, Done);
           Dispose(p, Done);
@@ -1134,11 +1135,11 @@ Begin
           If (InstrCnt > NrOfPaiFast)
           If (InstrCnt > NrOfPaiFast)
             Then
             Then
               Begin
               Begin
-                TmpLine := PPaiProp(p^.Line)^.LineSave;
-                Dispose(PPaiProp(p^.Line));
-                p^.Line := TmpLine;
+                TmpLine := PPaiProp(p^.fileinfo.line)^.linesave;
+                Dispose(PPaiProp(p^.fileinfo.line));
+                p^.fileinfo.line := TmpLine;
               End
               End
-            Else p^.Line := PPaiProp(p^.Line)^.LineSave;
+            Else p^.fileinfo.line := PPaiProp(p^.fileinfo.line)^.linesave;
           p := Pai(p^.Next);
           p := Pai(p^.Next);
           Inc(InstrCnt)
           Inc(InstrCnt)
         End;
         End;
@@ -1201,7 +1202,10 @@ End;
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.6  1998-05-06 08:38:33  pierre
+ Revision 1.7  1998-07-14 14:46:41  peter
+   * released NEWINPUT
+
+ Revision 1.6  1998/05/06 08:38:33  pierre
    * better position info with UseTokenInfo
    * better position info with UseTokenInfo
      UseTokenInfo greatly simplified
      UseTokenInfo greatly simplified
    + added check for changed tree after first time firstpass
    + added check for changed tree after first time firstpass

+ 19 - 16
compiler/aopt386.pas

@@ -519,7 +519,7 @@ End;
                                    Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
                                    Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
                                    Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                    Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                     TRegister(twowords(Pai386(p)^.op2).word2)));
                                     TRegister(twowords(Pai386(p)^.op2).word2)));
-                                 hp1^.line := p^.line;
+                                 hp1^.fileinfo := p^.fileinfo;
                                  InsertLLItem(p^.previous, p^.next, hp1);
                                  InsertLLItem(p^.previous, p^.next, hp1);
                                  Dispose(p, Done);
                                  Dispose(p, Done);
                                  p := hp1;
                                  p := hp1;
@@ -536,7 +536,7 @@ End;
                                   Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
                                   Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
                                   Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                   Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                    TRegister(twowords(Pai386(p)^.op2).word2)));
                                    TRegister(twowords(Pai386(p)^.op2).word2)));
-                                hp1^.line:= p^.line;
+                                hp1^.fileinfo:= p^.fileinfo;
                                 InsertLLItem(p^.previous, p^.next, hp1);
                                 InsertLLItem(p^.previous, p^.next, hp1);
                                 Dispose(p, Done);
                                 Dispose(p, Done);
                                 p := hp1;
                                 p := hp1;
@@ -566,7 +566,7 @@ End;
                                             hp1 :=  New(Pai386, op_reg_reg(A_ADD, S_L,
                                             hp1 :=  New(Pai386, op_reg_reg(A_ADD, S_L,
                                               TRegister(Pai386(p)^.op2),TRegister(Pai386(p)^.op2)));
                                               TRegister(Pai386(p)^.op2),TRegister(Pai386(p)^.op2)));
                                           End;
                                           End;
-                                      hp1^.line := p^.line;
+                                      hp1^.fileinfo := p^.fileinfo;
                                       InsertLLItem(p, p^.next, hp1);
                                       InsertLLItem(p, p^.next, hp1);
                                       New(TmpRef);
                                       New(TmpRef);
                                       TmpRef^.segment := R_DEFAULT_SEG;
                                       TmpRef^.segment := R_DEFAULT_SEG;
@@ -587,7 +587,7 @@ End;
                                             TmpRef^.base := TRegister(Pai386(p)^.op2);
                                             TmpRef^.base := TRegister(Pai386(p)^.op2);
                                             hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)));
                                             hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)));
                                           End;
                                           End;
-                                      hp1^.line := p^.line;
+                                      hp1^.fileinfo := p^.fileinfo;
                                       InsertLLItem(p^.previous, p^.next, hp1);
                                       InsertLLItem(p^.previous, p^.next, hp1);
                                       Dispose(p, Done);
                                       Dispose(p, Done);
                                       p := Pai(hp1^.next);
                                       p := Pai(hp1^.next);
@@ -606,7 +606,7 @@ End;
                                      Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
                                      Then hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef, TRegister(Pai386(p)^.op2)))
                                      Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                      Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                       TRegister(twowords(Pai386(p)^.op2).word2)));
                                       TRegister(twowords(Pai386(p)^.op2).word2)));
-                                   hp1^.line := p^.line;
+                                   hp1^.fileinfo := p^.fileinfo;
                                    InsertLLItem(p^.previous, p^.next, hp1);
                                    InsertLLItem(p^.previous, p^.next, hp1);
                                    Dispose(p, Done);
                                    Dispose(p, Done);
                                    p := hp1;
                                    p := hp1;
@@ -627,7 +627,7 @@ End;
                                             Tregister(twowords(Pai386(p)^.op2).word2)))
                                             Tregister(twowords(Pai386(p)^.op2).word2)))
                                        Else hp1 := New(Pai386, op_reg_reg(A_ADD, S_L,
                                        Else hp1 := New(Pai386, op_reg_reg(A_ADD, S_L,
                                                 TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)));
                                                 TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)));
-                                     hp1^.line := p^.line;
+                                     hp1^.fileinfo := p^.fileinfo;
                                      InsertLLItem(p, p^.next, hp1);
                                      InsertLLItem(p, p^.next, hp1);
                                      TmpRef^.base := TRegister(Pai386(p)^.op2);
                                      TmpRef^.base := TRegister(Pai386(p)^.op2);
                                      TmpRef^.Index := TRegister(Pai386(p)^.op2);
                                      TmpRef^.Index := TRegister(Pai386(p)^.op2);
@@ -639,7 +639,7 @@ End;
                                        Else
                                        Else
                                            hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                            hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                              TRegister(Pai386(p)^.op2)));
                                              TRegister(Pai386(p)^.op2)));
-                                     hp1^.line := p^.line;
+                                     hp1^.fileinfo := p^.fileinfo;
                                      InsertLLItem(p^.previous, p^.next, hp1);
                                      InsertLLItem(p^.previous, p^.next, hp1);
                                      Dispose(p, Done);
                                      Dispose(p, Done);
                                      p := Pai(hp1^.next);
                                      p := Pai(hp1^.next);
@@ -672,7 +672,7 @@ End;
                                              hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                              hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                                TRegister(Pai386(p)^.op2)));
                                                TRegister(Pai386(p)^.op2)));
                                            End;
                                            End;
-                                       hp1^.line := p^.line;
+                                       hp1^.fileinfo := p^.fileinfo;
                                        InsertLLItem(p, p^.next, hp1);
                                        InsertLLItem(p, p^.next, hp1);
                                        New(TmpRef);
                                        New(TmpRef);
                                        TmpRef^.segment := R_DEFAULT_SEG;
                                        TmpRef^.segment := R_DEFAULT_SEG;
@@ -695,7 +695,7 @@ End;
                                              hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                              hp1 :=  New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                                TRegister(Pai386(p)^.op2)));
                                                TRegister(Pai386(p)^.op2)));
                                            End;
                                            End;
-                                       hp1^.line := p^.line;
+                                       hp1^.fileinfo := p^.fileinfo;
                                        InsertLLItem(p^.previous, p^.next, hp1);
                                        InsertLLItem(p^.previous, p^.next, hp1);
                                        Dispose(p, Done);
                                        Dispose(p, Done);
                                        p := Pai(hp1^.next);
                                        p := Pai(hp1^.next);
@@ -717,7 +717,7 @@ End;
                        Begin
                        Begin
                          hp1 := New(Pai386, op_reg_reg(A_MOV, S_L,PReference(Pai386(p)^.op1)^.Base,
                          hp1 := New(Pai386, op_reg_reg(A_MOV, S_L,PReference(Pai386(p)^.op1)^.Base,
                            TRegister(Pai386(p)^.op2)));
                            TRegister(Pai386(p)^.op2)));
-                         hp1^.line := p^.line;
+                         hp1^.fileinfo := p^.fileinfo;
                          InsertLLItem(p^.previous,p^.next, hp1);
                          InsertLLItem(p^.previous,p^.next, hp1);
                          Dispose(p, Done);
                          Dispose(p, Done);
                          p := hp1;
                          p := hp1;
@@ -1125,7 +1125,7 @@ End;
                                                   hp1 := New(Pai386, op_reg_reg(A_XOR, S_L,
                                                   hp1 := New(Pai386, op_reg_reg(A_XOR, S_L,
                                                              TRegister(Pai386(p)^.op2),
                                                              TRegister(Pai386(p)^.op2),
                                                              TRegister(Pai386(p)^.op2)));
                                                              TRegister(Pai386(p)^.op2)));
-                                                  hp1^.line := p^.line;
+                                                  hp1^.fileinfo := p^.fileinfo;
                                                   InsertLLItem(p^.previous, p, hp1);
                                                   InsertLLItem(p^.previous, p, hp1);
                                                   Pai386(p)^._operator := A_MOV;
                                                   Pai386(p)^._operator := A_MOV;
                                                   Pai386(p)^.size := S_B;
                                                   Pai386(p)^.size := S_B;
@@ -1181,7 +1181,7 @@ End;
                                     Begin
                                     Begin
                                       hp1 := New(Pai386,op_reg_reg(A_XOR, S_L, TRegister(Pai386(p)^.op2),
                                       hp1 := New(Pai386,op_reg_reg(A_XOR, S_L, TRegister(Pai386(p)^.op2),
                                         TRegister(Pai386(p)^.op2)));
                                         TRegister(Pai386(p)^.op2)));
-                                      hp1^.line := p^.line;
+                                      hp1^.fileinfo := p^.fileinfo;
                                       Pai386(p)^._operator := A_MOV;
                                       Pai386(p)^._operator := A_MOV;
                                       Pai386(p)^.size := S_B;
                                       Pai386(p)^.size := S_B;
                                       Pai386(p)^.op2 := Pointer(Reg32ToReg8(TRegister(Pai386(p)^.op2)));
                                       Pai386(p)^.op2 := Pointer(Reg32ToReg8(TRegister(Pai386(p)^.op2)));
@@ -1343,7 +1343,7 @@ End;
                                            End
                                            End
                                          Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                          Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
                                                          TRegister(Pai386(p)^.op2)));
                                                          TRegister(Pai386(p)^.op2)));
-                                       hp1^.line := p^.line;
+                                       hp1^.fileinfo := p^.fileinfo;
                                        InsertLLItem(p^.previous, p^.next, hp1);
                                        InsertLLItem(p^.previous, p^.next, hp1);
                                        Dispose(p, Done);
                                        Dispose(p, Done);
                                        p := hp1;
                                        p := hp1;
@@ -1361,7 +1361,7 @@ End;
                                    Begin
                                    Begin
                                      hp1 := new(Pai386,op_reg_reg(A_ADD,Pai386(p)^.Size,
                                      hp1 := new(Pai386,op_reg_reg(A_ADD,Pai386(p)^.Size,
                                                 TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)));
                                                 TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)));
-                                     hp1^.line := p^.line;
+                                     hp1^.fileinfo := p^.fileinfo;
                                      InsertLLItem(p^.previous, p^.next, hp1);
                                      InsertLLItem(p^.previous, p^.next, hp1);
                                      Dispose(p, done);
                                      Dispose(p, done);
                                      p := hp1;
                                      p := hp1;
@@ -1380,7 +1380,7 @@ End;
                                             TmpRef^.isintvalue := false;
                                             TmpRef^.isintvalue := false;
                                             TmpRef^.offset := 0;
                                             TmpRef^.offset := 0;
                                             hp1 := new(Pai386,op_ref_reg(A_LEA,S_L,TmpRef, TRegister(Pai386(p)^.op2)));
                                             hp1 := new(Pai386,op_ref_reg(A_LEA,S_L,TmpRef, TRegister(Pai386(p)^.op2)));
-                                            hp1^.line := p^.line;
+                                            hp1^.fileinfo := p^.fileinfo;
                                             InsertLLItem(p^.previous, p^.next, hp1);
                                             InsertLLItem(p^.previous, p^.next, hp1);
                                             Dispose(p, done);
                                             Dispose(p, done);
                                             p := hp1;
                                             p := hp1;
@@ -1631,7 +1631,10 @@ end;
 End.
 End.
 {
 {
   $Log$
   $Log$
-  Revision 1.15  1998-06-16 08:56:17  peter
+  Revision 1.16  1998-07-14 14:46:42  peter
+    * released NEWINPUT
+
+  Revision 1.15  1998/06/16 08:56:17  peter
     + targetcpu
     + targetcpu
     * cleaner pmodules for newppu
     * cleaner pmodules for newppu
 
 

+ 14 - 33
compiler/cg68k.pas

@@ -2486,7 +2486,7 @@ implementation
          exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[hp^.location.resflags],S_B,hregister)));
          exprasmlist^.concat(new(pai68k,op_reg(flag_2_set[hp^.location.resflags],S_B,hregister)));
          case porddef(p^.resulttype)^.typ of
          case porddef(p^.resulttype)^.typ of
            bool8bit : p^.location.register:=hregister;
            bool8bit : p^.location.register:=hregister;
-{ !!!!!!!!!!!   
+{ !!!!!!!!!!!
 
 
           bool16bit : begin
           bool16bit : begin
                         p^.location.register:=reg8toreg16(hregister);
                         p^.location.register:=reg8toreg16(hregister);
@@ -3563,7 +3563,7 @@ implementation
                     (S_B,S_W,S_L,S_B,S_W,S_L);
                     (S_B,S_W,S_L,S_B,S_W,S_L);
             in2instr:array[in_inc_byte..in_dec_dword] of Tasmop=
             in2instr:array[in_inc_byte..in_dec_dword] of Tasmop=
                     (A_ADDQ,A_ADDQ,A_ADDQ,A_SUBQ,A_SUBQ,A_SUBQ);
                     (A_ADDQ,A_ADDQ,A_ADDQ,A_SUBQ,A_SUBQ,A_SUBQ);
-{$endif}                
+{$endif}
 
 
             { tfloattype = (f32bit,s32real,s64real,s80real,s64bit); }
             { tfloattype = (f32bit,s32real,s64real,s80real,s64bit); }
             float_name: array[tfloattype] of string[8]=
             float_name: array[tfloattype] of string[8]=
@@ -4190,7 +4190,7 @@ implementation
                  end;
                  end;
                 emitoverflowcheck(p^.left^.left);
                 emitoverflowcheck(p^.left^.left);
               end;
               end;
-{$ifdef OLDINC} 
+{$ifdef OLDINC}
 
 
             in_inc_byte..in_dec_dword:
             in_inc_byte..in_dec_dword:
                 begin
                 begin
@@ -4199,7 +4199,7 @@ implementation
                      in2size[p^.inlinenumber],1,newreference(p^.left^.location.reference))));
                      in2size[p^.inlinenumber],1,newreference(p^.left^.location.reference))));
                      emitoverflowcheck(p^.left);
                      emitoverflowcheck(p^.left);
                 end;
                 end;
-{$endif}                
+{$endif}
             in_pred_x,
             in_pred_x,
             in_succ_x:
             in_succ_x:
               begin
               begin
@@ -5175,18 +5175,13 @@ end;
       begin
       begin
          oldcodegenerror:=codegenerror;
          oldcodegenerror:=codegenerror;
          oldswitches:=aktswitches;
          oldswitches:=aktswitches;
-{$ifdef NEWINPUT}
          oldpos:=aktfilepos;
          oldpos:=aktfilepos;
-         aktfilepos:=p^.fileinfo;
-{$else}
-         get_cur_file_pos(oldpos);
-         set_cur_file_pos(p^.fileinfo);
-{$endif NEWINPUT}
 
 
-         codegenerror:=false;
+         aktfilepos:=p^.fileinfo;
          aktswitches:=p^.pragmas;
          aktswitches:=p^.pragmas;
          if not(p^.error) then
          if not(p^.error) then
            begin
            begin
+              codegenerror:=false;
               procedures[p^.treetype](p);
               procedures[p^.treetype](p);
               p^.error:=codegenerror;
               p^.error:=codegenerror;
               codegenerror:=codegenerror or oldcodegenerror;
               codegenerror:=codegenerror or oldcodegenerror;
@@ -5194,11 +5189,7 @@ end;
          else
          else
            codegenerror:=true;
            codegenerror:=true;
          aktswitches:=oldswitches;
          aktswitches:=oldswitches;
-{$ifdef NEWINPUT}
          aktfilepos:=oldpos;
          aktfilepos:=oldpos;
-{$else}
-         set_cur_file_pos(oldpos);
-{$endif NEWINPUT}
       end;
       end;
 
 
 
 
@@ -5263,26 +5254,17 @@ end;
            end;
            end;
       end;
       end;
 
 
-    procedure generatecode(var p : ptree);
 
 
+    procedure generatecode(var p : ptree);
       var
       var
-         { *pass modifies with every node aktlinenr and current_module^.current_inputfile, }
-         { to constantly contain the right line numbers             }
-         oldis : pinputfile;
-         oldnr,i : longint;
+         i       : longint;
          regsize : topsize;
          regsize : topsize;
-         regi : tregister;
-         hr : preference;
-
+         regi    : tregister;
+         hr      : preference;
       label
       label
          nextreg;
          nextreg;
-
       begin
       begin
          cleartempgen;
          cleartempgen;
-{$ifndef NEWINPUT}
-         oldis:=current_module^.current_inputfile;
-         oldnr:=current_module^.current_inputfile^.line_no;
-{$endif}
          { when size optimization only count occurrence }
          { when size optimization only count occurrence }
          if cs_littlesize in aktswitches then
          if cs_littlesize in aktswitches then
            t_times:=1
            t_times:=1
@@ -5443,10 +5425,6 @@ end;
               c_usableregs:=4;
               c_usableregs:=4;
            end;
            end;
          procinfo.aktproccode^.concatlist(exprasmlist);
          procinfo.aktproccode^.concatlist(exprasmlist);
-{$ifndef NEWINPUT}
-         current_module^.current_inputfile:=oldis;
-         current_module^.current_inputfile^.line_no:=oldnr;
-{$endif}
       end;
       end;
 
 
 end.
 end.
@@ -5454,7 +5432,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.10  1998-07-10 10:50:57  peter
+  Revision 1.11  1998-07-14 14:46:43  peter
+    * released NEWINPUT
+
+  Revision 1.10  1998/07/10 10:50:57  peter
     * m68k updates
     * m68k updates
 
 
   Revision 1.9  1998/07/06 15:51:16  michael
   Revision 1.9  1998/07/06 15:51:16  michael

+ 12 - 30
compiler/cgi386.pas

@@ -235,30 +235,22 @@ implementation
       begin
       begin
          oldcodegenerror:=codegenerror;
          oldcodegenerror:=codegenerror;
          oldswitches:=aktswitches;
          oldswitches:=aktswitches;
-{$ifdef NEWINPUT}
          oldpos:=aktfilepos;
          oldpos:=aktfilepos;
-         aktfilepos:=p^.fileinfo;
-{$else}
-         get_cur_file_pos(oldpos);
-         set_cur_file_pos(p^.fileinfo);
-{$endif NEWINPUT}
 
 
-         codegenerror:=false;
+         aktfilepos:=p^.fileinfo;
          aktswitches:=p^.pragmas;
          aktswitches:=p^.pragmas;
          if not(p^.error) then
          if not(p^.error) then
            begin
            begin
+              codegenerror:=false;
               procedures[p^.treetype](p);
               procedures[p^.treetype](p);
               p^.error:=codegenerror;
               p^.error:=codegenerror;
               codegenerror:=codegenerror or oldcodegenerror;
               codegenerror:=codegenerror or oldcodegenerror;
            end
            end
          else
          else
            codegenerror:=true;
            codegenerror:=true;
+
          aktswitches:=oldswitches;
          aktswitches:=oldswitches;
-{$ifdef NEWINPUT}
          aktfilepos:=oldpos;
          aktfilepos:=oldpos;
-{$else}
-         set_cur_file_pos(oldpos);
-{$endif NEWINPUT}
       end;
       end;
 
 
 
 
@@ -324,26 +316,17 @@ implementation
            end;
            end;
       end;
       end;
 
 
-    procedure generatecode(var p : ptree);
 
 
+    procedure generatecode(var p : ptree);
       var
       var
-           { *pass modifies with every node aktlinenr and current_module^.current_inputfile, }
-         { to constantly contain the right line numbers             }
-           oldis : pinputfile;
-         oldnr,i : longint;
+         i       : longint;
          regsize : topsize;
          regsize : topsize;
-         regi : tregister;
-          hr : preference;
-
-       label
+         regi    : tregister;
+         hr      : preference;
+      label
          nextreg;
          nextreg;
-
       begin
       begin
          cleartempgen;
          cleartempgen;
-{$ifndef NEWINPUT}
-         oldis:=current_module^.current_inputfile;
-         oldnr:=current_module^.current_inputfile^.line_no;
-{$endif}
          { when size optimization only count occurrence }
          { when size optimization only count occurrence }
          if cs_littlesize in aktswitches then
          if cs_littlesize in aktswitches then
            t_times:=1
            t_times:=1
@@ -514,16 +497,15 @@ implementation
            end;
            end;
          procinfo.aktproccode^.concatlist(exprasmlist);
          procinfo.aktproccode^.concatlist(exprasmlist);
          make_const_global:=false;
          make_const_global:=false;
-{$ifndef NEWINPUT}
-         current_module^.current_inputfile:=oldis;
-         current_module^.current_inputfile^.line_no:=oldnr;
-{$endif}
       end;
       end;
 
 
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.40  1998-07-07 11:19:52  peter
+  Revision 1.41  1998-07-14 14:46:44  peter
+    * released NEWINPUT
+
+  Revision 1.40  1998/07/07 11:19:52  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.39  1998/06/12 10:32:23  pierre
   Revision 1.39  1998/06/12 10:32:23  pierre

+ 9 - 10
compiler/cobjects.pas

@@ -118,7 +118,6 @@ unit cobjects;
 
 
        { string container }
        { string container }
        pstringcontainer = ^tstringcontainer;
        pstringcontainer = ^tstringcontainer;
-
        tstringcontainer = object
        tstringcontainer = object
           root,last : pstringitem;
           root,last : pstringitem;
 
 
@@ -143,11 +142,9 @@ unit cobjects;
           procedure clear;
           procedure clear;
        end;
        end;
 
 
-{$ifndef NEWINPUT}
-
-       pbufferedfile = ^tbufferedfile;
-
+{$ifdef BUFFEREDFILE}
        { this is implemented to allow buffered binary I/O }
        { this is implemented to allow buffered binary I/O }
+       pbufferedfile = ^tbufferedfile;
        tbufferedfile = object
        tbufferedfile = object
            f : file;
            f : file;
            buf : pchar;
            buf : pchar;
@@ -236,8 +233,7 @@ unit cobjects;
            { returns the crc }
            { returns the crc }
            function getcrc : longint;
            function getcrc : longint;
        end;
        end;
-
-{$endif NEWINPUT}
+{$endif BUFFEREDFILE}
 
 
     { releases the string p and assignes nil to p }
     { releases the string p and assignes nil to p }
     { if p=nil then freemem isn't called          }
     { if p=nil then freemem isn't called          }
@@ -738,7 +734,7 @@ end;
       end;
       end;
 
 
 
 
-{$ifndef NEWINPUT}
+{$ifdef BUFFEREDFILE}
 
 
 {****************************************************************************
 {****************************************************************************
                                TBUFFEREDFILE
                                TBUFFEREDFILE
@@ -1121,12 +1117,15 @@ end;
            end;
            end;
       end;
       end;
 
 
-{$endif NEWINPUT}
+{$endif BUFFEREDFILE}
 
 
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  1998-07-07 11:19:54  peter
+  Revision 1.12  1998-07-14 14:46:47  peter
+    * released NEWINPUT
+
+  Revision 1.11  1998/07/07 11:19:54  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.10  1998/07/01 15:26:59  peter
   Revision 1.10  1998/07/01 15:26:59  peter

+ 60 - 159
compiler/files.pas

@@ -42,7 +42,6 @@ unit files;
 {$endif}
 {$endif}
 
 
     type
     type
-{$ifdef NEWINPUT}
        pinputfile = ^tinputfile;
        pinputfile = ^tinputfile;
        tinputfile = object
        tinputfile = object
           path,name    : pstring;    { path and filename }
           path,name    : pstring;    { path and filename }
@@ -55,12 +54,18 @@ unit files;
           saveinputbuffer,
           saveinputbuffer,
           saveinputpointer : pchar;
           saveinputpointer : pchar;
 
 
+          linebuf      : plongint;   { line buffer to retrieve lines }
+          maxlinebuf   : longint;
+
           ref_count    : longint;    { to handle the browser refs }
           ref_count    : longint;    { to handle the browser refs }
           ref_index    : longint;
           ref_index    : longint;
           ref_next     : pinputfile;
           ref_next     : pinputfile;
 
 
           constructor init(const fn:string);
           constructor init(const fn:string);
           destructor done;
           destructor done;
+{$ifdef SourceLine}
+          function  getlinestr(l:longint):string;
+{$endif SourceLine}
        end;
        end;
 
 
        pfilemanager = ^tfilemanager;
        pfilemanager = ^tfilemanager;
@@ -76,47 +81,6 @@ unit files;
        end;
        end;
 
 
 
 
-{$else NEWINPUT}
-
-       { this isn't a text file, this is t-ext-file }
-       { which means a extended file this files can }
-       { be handled by a file manager               }
-       pextfile = ^textfile;
-       textfile = object(tbufferedfile)
-          path,name,ext : pstring;
-          _next      : pextfile; { else conflicts with tinputstack }
-          ref_index  : word;     { 65000 input files for a unit should be enough !! }
-          { p must be the complete path (with ending \ (or / for unix ...) }
-          constructor init(const p,n,e : string);
-          destructor done;virtual;
-       end;
-
-       pinputfile = ^tinputfile;
-       tinputfile = object(textfile)
-          filenotatend : boolean;
-          line_no      : longint;    { position to give out }
-          true_line    : longint;    { real line counter }
-          column       : longint;
-          next         : pinputfile; { next input file in the stack of input files }
-          ref_count    : longint;    { to handle the browser refs }
-          constructor init(const p,n,e : string);
-          procedure write_file_line(var t : text); { writes the file name and line number to t }
-          function  get_file_line : string;
-       end;
-
-       pfilemanager = ^tfilemanager;
-       tfilemanager = object
-          files : pextfile;
-          last_ref_index : word;
-          constructor init;
-          destructor done;
-          procedure close_all;
-          procedure register_file(f : pextfile);
-          function  get_file(w : word) : pextfile;
-       end;
-
-{$endif NEWINPUT}
-
     type
     type
        tunitmap = array[0..maxunits-1] of pointer;
        tunitmap = array[0..maxunits-1] of pointer;
        punitmap = ^tunitmap;
        punitmap = ^tunitmap;
@@ -152,10 +116,9 @@ unit files;
           linkstaticlibs,
           linkstaticlibs,
           linkofiles    : tstringcontainer;
           linkofiles    : tstringcontainer;
           used_units    : tlinkedlist;
           used_units    : tlinkedlist;
-{$ifndef NEWINPUT}
-          current_inputfile : pinputfile;
-{$endif}
+
           { used in firstpass for faster settings }
           { used in firstpass for faster settings }
+          scanner       : pointer;
           current_index : word;
           current_index : word;
 
 
           path,                     { path where the module is find/created }
           path,                     { path where the module is find/created }
@@ -289,8 +252,6 @@ unit files;
   uses
   uses
     dos,verbose,systems;
     dos,verbose,systems;
 
 
-{$ifdef NEWINPUT}
-
 {****************************************************************************
 {****************************************************************************
                                   TINPUTFILE
                                   TINPUTFILE
  ****************************************************************************}
  ****************************************************************************}
@@ -303,9 +264,15 @@ unit files;
         name:=stringdup(n+e);
         name:=stringdup(n+e);
         path:=stringdup(p);
         path:=stringdup(p);
         next:=nil;
         next:=nil;
+      { indexing refs }
         ref_next:=nil;
         ref_next:=nil;
         ref_count:=0;
         ref_count:=0;
         ref_index:=0;
         ref_index:=0;
+{$ifdef SourceLine}
+      { line buffer }
+        linebuf:=nil;
+        maxlinebuf:=0;
+{$endif SourceLine}
       end;
       end;
 
 
 
 
@@ -313,9 +280,50 @@ unit files;
       begin
       begin
         stringdispose(path);
         stringdispose(path);
         stringdispose(name);
         stringdispose(name);
+{$ifdef SourceLine}
+      { free memory }
+        if assigned(linebuf) then
+         freemem(linebuf,maxlinebuf shl 2);
+{$endif SourceLine}
       end;
       end;
 
 
 
 
+{$ifdef SourceLine}
+    function tinputfile.getlinestr(l:longint):string;
+      var
+        c : char;
+        i,fpos : longint;
+      begin
+        getlinestr:='';
+        if l<maxlinebuf then
+         begin
+           fpos:=plongint(longint(linebuf)+line_no*2)^;
+         { in current buf ? }
+           if (fpos<bufstart) or (fpos>bufstart+bufsize) then
+            begin
+              seekbuf(fpos);
+              readbuf;
+            end;
+         { the begin is in the buf now simply read until #13,#10 }
+           i:=0;
+
+           inputpointer:=inputbuffer;
+           c:=inputpointer^;
+           while (i<255) and not(c in [#13,#10]) do
+            begin
+              inc(i);
+              getlinestr[i]:=c;
+              c:=inputpointer^;
+              if c=#0 then
+               reload
+              else
+               inc(longint(inputpointer));
+            end;
+           getlinestr[0]:=chr(i);
+         end;
+      end;
+{$endif SourceLine}
+
 {****************************************************************************
 {****************************************************************************
                                 TFILEMANAGER
                                 TFILEMANAGER
  ****************************************************************************}
  ****************************************************************************}
@@ -385,114 +393,6 @@ unit files;
         get_file_path:='';
         get_file_path:='';
      end;
      end;
 
 
-{$else NEWINPUT}
-
-{****************************************************************************
-                                  TFILE
- ****************************************************************************}
-
-    constructor textfile.init(const p,n,e : string);
-      begin
-         inherited init(p+n+e,extbufsize);
-         path:=stringdup(p);
-         name:=stringdup(n);
-         ext:=stringdup(e);
-      end;
-
-    destructor textfile.done;
-      begin
-         inherited done;
-      end;
-
-
-{****************************************************************************
-                                  TINPUTFILE
- ****************************************************************************}
-
-    constructor tinputfile.init(const p,n,e : string);
-      begin
-         inherited init(p,n,e);
-         filenotatend:=true;
-         line_no:=1;
-         true_line:=1;
-         column:=1;
-         next:=nil;
-      end;
-
-    procedure tinputfile.write_file_line(var t : text);
-      begin
-         write(t,get_file_line);
-      end;
-
-
-    function tinputfile.get_file_line : string;
-      begin
-        if Use_Rhide then
-          get_file_line:=lower(bstoslash(path^)+name^+ext^)+':'+tostr(line_no)+':'
-        else
-          get_file_line:=name^+ext^+'('+tostr(line_no)+')'
-      end;
-
-
-{****************************************************************************
-                                TFILEMANAGER
- ****************************************************************************}
-
-    constructor tfilemanager.init;
-      begin
-         files:=nil;
-         last_ref_index:=0;
-      end;
-
-
-    destructor tfilemanager.done;
-      var
-         hp : pextfile;
-      begin
-         hp:=files;
-         while assigned(hp) do
-           begin
-              files:=files^._next;
-              dispose(hp,done);
-              hp:=files;
-           end;
-         last_ref_index:=0;
-      end;
-
-
-    procedure tfilemanager.close_all;
-      var
-         hp : pextfile;
-      begin
-         hp:=files;
-         while assigned(hp) do
-           begin
-              hp^.close;
-              hp:=hp^._next;
-           end;
-      end;
-
-
-    procedure tfilemanager.register_file(f : pextfile);
-      begin
-         inc(last_ref_index);
-         f^._next:=files;
-         f^.ref_index:=last_ref_index;
-         files:=f;
-      end;
-
-
-   function tfilemanager.get_file(w : word) : pextfile;
-     var
-        ff : pextfile;
-     begin
-        ff:=files;
-        while assigned(ff) and (ff^.ref_index<>w) do
-          ff:=ff^._next;
-        get_file:=ff;
-     end;
-
-{$endif NEWINPUT}
 
 
 {****************************************************************************
 {****************************************************************************
                                   TMODULE
                                   TMODULE
@@ -968,9 +868,7 @@ unit files;
          linkstaticlibs.init;
          linkstaticlibs.init;
          linksharedlibs.init;
          linksharedlibs.init;
          ppufile:=nil;
          ppufile:=nil;
-{$ifndef NEWINPUT}
-         current_inputfile:=nil;
-{$endif}
+         scanner:=nil;
          map:=nil;
          map:=nil;
          symtable:=nil;
          symtable:=nil;
          flags:=0;
          flags:=0;
@@ -1105,7 +1003,10 @@ unit files;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.30  1998-07-07 11:19:55  peter
+  Revision 1.31  1998-07-14 14:46:48  peter
+    * released NEWINPUT
+
+  Revision 1.30  1998/07/07 11:19:55  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.29  1998/06/25 10:51:00  pierre
   Revision 1.29  1998/06/25 10:51:00  pierre

+ 113 - 156
compiler/parser.pas

@@ -91,99 +91,67 @@ unit parser;
 
 
     procedure compile(const filename:string;compile_system:boolean);
     procedure compile(const filename:string;compile_system:boolean);
       var
       var
-         { some variables to save the compiler state }
-         oldtoken : ttoken;
-         oldtokenpos : tfileposinfo;
-         oldpattern : stringid;
-
-         oldpreprocstack : ppreprocstack;
-         oldorgpattern,oldprocprefix : string;
+       { scanner }
+         oldtoken       : ttoken;
+         oldtokenpos    : tfileposinfo;
+         oldc           : char;
+         oldpattern,
+         oldorgpattern  : string;
          old_block_type : tblock_type;
          old_block_type : tblock_type;
-{$ifdef NEWINPUT}
          oldcurrent_scanner : pscannerfile;
          oldcurrent_scanner : pscannerfile;
-         oldaktfilepos : tfileposinfo;
-         oldlastlinepos : longint;
-{$else}
-         oldcurrlinepos,
-         oldlastlinepos,
-{$endif NEWINPUT}
-         oldinputbuffer,
-         oldinputpointer : pchar;
-         olds_point,oldparse_only : boolean;
-         oldc : char;
-         oldcomment_level : word;
+       { symtable }
+         oldmacros,
+         oldrefsymtable,
+         oldsymtablestack : psymtable;
+         oldprocprefix    : string;
+         oldaktprocsym    : pprocsym;
+       { cg }
          oldnextlabelnr : longint;
          oldnextlabelnr : longint;
-         oldmacros,oldrefsymtable,oldsymtablestack : psymtable;
-
-         oldimports,oldexports,oldresource,oldrttilist,
-         oldbsssegment,olddatasegment,oldcodesegment,
-         oldexprasmlist,olddebuglist,
-         oldinternals,oldexternals,oldconsts : paasmoutput;
-
-         oldswitches     : tcswitches;
-         oldpackrecords  : word;
-         oldoutputformat : tasm;
-         oldoptprocessor : tprocessors;
-         oldasmmode      : tasmmode;
+         oldparse_only  : boolean;
+       { asmlists }
+         oldimports,
+         oldexports,
+         oldresource,
+         oldrttilist,
+         oldbsssegment,
+         olddatasegment,
+         oldcodesegment,
+         oldexprasmlist,
+         olddebuglist,
+         oldinternals,
+         oldexternals,
+         oldconsts     : paasmoutput;
+       { akt.. things }
+         oldaktswitches     : tcswitches;
+         oldaktfilepos      : tfileposinfo;
+         oldaktpackrecords  : word;
+         oldaktoutputformat : tasm;
+         oldaktoptprocessor : tprocessors;
+         oldaktasmmode      : tasmmode;
 
 
       label
       label
          done;
          done;
 
 
-      begin {compile}
+      begin
          inc(compile_level);
          inc(compile_level);
-         { save old state }
-
-         { save symtable state }
+       { save symtable state }
          oldsymtablestack:=symtablestack;
          oldsymtablestack:=symtablestack;
-         symtablestack:=nil;
          oldrefsymtable:=refsymtable;
          oldrefsymtable:=refsymtable;
-         refsymtable:=nil;
+         oldmacros:=macros;
          oldprocprefix:=procprefix;
          oldprocprefix:=procprefix;
-
-         { a long time, this was only in init_parser
-           but it should be reset to zero for each module }
-         aktprocsym:=nil;
-
-       { reset the unit or create a new program }
-         if assigned(current_module) then
-          begin
-            current_module^.sourcefiles.done;
-            current_module^.sourcefiles.init;
-            current_module^.used_units.done;
-            current_module^.used_units.init;
-          end
-         else
-          begin
-            current_module:=new(pmodule,init(filename,false));
-            main_module:=current_module;
-          end;
-
-         { save scanner state }
-{$ifdef NEWINPUT}
-         oldaktfilepos:=aktfilepos;
-         oldcurrent_scanner:=current_scanner;
-{$else}
-         oldcurrlinepos:=currlinepos;
-         oldpreprocstack:=preprocstack;
-         oldinputbuffer:=inputbuffer;
-         oldinputpointer:=inputpointer;
-         oldlastlinepos:=lastlinepos;
-         olds_point:=s_point;
-         oldcomment_level:=comment_level;
-{$endif}
+         oldaktprocsym:=aktprocsym;
+       { save scanner state }
          oldc:=c;
          oldc:=c;
          oldpattern:=pattern;
          oldpattern:=pattern;
-         oldtoken:=token;
-         oldtokenpos:=tokenpos;
          oldorgpattern:=orgpattern;
          oldorgpattern:=orgpattern;
+         oldtoken:=token;
          old_block_type:=block_type;
          old_block_type:=block_type;
-
-         oldmacros:=macros;
-
+         oldtokenpos:=tokenpos;
+         oldcurrent_scanner:=current_scanner;
+       { save cg }
          oldnextlabelnr:=nextlabelnr;
          oldnextlabelnr:=nextlabelnr;
          oldparse_only:=parse_only;
          oldparse_only:=parse_only;
-
-         { save assembler lists }
+       { save assembler lists }
          olddatasegment:=datasegment;
          olddatasegment:=datasegment;
          oldbsssegment:=bsssegment;
          oldbsssegment:=bsssegment;
          oldcodesegment:=codesegment;
          oldcodesegment:=codesegment;
@@ -196,13 +164,40 @@ unit parser;
          oldimports:=importssection;
          oldimports:=importssection;
          oldexports:=exportssection;
          oldexports:=exportssection;
          oldresource:=resourcesection;
          oldresource:=resourcesection;
+       { save akt... state }
+         oldaktswitches:=aktswitches;
+         oldaktpackrecords:=aktpackrecords;
+         oldaktoutputformat:=aktoutputformat;
+         oldaktoptprocessor:=aktoptprocessor;
+         oldaktasmmode:=aktasmmode;
+         oldaktfilepos:=aktfilepos;
+
+       { show info }
+         Message1(parser_i_compiling,filename);
 
 
-         { save the current state }
-         oldswitches:=aktswitches;
-         oldpackrecords:=aktpackrecords;
-         oldoutputformat:=aktoutputformat;
-         oldoptprocessor:=aktoptprocessor;
-         oldasmmode:=aktasmmode;
+       { reset symtable }
+         symtablestack:=nil;
+         refsymtable:=nil;
+         procprefix:='';
+         aktprocsym:=nil;
+         { macros }
+         macros:=new(psymtable,init(macrosymtable));
+         macros^.name:=stringdup('Conditionals for '+filename);
+         default_macros;
+
+       { reset the unit or create a new program }
+         if assigned(current_module) then
+          begin
+            current_module^.sourcefiles.done;
+            current_module^.sourcefiles.init;
+            current_module^.used_units.done;
+            current_module^.used_units.init;
+          end
+         else
+          begin
+            current_module:=new(pmodule,init(filename,false));
+            main_module:=current_module;
+          end;
 
 
        { Load current state from the init values }
        { Load current state from the init values }
          aktswitches:=initswitches;
          aktswitches:=initswitches;
@@ -210,28 +205,14 @@ unit parser;
          aktoutputformat:=initoutputformat;
          aktoutputformat:=initoutputformat;
          aktoptprocessor:=initoptprocessor;
          aktoptprocessor:=initoptprocessor;
          aktasmmode:=initasmmode;
          aktasmmode:=initasmmode;
-
-       { we need this to make the system unit }
+         { we need this to make the system unit }
          if compile_system then
          if compile_system then
           aktswitches:=aktswitches+[cs_compilesystem];
           aktswitches:=aktswitches+[cs_compilesystem];
 
 
-       { macros }
-         macros:=new(psymtable,init(macrosymtable));
-         macros^.name:=stringdup('Conditionals for '+filename);
-         default_macros;
-
        { startup scanner }
        { startup scanner }
-{$ifdef NEWINPUT}
          current_scanner:=new(pscannerfile,Init(filename));
          current_scanner:=new(pscannerfile,Init(filename));
          token:=current_scanner^.yylex;
          token:=current_scanner^.yylex;
-{$else}
-         InitScanner(filename);
-         token:=yylex;
-{$endif}
-
-         Message1(parser_i_compiling,filename);
-
-       { global switches are read, so further changes aren't allowed }
+         { global switches are read, so further changes aren't allowed }
          current_module^.in_main:=true;
          current_module^.in_main:=true;
 
 
        { init code generator for a new module }
        { init code generator for a new module }
@@ -325,67 +306,30 @@ done:
          reset_gdb_info;
          reset_gdb_info;
 {$endif GDB}
 {$endif GDB}
 
 
-         { restore symtable state }
-         if (compile_level>1) then
-           begin
-             refsymtable:=oldrefsymtable;
-             symtablestack:=oldsymtablestack;
-           end;
-
-         procprefix:=oldprocprefix;
-
-{$ifdef UseBrowser}
-       {  close input files, but dont remove if we use the browser ! }
-         if cs_browser in initswitches then
-          current_module^.sourcefiles.close_all
-         else
-          current_module^.sourcefiles.done;
-{$else UseBrowser}
-       { close the inputfiles }
-         current_module^.sourcefiles.done;
-{$endif not UseBrowser}
+       { free ppu }
          if assigned(current_module^.ppufile) then
          if assigned(current_module^.ppufile) then
-           begin
-              dispose(current_module^.ppufile,done);
-              current_module^.ppufile:=nil;
-           end;
-
-         { call donescanner before restoring preprocstack, because }
-         { donescanner tests for a empty preprocstack              }
-         { and can also check for unused macros                    }
-{$ifdef NEWINPUT}
+          begin
+            dispose(current_module^.ppufile,done);
+            current_module^.ppufile:=nil;
+          end;
+       { free scanner }
          dispose(current_scanner,done);
          dispose(current_scanner,done);
-{$else}
-         donescanner(current_module^.compiled);
-{$endif}
+       { free macros }
+{!!! No check for unused macros yet !!! }
          dispose(macros,done);
          dispose(macros,done);
 
 
-         { restore scanner }
-{$ifdef NEWINPUT}
-         aktfilepos:=oldaktfilepos;
-         current_scanner:=oldcurrent_scanner;
-{$else}
-         preprocstack:=oldpreprocstack;
-         inputbuffer:=oldinputbuffer;
-         inputpointer:=oldinputpointer;
-         lastlinepos:=oldlastlinepos;
-         currlinepos:=oldcurrlinepos;
-         s_point:=olds_point;
-         comment_level:=oldcomment_level;
-{$endif}
+       { restore scanner }
          c:=oldc;
          c:=oldc;
          pattern:=oldpattern;
          pattern:=oldpattern;
+         orgpattern:=oldorgpattern;
          token:=oldtoken;
          token:=oldtoken;
          tokenpos:=oldtokenpos;
          tokenpos:=oldtokenpos;
-         orgpattern:=oldorgpattern;
          block_type:=old_block_type;
          block_type:=old_block_type;
-
+         current_scanner:=oldcurrent_scanner;
+       { restore cg }
          nextlabelnr:=oldnextlabelnr;
          nextlabelnr:=oldnextlabelnr;
          parse_only:=oldparse_only;
          parse_only:=oldparse_only;
-
-         macros:=oldmacros;
-
-         { restore asmlists }
+       { restore asmlists }
          exprasmlist:=oldexprasmlist;
          exprasmlist:=oldexprasmlist;
          datasegment:=olddatasegment;
          datasegment:=olddatasegment;
          bsssegment:=oldbsssegment;
          bsssegment:=oldbsssegment;
@@ -398,13 +342,22 @@ done:
          exportssection:=oldexports;
          exportssection:=oldexports;
          resourcesection:=oldresource;
          resourcesection:=oldresource;
          rttilist:=oldrttilist;
          rttilist:=oldrttilist;
-
-         { restore current state }
-         aktswitches:=oldswitches;
-         aktpackrecords:=oldpackrecords;
-         aktoutputformat:=oldoutputformat;
-         aktoptprocessor:=oldoptprocessor;
-         aktasmmode:=oldasmmode;
+       { restore symtable state }
+         if (compile_level>1) then
+           begin
+             refsymtable:=oldrefsymtable;
+             symtablestack:=oldsymtablestack;
+           end;
+         macros:=oldmacros;
+         aktprocsym:=oldaktprocsym;
+         procprefix:=oldprocprefix;
+       { restore current state }
+         aktswitches:=oldaktswitches;
+         aktpackrecords:=oldaktpackrecords;
+         aktoutputformat:=oldaktoutputformat;
+         aktoptprocessor:=oldaktoptprocessor;
+         aktasmmode:=oldaktasmmode;
+         aktfilepos:=oldaktfilepos;
 
 
        { Shut down things when the last file is compiled }
        { Shut down things when the last file is compiled }
          if (compile_level=1) then
          if (compile_level=1) then
@@ -426,13 +379,17 @@ done:
              end;
              end;
 {$endif UseBrowser}
 {$endif UseBrowser}
           end;
           end;
+
          dec(compile_level);
          dec(compile_level);
       end;
       end;
 
 
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.29  1998-07-07 11:19:59  peter
+  Revision 1.30  1998-07-14 14:46:49  peter
+    * released NEWINPUT
+
+  Revision 1.29  1998/07/07 11:19:59  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.28  1998/06/25 11:15:33  pierre
   Revision 1.28  1998/06/25 11:15:33  pierre

+ 5 - 25
compiler/pass_1.pas

@@ -4297,20 +4297,12 @@ unit pass_1;
                      (hp^.left^.treetype<>labeln) then
                      (hp^.left^.treetype<>labeln) then
                      begin
                      begin
                         { use correct line number }
                         { use correct line number }
-{$ifdef NEWINPUT}
                         aktfilepos:=hp^.left^.fileinfo;
                         aktfilepos:=hp^.left^.fileinfo;
-{$else}
-                        set_current_file_line(hp^.left);
-{$endif}
                         disposetree(hp^.left);
                         disposetree(hp^.left);
                         hp^.left:=nil;
                         hp^.left:=nil;
                         Message(cg_w_unreachable_code);
                         Message(cg_w_unreachable_code);
                         { old lines }
                         { old lines }
-{$ifdef NEWINPUT}
                         aktfilepos:=hp^.right^.fileinfo;
                         aktfilepos:=hp^.right^.fileinfo;
-{$else}
-                        set_current_file_line(hp^.left);
-{$endif}
                      end;
                      end;
                 end;
                 end;
               if assigned(hp^.right) then
               if assigned(hp^.right) then
@@ -4979,14 +4971,8 @@ unit pass_1;
          if (p^.firstpasscount>0) and only_one_pass then
          if (p^.firstpasscount>0) and only_one_pass then
            exit;
            exit;
 {$endif extdebug}
 {$endif extdebug}
-         { if we save there the whole stuff, }
-         { line numbers become more correct  }
-{$ifdef NEWINPUT}
-         oldpos:=aktfilepos;
-{$else}
-         get_cur_file_pos(oldpos);
-{$endif NEWINPUT}
          oldcodegenerror:=codegenerror;
          oldcodegenerror:=codegenerror;
+         oldpos:=aktfilepos;
          oldswitches:=aktswitches;
          oldswitches:=aktswitches;
 {$ifdef extdebug}
 {$ifdef extdebug}
          if p^.firstpasscount>0 then
          if p^.firstpasscount>0 then
@@ -5001,13 +4987,8 @@ unit pass_1;
            not_first:=false;
            not_first:=false;
 {$endif extdebug}
 {$endif extdebug}
 
 
-{$ifdef NEWINPUT}
          aktfilepos:=p^.fileinfo;
          aktfilepos:=p^.fileinfo;
-{$else}
-         set_cur_file_pos(p^.fileinfo);
-{$endif NEWINPUT}
          aktswitches:=p^.pragmas;
          aktswitches:=p^.pragmas;
-
          if not p^.error then
          if not p^.error then
            begin
            begin
               codegenerror:=false;
               codegenerror:=false;
@@ -5035,11 +5016,7 @@ unit pass_1;
            inc(p^.firstpasscount);
            inc(p^.firstpasscount);
 {$endif extdebug}
 {$endif extdebug}
          aktswitches:=oldswitches;
          aktswitches:=oldswitches;
-{$ifdef NEWINPUT}
          aktfilepos:=oldpos;
          aktfilepos:=oldpos;
-{$else}
-         set_cur_file_pos(oldpos);
-{$endif NEWINPUT}
       end;
       end;
 
 
     function do_firstpass(var p : ptree) : boolean;
     function do_firstpass(var p : ptree) : boolean;
@@ -5064,7 +5041,10 @@ unit pass_1;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.37  1998-07-07 12:31:44  peter
+  Revision 1.38  1998-07-14 14:46:50  peter
+    * released NEWINPUT
+
+  Revision 1.37  1998/07/07 12:31:44  peter
     * fixed string:= which allowed almost any type
     * fixed string:= which allowed almost any type
 
 
   Revision 1.36  1998/07/07 11:20:00  peter
   Revision 1.36  1998/07/07 11:20:00  peter

+ 5 - 12
compiler/pbase.pas

@@ -97,11 +97,7 @@ unit pbase;
       procedure syntaxerror(s : string);
       procedure syntaxerror(s : string);
 
 
         begin
         begin
-{$ifdef NEWINPUT}
            Message2(scan_f_syn_expected,tostr(aktfilepos.column),s);
            Message2(scan_f_syn_expected,tostr(aktfilepos.column),s);
-{$else}
-           Message2(scan_f_syn_expected,tostr(get_current_col),s);
-{$endif}
         end;
         end;
 
 
       { This is changed since I changed the order of token
       { This is changed since I changed the order of token
@@ -155,7 +151,7 @@ unit pbase;
            begin
            begin
              if token=_END then
              if token=_END then
                 last_endtoken_filepos:=tokenpos;
                 last_endtoken_filepos:=tokenpos;
-             token:={$ifdef NEWINPUT}current_scanner^.{$endif}yylex;
+             token:=current_scanner^.yylex;
            end;
            end;
       end;
       end;
 
 
@@ -211,13 +207,7 @@ unit pbase;
            begin
            begin
               s:=sc^.get_with_tokeninfo(filepos);
               s:=sc^.get_with_tokeninfo(filepos);
               ss:=new(pvarsym,init(s,def));
               ss:=new(pvarsym,init(s,def));
-{$ifdef NEWINPUT}       
-
               ss^.fileinfo:=filepos;
               ss^.fileinfo:=filepos;
-{$else}
-              ss^.line_no:=filepos.line;
-{$endif}        
-
               st^.insert(ss);
               st^.insert(ss);
               { static data fields are inserted in the globalsymtable }
               { static data fields are inserted in the globalsymtable }
               if (st^.symtabletype=objectsymtable) and
               if (st^.symtabletype=objectsymtable) and
@@ -234,7 +224,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.12  1998-07-09 23:59:59  peter
+  Revision 1.13  1998-07-14 14:46:52  peter
+    * released NEWINPUT
+
+  Revision 1.12  1998/07/09 23:59:59  peter
     * fixed ttypesym bug finally
     * fixed ttypesym bug finally
     * fileinfo in the symtable and better using for unused vars
     * fileinfo in the symtable and better using for unused vars
 
 

+ 5 - 20
compiler/pdecl.pas

@@ -188,7 +188,7 @@ unit pdecl;
          symdone : boolean;
          symdone : boolean;
          { to handle absolute }
          { to handle absolute }
          abssym : pabsolutesym;
          abssym : pabsolutesym;
-{$ifdef i386}   
+{$ifdef i386}
 
 
          l    : longint;
          l    : longint;
          code : word;
          code : word;
@@ -241,13 +241,7 @@ unit pdecl;
                    abssym^.typ:=absolutesym;
                    abssym^.typ:=absolutesym;
                    abssym^.abstyp:=tovar;
                    abssym^.abstyp:=tovar;
                    abssym^.ref:=srsym;
                    abssym^.ref:=srsym;
-{$ifdef NEWINPUT}
                    abssym^.fileinfo:=filepos;
                    abssym^.fileinfo:=filepos;
-{$else}         
-
-                   abssym^.line_no:=filepos.line;
-{$endif}                
-
                    symtablestack^.insert(abssym);
                    symtablestack^.insert(abssym);
                  end
                  end
                 else
                 else
@@ -259,13 +253,7 @@ unit pdecl;
                     abssym^.typ:=absolutesym;
                     abssym^.typ:=absolutesym;
                     abssym^.abstyp:=toasm;
                     abssym^.abstyp:=toasm;
                     abssym^.asmname:=stringdup(s);
                     abssym^.asmname:=stringdup(s);
-{$ifdef NEWINPUT}
                     abssym^.fileinfo:=filepos;
                     abssym^.fileinfo:=filepos;
-{$else}         
-
-                    abssym^.line_no:=filepos.line;
-{$endif}                
-
                     symtablestack^.insert(abssym);
                     symtablestack^.insert(abssym);
                   end
                   end
                 else
                 else
@@ -279,13 +267,7 @@ unit pdecl;
                        abssym^.typ:=absolutesym;
                        abssym^.typ:=absolutesym;
                        abssym^.abstyp:=toaddr;
                        abssym^.abstyp:=toaddr;
                        abssym^.absseg:=false;
                        abssym^.absseg:=false;
-{$ifdef NEWINPUT}
                        abssym^.fileinfo:=filepos;
                        abssym^.fileinfo:=filepos;
-{$else}         
-
-                       abssym^.line_no:=filepos.line;
-{$endif}                
-
                        s:=pattern;
                        s:=pattern;
                        consume(INTCONST);
                        consume(INTCONST);
                        val(s,abssym^.address,code);
                        val(s,abssym^.address,code);
@@ -1882,7 +1864,10 @@ unit pdecl;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.30  1998-07-10 00:00:00  peter
+  Revision 1.31  1998-07-14 14:46:53  peter
+    * released NEWINPUT
+
+  Revision 1.30  1998/07/10 00:00:00  peter
     * fixed ttypesym bug finally
     * fixed ttypesym bug finally
     * fileinfo in the symtable and better using for unused vars
     * fileinfo in the symtable and better using for unused vars
 
 

+ 5 - 18
compiler/pmodules.pas

@@ -120,7 +120,7 @@ unit pmodules;
          datasegment^.concat(new(pai_symbol,init_global('HEAPSIZE')));
          datasegment^.concat(new(pai_symbol,init_global('HEAPSIZE')));
 {$endif i386}
 {$endif i386}
 {$ifdef m68k}
 {$ifdef m68k}
-	 datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE')));
+         datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE')));
 {$endif m68k}
 {$endif m68k}
          datasegment^.concat(new(pai_const,init_32bit(heapsize)));
          datasegment^.concat(new(pai_const,init_32bit(heapsize)));
       end;
       end;
@@ -259,18 +259,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
-{$ifdef NEWINPUT}
                 current_scanner^.close;
                 current_scanner^.close;
                 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^.reopen;
                  current_scanner^.reopen;
-{$else}
-                if assigned(old_current_module^.current_inputfile) then
-                 old_current_module^.current_inputfile^.tempclose;
-                compile(current_module^.mainsource^,compile_system);
-                if (not old_current_module^.compiled) and assigned(old_current_module^.current_inputfile) then
-                 old_current_module^.current_inputfile^.tempreopen;
-{$endif}
               end;
               end;
            end
            end
           else
           else
@@ -767,26 +759,18 @@ unit pmodules;
          if token=ID then
          if token=ID then
           begin
           begin
           { create filenames and unit name }
           { create filenames and unit name }
-{$ifdef NEWINPUT}
              current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
              current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
-{$else}
-             current_module^.SetFileName(current_module^.current_inputfile^.path^+current_module^.current_inputfile^.name^);
-{$endif}
              stringdispose(current_module^.modulename);
              stringdispose(current_module^.modulename);
              current_module^.modulename:=stringdup(upper(pattern));
              current_module^.modulename:=stringdup(upper(pattern));
           { check for system unit }
           { check for system unit }
              new(s1);
              new(s1);
              new(s2);
              new(s2);
              s1^:=upper(target_info.system_unit);
              s1^:=upper(target_info.system_unit);
-{$ifdef NEWINPUT}
              s2^:=upper(current_scanner^.inputfile^.name^);
              s2^:=upper(current_scanner^.inputfile^.name^);
              { strip extension, there could only be one dot }
              { strip extension, there could only be one dot }
              i:=pos('.',s2^);
              i:=pos('.',s2^);
              if i>0 then
              if i>0 then
               s2^:=Copy(s2^,1,i-1);
               s2^:=Copy(s2^,1,i-1);
-{$else}
-             s2^:=upper(current_module^.current_inputfile^.name^);
-{$endif}
              if (cs_compilesystem in aktswitches)  then
              if (cs_compilesystem in aktswitches)  then
               begin
               begin
                 if (cs_check_unit_name in aktswitches) and
                 if (cs_check_unit_name in aktswitches) and
@@ -1182,7 +1166,10 @@ unit pmodules;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.35  1998-07-08 12:39:38  peter
+  Revision 1.36  1998-07-14 14:46:54  peter
+    * released NEWINPUT
+
+  Revision 1.35  1998/07/08 12:39:38  peter
     * heap_size for m68k
     * heap_size for m68k
 
 
   Revision 1.34  1998/07/07 11:20:03  peter
   Revision 1.34  1998/07/07 11:20:03  peter

+ 6 - 9
compiler/pp.pas

@@ -246,12 +246,7 @@ begin
             end;
             end;
      end;
      end;
    {when the module is assigned, then the messagefile is also loaded}
    {when the module is assigned, then the messagefile is also loaded}
-{$ifdef NEWINPUT}
      Writeln('Compilation aborted at line ',aktfilepos.line);
      Writeln('Compilation aborted at line ',aktfilepos.line);
-{$else}
-     if assigned(current_module) and assigned(current_module^.current_inputfile) then
-      Writeln('Compilation aborted at line ',current_module^.current_inputfile^.line_no);
-{$endif}
    end;
    end;
 end;
 end;
 
 
@@ -380,10 +375,9 @@ begin
       start:=getrealtime-start;
       start:=getrealtime-start;
       Message2(general_i_abslines_compiled,tostr(status.compiledlines),tostr(trunc(start))+'.'+tostr(trunc(frac(start)*10)));
       Message2(general_i_abslines_compiled,tostr(status.compiledlines),tostr(trunc(start))+'.'+tostr(trunc(frac(start)*10)));
     end;
     end;
-{***Obsolete
-   clearnodes;
-***}
+
    done_symtable;
    done_symtable;
+
 {$ifdef TP}
 {$ifdef TP}
    Comment(V_Info,'Memory: '+tostr(MemAvail)+' Bytes Free');
    Comment(V_Info,'Memory: '+tostr(MemAvail)+' Bytes Free');
 {$endif}
 {$endif}
@@ -398,7 +392,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  1998-07-07 11:20:04  peter
+  Revision 1.20  1998-07-14 14:46:55  peter
+    * released NEWINPUT
+
+  Revision 1.19  1998/07/07 11:20:04  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.18  1998/06/24 14:06:33  peter
   Revision 1.18  1998/06/24 14:06:33  peter

+ 72 - 89
compiler/ra386att.pas

@@ -329,10 +329,10 @@ const
     token := AS_NONE;
     token := AS_NONE;
     { while space and tab , continue scan... }
     { while space and tab , continue scan... }
     while c in [' ',#9] do
     while c in [' ',#9] do
-     c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+     c:=current_scanner^.asmgetchar;
     { Possiblities for first token in a statement:                }
     { Possiblities for first token in a statement:                }
     {   Local Label, Label, Directive, Prefix or Opcode....       }
     {   Local Label, Label, Directive, Prefix or Opcode....       }
-    {$ifdef NEWINPUT}current_scanner^.{$endif}gettokenpos;
+    current_scanner^.gettokenpos;
     if firsttoken and not (c in [newline,#13,'{',';']) then
     if firsttoken and not (c in [newline,#13,'{',';']) then
     begin
     begin
       firsttoken := FALSE;
       firsttoken := FALSE;
@@ -341,11 +341,11 @@ const
       begin
       begin
         actasmpattern := c;
         actasmpattern := c;
         { Let us point to the next character }
         { Let us point to the next character }
-        c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+        c := current_scanner^.asmgetchar;
         while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
         while c in ['A'..'Z','a'..'z','0'..'9','_','$'] do
         begin
         begin
          actasmpattern := actasmpattern + c;
          actasmpattern := actasmpattern + c;
-         c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+         c := current_scanner^.asmgetchar;
         end;
         end;
 
 
         { this is a local label... }
         { this is a local label... }
@@ -356,7 +356,7 @@ const
           { delete .L }
           { delete .L }
           delete(actasmpattern,1,2);
           delete(actasmpattern,1,2);
           { point to next character ... }
           { point to next character ... }
-          c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+          c := current_scanner^.asmgetchar;
           exit;
           exit;
         end
         end
         { must be a directive }
         { must be a directive }
@@ -374,31 +374,11 @@ const
         end;
         end;
       end; { endif }
       end; { endif }
 
 
-{$ifndef NEWINPUT}
-      if c='/' then
-        begin
-           c:=asmgetchar;
-           { att styled comment }
-           if c='/' then
-             begin
-                repeat
-                   c:=asmgetchar;
-                until c=newline;
-                firsttoken := TRUE;
-                gettoken:=AS_SEPARATOR;
-                c:=asmgetchar;
-                exit;
-             end
-           else
-             Message(assem_e_slash_at_begin_of_line_not_allowed);
-        end;
-{$endif}
-
       { only opcodes and global labels are allowed now. }
       { only opcodes and global labels are allowed now. }
       while c in ['A'..'Z','a'..'z','0'..'9','_'] do
       while c in ['A'..'Z','a'..'z','0'..'9','_'] do
       begin
       begin
          actasmpattern := actasmpattern + c;
          actasmpattern := actasmpattern + c;
-         c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+         c := current_scanner^.asmgetchar;
       end;
       end;
 
 
       if c = ':' then
       if c = ':' then
@@ -410,7 +390,7 @@ const
            for labels !! (PM) }
            for labels !! (PM) }
            token := AS_LABEL;
            token := AS_LABEL;
            { let us point to the next character }
            { let us point to the next character }
-           c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+           c := current_scanner^.asmgetchar;
            gettoken := token;
            gettoken := token;
            exit;
            exit;
       end;
       end;
@@ -443,11 +423,11 @@ const
                 {                - directive.                                     }
                 {                - directive.                                     }
                             begin
                             begin
                              actasmpattern := c;
                              actasmpattern := c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','$'] do
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','$'] do
                              begin
                              begin
                                actasmpattern := actasmpattern + c;
                                actasmpattern := actasmpattern + c;
-                               c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                               c := current_scanner^.asmgetchar;
                              end;
                              end;
                              is_asmdirective(actasmpattern,token);
                              is_asmdirective(actasmpattern,token);
                              { if directive }
                              { if directive }
@@ -464,11 +444,11 @@ const
       { identifier, register, opcode, prefix or directive }
       { identifier, register, opcode, prefix or directive }
          '_','A'..'Z','a'..'z': begin
          '_','A'..'Z','a'..'z': begin
                              actasmpattern := c;
                              actasmpattern := c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','$'] do
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','$'] do
                              begin
                              begin
                                actasmpattern := actasmpattern + c;
                                actasmpattern := actasmpattern + c;
-                               c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                               c := current_scanner^.asmgetchar;
                              end;
                              end;
                              { pascal is not case sensitive!    }
                              { pascal is not case sensitive!    }
                              { therefore variables which are    }
                              { therefore variables which are    }
@@ -503,16 +483,16 @@ const
                              exit;
                              exit;
                           end;
                           end;
            '&':       begin
            '&':       begin
-                         c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                         c:=current_scanner^.asmgetchar;
                          gettoken := AS_AND;
                          gettoken := AS_AND;
                       end;
                       end;
            { character }
            { character }
            '''' :     begin
            '''' :     begin
-                         c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                         c:=current_scanner^.asmgetchar;
                          if c = '\' then
                          if c = '\' then
                          Begin
                          Begin
                            { escape sequence }
                            { escape sequence }
-                           c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                           c:=current_scanner^.asmgetchar;
                            case c of
                            case c of
                          newline: Message(scan_f_string_exceeds_line);
                          newline: Message(scan_f_string_exceeds_line);
                              't': actasmpattern:=#09;
                              't': actasmpattern:=#09;
@@ -526,8 +506,8 @@ const
                              '0'..'7':
                              '0'..'7':
                                 begin
                                 begin
                                    temp:=c;
                                    temp:=c;
-                                   temp:=temp+{$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
-                                   temp:=temp+{$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                   temp:=temp+current_scanner^.asmgetchar;
+                                   temp:=temp+current_scanner^.asmgetchar;
                                    val(octaltodec(temp),value,code);
                                    val(octaltodec(temp),value,code);
                                    if (code <> 0) then
                                    if (code <> 0) then
                                     Message1(assem_e_error_in_octal_const,temp);
                                     Message1(assem_e_error_in_octal_const,temp);
@@ -536,8 +516,8 @@ const
                              { hexadecimal number }
                              { hexadecimal number }
                              'x':
                              'x':
                                  begin
                                  begin
-                                   temp:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
-                                   temp:=temp+{$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                   temp:=current_scanner^.asmgetchar;
+                                   temp:=temp+current_scanner^.asmgetchar;
                                    val(hextodec(temp),value,code);
                                    val(hextodec(temp),value,code);
                                    if (code <> 0) then
                                    if (code <> 0) then
                                     Message1(assem_e_error_in_hex_const,temp);
                                     Message1(assem_e_error_in_hex_const,temp);
@@ -554,7 +534,7 @@ const
                            actasmpattern:=c;
                            actasmpattern:=c;
 
 
                          gettoken := AS_STRING;
                          gettoken := AS_STRING;
-                         c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                         c:=current_scanner^.asmgetchar;
                          exit;
                          exit;
 
 
                       end;
                       end;
@@ -564,11 +544,11 @@ const
                          actasmpattern:='';
                          actasmpattern:='';
                          while true do
                          while true do
                          Begin
                          Begin
-                           c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                           c:=current_scanner^.asmgetchar;
                            case c of
                            case c of
                             '\': Begin
                             '\': Begin
                                   { escape sequences }
                                   { escape sequences }
-                                  c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                  c:=current_scanner^.asmgetchar;
                                   case c of
                                   case c of
                                    newline: Message(scan_f_string_exceeds_line);
                                    newline: Message(scan_f_string_exceeds_line);
                                    't': actasmpattern:=actasmpattern+#09;
                                    't': actasmpattern:=actasmpattern+#09;
@@ -582,8 +562,8 @@ const
                                    '0'..'7':
                                    '0'..'7':
                                       begin
                                       begin
                                            temp:=c;
                                            temp:=c;
-                                           temp:=temp+{$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
-                                           temp:=temp+{$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                           temp:=temp+current_scanner^.asmgetchar;
+                                           temp:=temp+current_scanner^.asmgetchar;
                                            val(octaltodec(temp),value,code);
                                            val(octaltodec(temp),value,code);
                                            if (code <> 0) then
                                            if (code <> 0) then
                                             Message1(assem_e_error_in_octal_const,temp);
                                             Message1(assem_e_error_in_octal_const,temp);
@@ -592,8 +572,8 @@ const
                                    { hexadecimal number }
                                    { hexadecimal number }
                                    'x':
                                    'x':
                                      begin
                                      begin
-                                       temp:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
-                                       temp:=temp+{$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                       temp:=current_scanner^.asmgetchar;
+                                       temp:=temp+current_scanner^.asmgetchar;
                                        val(hextodec(temp),value,code);
                                        val(hextodec(temp),value,code);
                                        if (code <> 0) then
                                        if (code <> 0) then
                                         Message1(assem_e_error_in_hex_const,temp);
                                         Message1(assem_e_error_in_hex_const,temp);
@@ -607,7 +587,7 @@ const
                                    end; { end case }
                                    end; { end case }
                                  end;
                                  end;
                             '"': begin
                             '"': begin
-                                  c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                  c:=current_scanner^.asmgetchar;
                                   break;
                                   break;
                                  end;
                                  end;
                             newline: Message(scan_f_string_exceeds_line);
                             newline: Message(scan_f_string_exceeds_line);
@@ -621,91 +601,91 @@ const
                  end;
                  end;
            '$' :  begin
            '$' :  begin
                    gettoken := AS_DOLLAR;
                    gettoken := AS_DOLLAR;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                   end;
                   end;
            ',' : begin
            ',' : begin
                    gettoken := AS_COMMA;
                    gettoken := AS_COMMA;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '<' : begin
            '<' : begin
                    gettoken := AS_SHL;
                    gettoken := AS_SHL;
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    if c = '<' then
                    if c = '<' then
-                     c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                     c := current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '>' : begin
            '>' : begin
                    gettoken := AS_SHL;
                    gettoken := AS_SHL;
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    if c = '>' then
                    if c = '>' then
-                     c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                     c := current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '|' : begin
            '|' : begin
                    gettoken := AS_OR;
                    gettoken := AS_OR;
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '^' : begin
            '^' : begin
                   gettoken := AS_XOR;
                   gettoken := AS_XOR;
-                  c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                  c := current_scanner^.asmgetchar;
                   exit;
                   exit;
                  end;
                  end;
            '!' : begin
            '!' : begin
                   Message(assem_e_nor_not_supported);
                   Message(assem_e_nor_not_supported);
-                  c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                  c := current_scanner^.asmgetchar;
                   gettoken := AS_NONE;
                   gettoken := AS_NONE;
                   exit;
                   exit;
                  end;
                  end;
            '(' : begin
            '(' : begin
                    gettoken := AS_LPAREN;
                    gettoken := AS_LPAREN;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            ')' : begin
            ')' : begin
                    gettoken := AS_RPAREN;
                    gettoken := AS_RPAREN;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            ':' : begin
            ':' : begin
                    gettoken := AS_COLON;
                    gettoken := AS_COLON;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '+' : begin
            '+' : begin
                    gettoken := AS_PLUS;
                    gettoken := AS_PLUS;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '-' : begin
            '-' : begin
                    gettoken := AS_MINUS;
                    gettoken := AS_MINUS;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '*' : begin
            '*' : begin
                    gettoken := AS_STAR;
                    gettoken := AS_STAR;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '/' : begin
            '/' : begin
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    { att styled comment }
                    { att styled comment }
                    if c='/' then
                    if c='/' then
                      begin
                      begin
                         repeat
                         repeat
-                           c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                           c:=current_scanner^.asmgetchar;
                         until c=newline;
                         until c=newline;
                         firsttoken := TRUE;
                         firsttoken := TRUE;
                         gettoken:=AS_SEPARATOR;
                         gettoken:=AS_SEPARATOR;
-                        c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                        c:=current_scanner^.asmgetchar;
                         exit;
                         exit;
                      end
                      end
                    else
                    else
                      begin
                      begin
                         gettoken := AS_SLASH;
                         gettoken := AS_SLASH;
-                        c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                        c:=current_scanner^.asmgetchar;
                         exit;
                         exit;
                      end;
                      end;
                  end;
                  end;
@@ -714,29 +694,29 @@ const
            { for the moment.         }
            { for the moment.         }
            '%' : begin
            '%' : begin
                      actasmpattern := c;
                      actasmpattern := c;
-                     c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                     c:=current_scanner^.asmgetchar;
                      while c in ['a'..'z','A'..'Z','0'..'9'] do
                      while c in ['a'..'z','A'..'Z','0'..'9'] do
                      Begin
                      Begin
                         actasmpattern := actasmpattern + c;
                         actasmpattern := actasmpattern + c;
-                        c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                        c:=current_scanner^.asmgetchar;
                      end;
                      end;
                      token := AS_NONE;
                      token := AS_NONE;
                      uppervar(actasmpattern);
                      uppervar(actasmpattern);
                      if (actasmpattern = '%ST') and (c='(') then
                      if (actasmpattern = '%ST') and (c='(') then
                      Begin
                      Begin
                         actasmpattern:=actasmpattern+c;
                         actasmpattern:=actasmpattern+c;
-                        c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                        c:=current_scanner^.asmgetchar;
                         if c in ['0'..'9'] then
                         if c in ['0'..'9'] then
                           actasmpattern := actasmpattern + c
                           actasmpattern := actasmpattern + c
                         else
                         else
                           Message(assem_e_invalid_fpu_register);
                           Message(assem_e_invalid_fpu_register);
-                        c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                        c:=current_scanner^.asmgetchar;
                         if c <> ')' then
                         if c <> ')' then
                           Message(assem_e_invalid_fpu_register)
                           Message(assem_e_invalid_fpu_register)
                         else
                         else
                         Begin
                         Begin
                           actasmpattern := actasmpattern + c;
                           actasmpattern := actasmpattern + c;
-                          c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar; { let us point to next character. }
+                          c:=current_scanner^.asmgetchar; { let us point to next character. }
                         end;
                         end;
                      end;
                      end;
                      is_register(actasmpattern, token);
                      is_register(actasmpattern, token);
@@ -752,11 +732,11 @@ const
            { integer number }
            { integer number }
            '1'..'9': begin
            '1'..'9': begin
                         actasmpattern := c;
                         actasmpattern := c;
-                        c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                        c := current_scanner^.asmgetchar;
                         while c in ['0'..'9'] do
                         while c in ['0'..'9'] do
                           Begin
                           Begin
                              actasmpattern := actasmpattern + c;
                              actasmpattern := actasmpattern + c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                           end;
                           end;
                         gettoken := AS_INTNUM;
                         gettoken := AS_INTNUM;
                         exit;
                         exit;
@@ -764,57 +744,57 @@ const
            '0': begin
            '0': begin
                 { octal,hexa,real or binary number. }
                 { octal,hexa,real or binary number. }
                  actasmpattern := c;
                  actasmpattern := c;
-                 c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                 c:=current_scanner^.asmgetchar;
                  case upcase(c) of
                  case upcase(c) of
                    { binary }
                    { binary }
                    'B': Begin
                    'B': Begin
-                          c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                          c:=current_scanner^.asmgetchar;
                           while c in ['0','1'] do
                           while c in ['0','1'] do
                           Begin
                           Begin
                             actasmpattern := actasmpattern + c;
                             actasmpattern := actasmpattern + c;
-                            c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                            c := current_scanner^.asmgetchar;
                           end;
                           end;
                           gettoken := AS_BINNUM;
                           gettoken := AS_BINNUM;
                           exit;
                           exit;
                         end;
                         end;
                    { real }
                    { real }
                    'D': Begin
                    'D': Begin
-                          c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                          c:=current_scanner^.asmgetchar;
                           { get ridd of the 0d }
                           { get ridd of the 0d }
                           if (c='+') or (c='-') then
                           if (c='+') or (c='-') then
                             begin
                             begin
                                actasmpattern:=c;
                                actasmpattern:=c;
-                               c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                               c:=current_scanner^.asmgetchar;
                             end
                             end
                           else
                           else
                             actasmpattern:='';
                             actasmpattern:='';
                         while c in ['0'..'9'] do
                         while c in ['0'..'9'] do
                           Begin
                           Begin
                              actasmpattern := actasmpattern + c;
                              actasmpattern := actasmpattern + c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                           end;
                           end;
                         if c='.' then
                         if c='.' then
                           begin
                           begin
                              actasmpattern := actasmpattern + c;
                              actasmpattern := actasmpattern + c;
-                             c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:=current_scanner^.asmgetchar;
                              while c in ['0'..'9'] do
                              while c in ['0'..'9'] do
                                Begin
                                Begin
                                   actasmpattern := actasmpattern + c;
                                   actasmpattern := actasmpattern + c;
-                                  c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                  c:= current_scanner^.asmgetchar;
                                end;
                                end;
                              if upcase(c) = 'E' then
                              if upcase(c) = 'E' then
                                begin
                                begin
                                   actasmpattern := actasmpattern + c;
                                   actasmpattern := actasmpattern + c;
-                                  c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                  c:=current_scanner^.asmgetchar;
                                   if (c = '+') or (c = '-') then
                                   if (c = '+') or (c = '-') then
                                     begin
                                     begin
                                        actasmpattern := actasmpattern + c;
                                        actasmpattern := actasmpattern + c;
-                                       c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                       c:=current_scanner^.asmgetchar;
                                     end;
                                     end;
                                   while c in ['0'..'9'] do
                                   while c in ['0'..'9'] do
                                     Begin
                                     Begin
                                        actasmpattern := actasmpattern + c;
                                        actasmpattern := actasmpattern + c;
-                                       c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                       c:= current_scanner^.asmgetchar;
                                     end;
                                     end;
                                end;
                                end;
                              gettoken := AS_REALNUM;
                              gettoken := AS_REALNUM;
@@ -825,11 +805,11 @@ const
                         end;
                         end;
                    { hexadecimal }
                    { hexadecimal }
                    'X': Begin
                    'X': Begin
-                          c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                          c:=current_scanner^.asmgetchar;
                           while c in ['0'..'9','a'..'f','A'..'F'] do
                           while c in ['0'..'9','a'..'f','A'..'F'] do
                           Begin
                           Begin
                             actasmpattern := actasmpattern + c;
                             actasmpattern := actasmpattern + c;
-                            c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                            c := current_scanner^.asmgetchar;
                           end;
                           end;
                           gettoken := AS_HEXNUM;
                           gettoken := AS_HEXNUM;
                           exit;
                           exit;
@@ -840,7 +820,7 @@ const
                                while c in ['0'..'7'] do
                                while c in ['0'..'7'] do
                                Begin
                                Begin
                                  actasmpattern := actasmpattern + c;
                                  actasmpattern := actasmpattern + c;
-                                 c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                 c := current_scanner^.asmgetchar;
                                end;
                                end;
                                gettoken := AS_OCTALNUM;
                                gettoken := AS_OCTALNUM;
                                exit;
                                exit;
@@ -854,7 +834,7 @@ const
                 end;
                 end;
     '{',#13,newline,';' : begin
     '{',#13,newline,';' : begin
                             { the comment is read by asmgetchar }
                             { the comment is read by asmgetchar }
-                            c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                            c:=current_scanner^.asmgetchar;
                             firsttoken := TRUE;
                             firsttoken := TRUE;
                             gettoken:=AS_SEPARATOR;
                             gettoken:=AS_SEPARATOR;
                            end;
                            end;
@@ -3419,7 +3399,7 @@ const
     store_p:=p;
     store_p:=p;
     { setup label linked list }
     { setup label linked list }
     labellist.init;
     labellist.init;
-    c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+    c:=current_scanner^.asmgetchar;
     actasmtoken:=gettoken;
     actasmtoken:=gettoken;
     while actasmtoken<>AS_END do
     while actasmtoken<>AS_END do
     Begin
     Begin
@@ -3695,7 +3675,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  1998-07-08 15:06:41  daniel
+  Revision 1.5  1998-07-14 14:46:58  peter
+    * released NEWINPUT
+
+  Revision 1.4  1998/07/08 15:06:41  daniel
   + $N+,E+ added for TP.
   + $N+,E+ added for TP.
 
 
   Revision 1.3  1998/07/07 11:20:07  peter
   Revision 1.3  1998/07/07 11:20:07  peter

+ 9 - 6
compiler/ra386dir.pas

@@ -73,11 +73,11 @@ unit Ra386dir;
          retstr:=upper(tostr(procinfo.retoffset)+'('+att_reg2str[procinfo.framepointer]+')')
          retstr:=upper(tostr(procinfo.retoffset)+'('+att_reg2str[procinfo.framepointer]+')')
        else
        else
          retstr:='';
          retstr:='';
-         c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+         c:=current_scanner^.asmgetchar;
          code:=new(paasmoutput,init);
          code:=new(paasmoutput,init);
          while not(ende) do
          while not(ende) do
            begin
            begin
-              {$ifdef NEWINPUT}current_scanner^.{$endif}gettokenpos;
+              current_scanner^.gettokenpos;
               case c of
               case c of
                  'A'..'Z','a'..'z','_' : begin
                  'A'..'Z','a'..'z','_' : begin
                       hs:='';
                       hs:='';
@@ -88,7 +88,7 @@ unit Ra386dir;
                         begin
                         begin
                            inc(byte(hs[0]));
                            inc(byte(hs[0]));
                            hs[length(hs)]:=c;
                            hs[length(hs)]:=c;
-                           c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                           c:=current_scanner^.asmgetchar;
                         end;
                         end;
                       if upper(hs)='END' then
                       if upper(hs)='END' then
                          ende:=true
                          ende:=true
@@ -219,14 +219,14 @@ unit Ra386dir;
                       if pos(retstr,s) > 0 then
                       if pos(retstr,s) > 0 then
                         procinfo.funcret_is_valid:=true;
                         procinfo.funcret_is_valid:=true;
                      writeasmline;
                      writeasmline;
-                     c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                     c:=current_scanner^.asmgetchar;
                    end;
                    end;
              #26 : Message(scan_f_end_of_file);
              #26 : Message(scan_f_end_of_file);
              else
              else
                begin
                begin
                  inc(byte(s[0]));
                  inc(byte(s[0]));
                  s[length(s)]:=c;
                  s[length(s)]:=c;
-                 c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                 c:=current_scanner^.asmgetchar;
                end;
                end;
            end;
            end;
          end;
          end;
@@ -237,7 +237,10 @@ unit Ra386dir;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-07-07 11:20:08  peter
+  Revision 1.4  1998-07-14 14:46:59  peter
+    * released NEWINPUT
+
+  Revision 1.3  1998/07/07 11:20:08  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.2  1998/06/24 14:06:37  peter
   Revision 1.2  1998/06/24 14:06:37  peter

+ 41 - 38
compiler/ra386int.pas

@@ -332,10 +332,10 @@ var
     token := AS_NONE;
     token := AS_NONE;
     { while space and tab , continue scan... }
     { while space and tab , continue scan... }
     while (c in [' ',#9]) do
     while (c in [' ',#9]) do
-      c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+      c := current_scanner^.asmgetchar;
     { Possiblities for first token in a statement:                }
     { Possiblities for first token in a statement:                }
     {   Local Label, Label, Directive, Prefix or Opcode....       }
     {   Local Label, Label, Directive, Prefix or Opcode....       }
-    {$ifdef NEWINPUT}current_scanner^.{$endif}gettokenpos;
+    current_scanner^.gettokenpos;
     if firsttoken and not (c in [newline,#13,'{',';']) then
     if firsttoken and not (c in [newline,#13,'{',';']) then
     begin
     begin
       firsttoken := FALSE;
       firsttoken := FALSE;
@@ -343,7 +343,7 @@ var
       begin
       begin
         token := AS_LLABEL;   { this is a local label }
         token := AS_LLABEL;   { this is a local label }
         { Let us point to the next character }
         { Let us point to the next character }
-        c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+        c := current_scanner^.asmgetchar;
       end;
       end;
 
 
 
 
@@ -353,7 +353,7 @@ var
          { if there is an at_sign, then this must absolutely be a label }
          { if there is an at_sign, then this must absolutely be a label }
          if c = '@' then forcelabel:=TRUE;
          if c = '@' then forcelabel:=TRUE;
          actasmpattern := actasmpattern + c;
          actasmpattern := actasmpattern + c;
-         c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+         c := current_scanner^.asmgetchar;
       end;
       end;
 
 
       uppervar(actasmpattern);
       uppervar(actasmpattern);
@@ -365,7 +365,7 @@ var
              AS_LLABEL: ; { do nothing }
              AS_LLABEL: ; { do nothing }
            end; { end case }
            end; { end case }
            { let us point to the next character }
            { let us point to the next character }
-           c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+           c := current_scanner^.asmgetchar;
            gettoken := token;
            gettoken := token;
            exit;
            exit;
       end;
       end;
@@ -404,11 +404,11 @@ var
                 {                - @Result, @Code or @Data special variables.     }
                 {                - @Result, @Code or @Data special variables.     }
                             begin
                             begin
                              actasmpattern := c;
                              actasmpattern := c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','@'] do
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','@'] do
                              begin
                              begin
                                actasmpattern := actasmpattern + c;
                                actasmpattern := actasmpattern + c;
-                               c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                               c := current_scanner^.asmgetchar;
                              end;
                              end;
                              uppervar(actasmpattern);
                              uppervar(actasmpattern);
                              gettoken := AS_ID;
                              gettoken := AS_ID;
@@ -417,11 +417,11 @@ var
       { identifier, register, opcode, prefix or directive }
       { identifier, register, opcode, prefix or directive }
          'A'..'Z','a'..'z','_': begin
          'A'..'Z','a'..'z','_': begin
                              actasmpattern := c;
                              actasmpattern := c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                              while c in  ['A'..'Z','a'..'z','0'..'9','_'] do
                              while c in  ['A'..'Z','a'..'z','0'..'9','_'] do
                              begin
                              begin
                                actasmpattern := actasmpattern + c;
                                actasmpattern := actasmpattern + c;
-                               c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                               c := current_scanner^.asmgetchar;
                              end;
                              end;
                              uppervar(actasmpattern);
                              uppervar(actasmpattern);
 
 
@@ -452,7 +452,7 @@ var
            { override operator... not supported }
            { override operator... not supported }
            '&':       begin
            '&':       begin
                          Message(assem_w_override_op_not_supported);
                          Message(assem_w_override_op_not_supported);
-                         c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                         c:=current_scanner^.asmgetchar;
                          gettoken := AS_NONE;
                          gettoken := AS_NONE;
                       end;
                       end;
            { string or character }
            { string or character }
@@ -463,7 +463,7 @@ var
                          begin
                          begin
                            if c = '''' then
                            if c = '''' then
                            begin
                            begin
-                              c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                              c:=current_scanner^.asmgetchar;
                               if c=newline then
                               if c=newline then
                               begin
                               begin
                                  Message(scan_f_string_exceeds_line);
                                  Message(scan_f_string_exceeds_line);
@@ -472,11 +472,11 @@ var
                               repeat
                               repeat
                                   if c=''''then
                                   if c=''''then
                                    begin
                                    begin
-                                       c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                       c:=current_scanner^.asmgetchar;
                                        if c='''' then
                                        if c='''' then
                                         begin
                                         begin
                                                actasmpattern:=actasmpattern+'''';
                                                actasmpattern:=actasmpattern+'''';
-                                               c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                               c:=current_scanner^.asmgetchar;
                                                if c=newline then
                                                if c=newline then
                                                begin
                                                begin
                                                     Message(scan_f_string_exceeds_line);
                                                     Message(scan_f_string_exceeds_line);
@@ -488,7 +488,7 @@ var
                                    else
                                    else
                                    begin
                                    begin
                                           actasmpattern:=actasmpattern+c;
                                           actasmpattern:=actasmpattern+c;
-                                          c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                          c:=current_scanner^.asmgetchar;
                                           if c=newline then
                                           if c=newline then
                                             begin
                                             begin
                                                Message(scan_f_string_exceeds_line);
                                                Message(scan_f_string_exceeds_line);
@@ -511,7 +511,7 @@ var
                          begin
                          begin
                            if c = '"' then
                            if c = '"' then
                            begin
                            begin
-                              c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                              c:=current_scanner^.asmgetchar;
                               if c=newline then
                               if c=newline then
                               begin
                               begin
                                  Message(scan_f_string_exceeds_line);
                                  Message(scan_f_string_exceeds_line);
@@ -520,11 +520,11 @@ var
                               repeat
                               repeat
                                   if c='"'then
                                   if c='"'then
                                    begin
                                    begin
-                                       c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                       c:=current_scanner^.asmgetchar;
                                        if c='"' then
                                        if c='"' then
                                         begin
                                         begin
                                                actasmpattern:=actasmpattern+'"';
                                                actasmpattern:=actasmpattern+'"';
-                                               c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                               c:=current_scanner^.asmgetchar;
                                                if c=newline then
                                                if c=newline then
                                                begin
                                                begin
                                                   Message(scan_f_string_exceeds_line);
                                                   Message(scan_f_string_exceeds_line);
@@ -537,7 +537,7 @@ var
                                   else
                                   else
                                    begin
                                    begin
                                           actasmpattern:=actasmpattern+c;
                                           actasmpattern:=actasmpattern+c;
-                                          c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                          c:=current_scanner^.asmgetchar;
                                           if c=newline then
                                           if c=newline then
                                             begin
                                             begin
                                                Message(scan_f_string_exceeds_line);
                                                Message(scan_f_string_exceeds_line);
@@ -553,68 +553,68 @@ var
                    exit;
                    exit;
                  end;
                  end;
            '$' :  begin
            '$' :  begin
-                    c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                    c:=current_scanner^.asmgetchar;
                     while c in ['0'..'9','A'..'F','a'..'f'] do
                     while c in ['0'..'9','A'..'F','a'..'f'] do
                     begin
                     begin
                       actasmpattern := actasmpattern + c;
                       actasmpattern := actasmpattern + c;
-                      c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                      c := current_scanner^.asmgetchar;
                     end;
                     end;
                    gettoken := AS_HEXNUM;
                    gettoken := AS_HEXNUM;
                    exit;
                    exit;
                   end;
                   end;
            ',' : begin
            ',' : begin
                    gettoken := AS_COMMA;
                    gettoken := AS_COMMA;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '[' : begin
            '[' : begin
                    gettoken := AS_LBRACKET;
                    gettoken := AS_LBRACKET;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            ']' : begin
            ']' : begin
                    gettoken := AS_RBRACKET;
                    gettoken := AS_RBRACKET;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '(' : begin
            '(' : begin
                    gettoken := AS_LPAREN;
                    gettoken := AS_LPAREN;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            ')' : begin
            ')' : begin
                    gettoken := AS_RPAREN;
                    gettoken := AS_RPAREN;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            ':' : begin
            ':' : begin
                    gettoken := AS_COLON;
                    gettoken := AS_COLON;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '.' : begin
            '.' : begin
                    gettoken := AS_DOT;
                    gettoken := AS_DOT;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '+' : begin
            '+' : begin
                    gettoken := AS_PLUS;
                    gettoken := AS_PLUS;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '-' : begin
            '-' : begin
                    gettoken := AS_MINUS;
                    gettoken := AS_MINUS;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '*' : begin
            '*' : begin
                    gettoken := AS_STAR;
                    gettoken := AS_STAR;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '/' : begin
            '/' : begin
                    gettoken := AS_SLASH;
                    gettoken := AS_SLASH;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '0'..'9': begin
            '0'..'9': begin
@@ -622,12 +622,12 @@ var
                           { if so, then we use a default value instead.}
                           { if so, then we use a default value instead.}
                           errorflag := false;
                           errorflag := false;
                           actasmpattern := c;
                           actasmpattern := c;
-                          c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                          c := current_scanner^.asmgetchar;
                           { Get the possible characters }
                           { Get the possible characters }
                           while c in ['0'..'9','A'..'F','a'..'f'] do
                           while c in ['0'..'9','A'..'F','a'..'f'] do
                           begin
                           begin
                             actasmpattern := actasmpattern + c;
                             actasmpattern := actasmpattern + c;
-                            c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                            c:= current_scanner^.asmgetchar;
                           end;
                           end;
                           { Get ending character }
                           { Get ending character }
                           uppervar(actasmpattern);
                           uppervar(actasmpattern);
@@ -663,7 +663,7 @@ var
                                      if errorflag then
                                      if errorflag then
                                         actasmpattern := '0';
                                         actasmpattern := '0';
                                       gettoken := AS_OCTALNUM;
                                       gettoken := AS_OCTALNUM;
-                                      c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                      c := current_scanner^.asmgetchar;
                                       exit;
                                       exit;
                                     end;
                                     end;
                               'H': Begin
                               'H': Begin
@@ -677,7 +677,7 @@ var
                                      if errorflag then
                                      if errorflag then
                                         actasmpattern := '0';
                                         actasmpattern := '0';
                                      gettoken := AS_HEXNUM;
                                      gettoken := AS_HEXNUM;
-                                     c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                     c := current_scanner^.asmgetchar;
                                      exit;
                                      exit;
                                    end;
                                    end;
                               else { must be an integer number }
                               else { must be an integer number }
@@ -698,7 +698,7 @@ var
                       end; { end if }
                       end; { end if }
                      end;
                      end;
     ';','{',#13,newline : begin
     ';','{',#13,newline : begin
-                            c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                            c:=current_scanner^.asmgetchar;
                             firsttoken := TRUE;
                             firsttoken := TRUE;
                             gettoken:=AS_SEPARATOR;
                             gettoken:=AS_SEPARATOR;
                            end;
                            end;
@@ -3253,7 +3253,7 @@ var
     p:=new(paasmoutput,init);
     p:=new(paasmoutput,init);
     { setup label linked list }
     { setup label linked list }
     labellist.init;
     labellist.init;
-    c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+    c:=current_scanner^.asmgetchar;
     actasmtoken:=gettoken;
     actasmtoken:=gettoken;
     while actasmtoken<>AS_END do
     while actasmtoken<>AS_END do
     Begin
     Begin
@@ -3368,7 +3368,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-07-07 11:20:09  peter
+  Revision 1.4  1998-07-14 14:47:00  peter
+    * released NEWINPUT
+
+  Revision 1.3  1998/07/07 11:20:09  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.2  1998/06/24 14:06:38  peter
   Revision 1.2  1998/06/24 14:06:38  peter

+ 43 - 40
compiler/ra68kmot.pas

@@ -237,8 +237,8 @@ var
     token := AS_NONE;
     token := AS_NONE;
     { while space and tab , continue scan... }
     { while space and tab , continue scan... }
     while c in [' ',#9] do
     while c in [' ',#9] do
-     c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
-    {$ifdef NEWINPUT}current_scanner^.{$endif}gettokenpos;
+     c:=current_scanner^.asmgetchar;
+    current_scanner^.gettokenpos;
     { Possiblities for first token in a statement:                }
     { Possiblities for first token in a statement:                }
     {   Local Label, Label, Directive, Prefix or Opcode....       }
     {   Local Label, Label, Directive, Prefix or Opcode....       }
     if firsttoken and not (c in [newline,#13,'{',';']) then
     if firsttoken and not (c in [newline,#13,'{',';']) then
@@ -249,7 +249,7 @@ var
       begin
       begin
         token := AS_LLABEL;   { this is a local label }
         token := AS_LLABEL;   { this is a local label }
         { Let us point to the next character }
         { Let us point to the next character }
-        c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+        c := current_scanner^.asmgetchar;
       end;
       end;
 
 
 
 
@@ -259,7 +259,7 @@ var
          { if there is an at_sign, then this must absolutely be a label }
          { if there is an at_sign, then this must absolutely be a label }
          if c = '@' then forcelabel:=TRUE;
          if c = '@' then forcelabel:=TRUE;
          actasmpattern := actasmpattern + c;
          actasmpattern := actasmpattern + c;
-         c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+         c := current_scanner^.asmgetchar;
       end;
       end;
 
 
       uppervar(actasmpattern);
       uppervar(actasmpattern);
@@ -271,7 +271,7 @@ var
              AS_LLABEL: ; { do nothing }
              AS_LLABEL: ; { do nothing }
            end; { end case }
            end; { end case }
            { let us point to the next character }
            { let us point to the next character }
-           c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+           c := current_scanner^.asmgetchar;
            gettoken := token;
            gettoken := token;
            exit;
            exit;
       end;
       end;
@@ -307,11 +307,11 @@ var
                 {                - @Result, @Code or @Data special variables.     }
                 {                - @Result, @Code or @Data special variables.     }
                             begin
                             begin
                              actasmpattern := c;
                              actasmpattern := c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','@','.'] do
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','@','.'] do
                              begin
                              begin
                                actasmpattern := actasmpattern + c;
                                actasmpattern := actasmpattern + c;
-                               c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                               c := current_scanner^.asmgetchar;
                              end;
                              end;
                              uppervar(actasmpattern);
                              uppervar(actasmpattern);
                              gettoken := AS_ID;
                              gettoken := AS_ID;
@@ -320,11 +320,11 @@ var
       { identifier, register, opcode, prefix or directive }
       { identifier, register, opcode, prefix or directive }
          'A'..'Z','a'..'z','_': begin
          'A'..'Z','a'..'z','_': begin
                              actasmpattern := c;
                              actasmpattern := c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','.'] do
                              while c in  ['A'..'Z','a'..'z','0'..'9','_','.'] do
                              begin
                              begin
                                actasmpattern := actasmpattern + c;
                                actasmpattern := actasmpattern + c;
-                               c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                               c := current_scanner^.asmgetchar;
                              end;
                              end;
                              uppervar(actasmpattern);
                              uppervar(actasmpattern);
 
 
@@ -350,7 +350,7 @@ var
                           end;
                           end;
            { override operator... not supported }
            { override operator... not supported }
            '&':       begin
            '&':       begin
-                         c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                         c:=current_scanner^.asmgetchar;
                          gettoken := AS_AND;
                          gettoken := AS_AND;
                       end;
                       end;
            { string or character }
            { string or character }
@@ -361,7 +361,7 @@ var
                          begin
                          begin
                            if c = '''' then
                            if c = '''' then
                            begin
                            begin
-                              c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                              c:=current_scanner^.asmgetchar;
                               if c=newline then
                               if c=newline then
                               begin
                               begin
                                  Message(scan_f_string_exceeds_line);
                                  Message(scan_f_string_exceeds_line);
@@ -370,11 +370,11 @@ var
                               repeat
                               repeat
                                   if c=''''then
                                   if c=''''then
                                    begin
                                    begin
-                                       c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                       c:=current_scanner^.asmgetchar;
                                        if c='''' then
                                        if c='''' then
                                         begin
                                         begin
                                                actasmpattern:=actasmpattern+'''';
                                                actasmpattern:=actasmpattern+'''';
-                                               c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                               c:=current_scanner^.asmgetchar;
                                                if c=newline then
                                                if c=newline then
                                                begin
                                                begin
                                                     Message(scan_f_string_exceeds_line);
                                                     Message(scan_f_string_exceeds_line);
@@ -386,7 +386,7 @@ var
                                    else
                                    else
                                    begin
                                    begin
                                           actasmpattern:=actasmpattern+c;
                                           actasmpattern:=actasmpattern+c;
-                                          c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                                          c:=current_scanner^.asmgetchar;
                                           if c=newline then
                                           if c=newline then
                                             begin
                                             begin
                                                Message(scan_f_string_exceeds_line);
                                                Message(scan_f_string_exceeds_line);
@@ -402,101 +402,101 @@ var
                    exit;
                    exit;
                  end;
                  end;
            '$' :  begin
            '$' :  begin
-                    c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                    c:=current_scanner^.asmgetchar;
                     while c in ['0'..'9','A'..'F','a'..'f'] do
                     while c in ['0'..'9','A'..'F','a'..'f'] do
                     begin
                     begin
                       actasmpattern := actasmpattern + c;
                       actasmpattern := actasmpattern + c;
-                      c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                      c := current_scanner^.asmgetchar;
                     end;
                     end;
                    gettoken := AS_HEXNUM;
                    gettoken := AS_HEXNUM;
                    exit;
                    exit;
                   end;
                   end;
            ',' : begin
            ',' : begin
                    gettoken := AS_COMMA;
                    gettoken := AS_COMMA;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '(' : begin
            '(' : begin
                    gettoken := AS_LPAREN;
                    gettoken := AS_LPAREN;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            ')' : begin
            ')' : begin
                    gettoken := AS_RPAREN;
                    gettoken := AS_RPAREN;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            ':' : begin
            ':' : begin
                    gettoken := AS_COLON;
                    gettoken := AS_COLON;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
 {           '.' : begin
 {           '.' : begin
                    gettoken := AS_DOT;
                    gettoken := AS_DOT;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end; }
                  end; }
            '+' : begin
            '+' : begin
                    gettoken := AS_PLUS;
                    gettoken := AS_PLUS;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '-' : begin
            '-' : begin
                    gettoken := AS_MINUS;
                    gettoken := AS_MINUS;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '*' : begin
            '*' : begin
                    gettoken := AS_STAR;
                    gettoken := AS_STAR;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '/' : begin
            '/' : begin
                    gettoken := AS_SLASH;
                    gettoken := AS_SLASH;
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '<' : begin
            '<' : begin
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    { invalid characters }
                    { invalid characters }
                    if c <> '<' then
                    if c <> '<' then
                     Message(assem_e_invalid_char_smaller);
                     Message(assem_e_invalid_char_smaller);
                    { still assume << }
                    { still assume << }
                    gettoken := AS_SHL;
                    gettoken := AS_SHL;
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '>' : begin
            '>' : begin
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    { invalid characters }
                    { invalid characters }
                    if c <> '>' then
                    if c <> '>' then
                     Message(assem_e_invalid_char_greater);
                     Message(assem_e_invalid_char_greater);
                    { still assume << }
                    { still assume << }
                    gettoken := AS_SHR;
                    gettoken := AS_SHR;
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '|' : begin
            '|' : begin
                    gettoken := AS_OR;
                    gettoken := AS_OR;
-                   c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c := current_scanner^.asmgetchar;
                    exit;
                    exit;
                  end;
                  end;
            '^' : begin
            '^' : begin
                   gettoken := AS_XOR;
                   gettoken := AS_XOR;
-                  c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                  c := current_scanner^.asmgetchar;
                   exit;
                   exit;
                  end;
                  end;
            '#' : begin
            '#' : begin
                   gettoken:=AS_APPT;
                   gettoken:=AS_APPT;
-                  c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                  c:=current_scanner^.asmgetchar;
                   exit;
                   exit;
                  end;
                  end;
            '%' : begin
            '%' : begin
-                   c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                   c:=current_scanner^.asmgetchar;
                    while c in ['0','1'] do
                    while c in ['0','1'] do
                    Begin
                    Begin
                      actasmpattern := actasmpattern + c;
                      actasmpattern := actasmpattern + c;
-                     c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                     c := current_scanner^.asmgetchar;
                    end;
                    end;
                    gettoken := AS_BINNUM;
                    gettoken := AS_BINNUM;
                    exit;
                    exit;
@@ -504,25 +504,25 @@ var
            { integer number }
            { integer number }
            '0'..'9': begin
            '0'..'9': begin
                         actasmpattern := c;
                         actasmpattern := c;
-                        c := {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                        c := current_scanner^.asmgetchar;
                         while c in ['0'..'9'] do
                         while c in ['0'..'9'] do
                           Begin
                           Begin
                              actasmpattern := actasmpattern + c;
                              actasmpattern := actasmpattern + c;
-                             c:= {$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                             c:= current_scanner^.asmgetchar;
                           end;
                           end;
                         gettoken := AS_INTNUM;
                         gettoken := AS_INTNUM;
                         exit;
                         exit;
                      end;
                      end;
          ';' : begin
          ';' : begin
                   repeat
                   repeat
-                     c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                     c:=current_scanner^.asmgetchar;
                   until c=newline;
                   until c=newline;
                   firsttoken := TRUE;
                   firsttoken := TRUE;
                   gettoken:=AS_SEPARATOR;
                   gettoken:=AS_SEPARATOR;
                end;
                end;
 
 
          '{',#13,newline : begin
          '{',#13,newline : begin
-                            c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+                            c:=current_scanner^.asmgetchar;
                             firsttoken := TRUE;
                             firsttoken := TRUE;
                             gettoken:=AS_SEPARATOR;
                             gettoken:=AS_SEPARATOR;
                            end;
                            end;
@@ -2033,7 +2033,7 @@ var
     store_p:=p;
     store_p:=p;
     { setup label linked list }
     { setup label linked list }
     labellist.init;
     labellist.init;
-    c:={$ifdef NEWINPUT}current_scanner^.{$endif}asmgetchar;
+    c:=current_scanner^.asmgetchar;
     actasmtoken:=gettoken;
     actasmtoken:=gettoken;
     while actasmtoken<>AS_END do
     while actasmtoken<>AS_END do
     Begin
     Begin
@@ -2177,7 +2177,10 @@ Begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-07-10 10:51:02  peter
+  Revision 1.4  1998-07-14 14:47:02  peter
+    * released NEWINPUT
+
+  Revision 1.3  1998/07/10 10:51:02  peter
     * m68k updates
     * m68k updates
 
 
   Revision 1.2  1998/06/24 14:06:39  peter
   Revision 1.2  1998/06/24 14:06:39  peter

+ 39 - 179
compiler/scandir.inc

@@ -86,83 +86,11 @@ const
       preprocpat    : string;
       preprocpat    : string;
       preproc_token : ttoken;
       preproc_token : ttoken;
 
 
-{$ifndef NEWINPUT}
-    function readpreproc:ttoken;
-      begin
-         skipspace;
-         case c of
-        'A'..'Z',
-        'a'..'z',
-    '_','0'..'9' : begin
-                     preprocpat:=readid;
-                     readpreproc:=ID;
-                   end;
-             '(' : begin
-                     readchar;
-                     readpreproc:=LKLAMMER;
-                   end;
-             ')' : begin
-                     readchar;
-                     readpreproc:=RKLAMMER;
-                   end;
-             '+' : begin
-                     readchar;
-                     readpreproc:=PLUS;
-                   end;
-             '-' : begin
-                     readchar;
-                     readpreproc:=MINUS;
-                   end;
-             '*' : begin
-                     readchar;
-                     readpreproc:=STAR;
-                   end;
-             '/' : begin
-                     readchar;
-                     readpreproc:=SLASH;
-                   end;
-             '=' : begin
-                     readchar;
-                     readpreproc:=EQUAL;
-                   end;
-             '>' : begin
-                     readchar;
-                     if c='=' then
-                      begin
-                        readchar;
-                        readpreproc:=GTE;
-                      end
-                     else
-                      readpreproc:=GT;
-                   end;
-             '<' : begin
-                     readchar;
-                     case c of
-                      '>' : begin
-                              readchar;
-                              readpreproc:=UNEQUAL;
-                            end;
-                      '=' : begin
-                              readchar;
-                              readpreproc:=LTE;
-                            end;
-                     else   readpreproc:=LT;
-                     end;
-                   end;
-             #26 : Message(scan_f_end_of_file);
-         else
-          begin
-            readpreproc:=_EOF;
-          end;
-         end;
-      end;
-{$endif}
-
     procedure preproc_consume(t : ttoken);
     procedure preproc_consume(t : ttoken);
       begin
       begin
         if t<>preproc_token then
         if t<>preproc_token then
          Message(scan_e_preproc_syntax_error);
          Message(scan_e_preproc_syntax_error);
-        preproc_token:={$ifdef NEWINPUT}current_scanner^.{$endif}readpreproc;
+        preproc_token:=current_scanner^.readpreproc;
       end;
       end;
 
 
     function read_expr : string;forward;
     function read_expr : string;forward;
@@ -352,26 +280,18 @@ const
          begin
          begin
            case t of
            case t of
    _DIR_ENDIF : begin
    _DIR_ENDIF : begin
-                  {$ifdef NEWINPUT}current_scanner^.{$endif}poppreprocstack;
+                  current_scanner^.poppreprocstack;
                 end;
                 end;
     _DIR_ELSE : begin
     _DIR_ELSE : begin
-                  {$ifdef NEWINPUT}current_scanner^.{$endif}elsepreprocstack;
+                  current_scanner^.elsepreprocstack;
                 end;
                 end;
    _DIR_IFDEF : begin
    _DIR_IFDEF : begin
-{$ifdef NEWINPUT}
                   current_scanner^.skipspace;
                   current_scanner^.skipspace;
                   hs:=current_scanner^.readid;
                   hs:=current_scanner^.readid;
                   mac:=pmacrosym(macros^.search(hs));
                   mac:=pmacrosym(macros^.search(hs));
                   current_scanner^.addpreprocstack(assigned(mac) and mac^.defined,hs,scan_c_ifdef_found);
                   current_scanner^.addpreprocstack(assigned(mac) and mac^.defined,hs,scan_c_ifdef_found);
-{$else}
-                  skipspace;
-                  hs:=readid;
-                  mac:=pmacrosym(macros^.search(hs));
-                  addpreprocstack(assigned(mac) and mac^.defined,hs,scan_c_ifdef_found);
-{$endif}
                 end;
                 end;
    _DIR_IFOPT : begin
    _DIR_IFOPT : begin
-{$ifdef NEWINPUT}
                   current_scanner^.skipspace;
                   current_scanner^.skipspace;
                   hs:=current_scanner^.readid;
                   hs:=current_scanner^.readid;
                   if (length(hs)=1) and (c in ['-','+']) then
                   if (length(hs)=1) and (c in ['-','+']) then
@@ -382,50 +302,22 @@ const
                   else
                   else
                    Message(scan_w_illegal_switch);
                    Message(scan_w_illegal_switch);
                   current_scanner^.addpreprocstack(found,hs,scan_c_ifopt_found);
                   current_scanner^.addpreprocstack(found,hs,scan_c_ifopt_found);
-{$else}
-                  skipspace;
-                  hs:=readid;
-                  if (length(hs)=1) and (c in ['-','+']) then
-                   begin
-                     found:=CheckSwitch(hs[1],c);
-                     readchar; {read + or -}
-                   end
-                  else
-                   Message(scan_w_illegal_switch);
-                  addpreprocstack(found,hs,scan_c_ifopt_found);
-{$endif}
                 end;
                 end;
       _DIR_IF : begin
       _DIR_IF : begin
-{$ifdef NEWINPUT}
                   current_scanner^.skipspace;
                   current_scanner^.skipspace;
                   { start preproc expression scanner }
                   { start preproc expression scanner }
                   preproc_token:=current_scanner^.readpreproc;
                   preproc_token:=current_scanner^.readpreproc;
                   hs:=read_expr;
                   hs:=read_expr;
                   current_scanner^.addpreprocstack(hs<>'0',hs,scan_c_if_found);
                   current_scanner^.addpreprocstack(hs<>'0',hs,scan_c_if_found);
-{$else}
-                  skipspace;
-                  { start preproc expression scanner }
-                  preproc_token:=readpreproc;
-                  hs:=read_expr;
-                  addpreprocstack(hs<>'0',hs,scan_c_if_found);
-{$endif}
                 end;
                 end;
   _DIR_IFNDEF : begin
   _DIR_IFNDEF : begin
-{$ifdef NEWINPUT}
                   current_scanner^.skipspace;
                   current_scanner^.skipspace;
                   hs:=current_scanner^.readid;
                   hs:=current_scanner^.readid;
                   mac:=pmacrosym(macros^.search(hs));
                   mac:=pmacrosym(macros^.search(hs));
                   current_scanner^.addpreprocstack(not(assigned(mac) and mac^.defined),hs,scan_c_ifndef_found);
                   current_scanner^.addpreprocstack(not(assigned(mac) and mac^.defined),hs,scan_c_ifndef_found);
-{$else}
-                  skipspace;
-                  hs:=readid;
-                  mac:=pmacrosym(macros^.search(hs));
-                  addpreprocstack(not(assigned(mac) and mac^.defined),hs,scan_c_ifndef_found);
-{$endif}
                 end;
                 end;
            end;
            end;
          { accept the text ? }
          { accept the text ? }
-{$ifdef NEWINPUT}
            if (current_scanner^.preprocstack=nil) or current_scanner^.preprocstack^.accept then
            if (current_scanner^.preprocstack=nil) or current_scanner^.preprocstack^.accept then
             break
             break
            else
            else
@@ -438,19 +330,6 @@ const
               Message1(scan_d_handling_switch,'$'+directive[t]);
               Message1(scan_d_handling_switch,'$'+directive[t]);
             end;
             end;
          end;
          end;
-{$else}
-           if (preprocstack=nil) or preprocstack^.accept then
-            break
-           else
-            begin
-              Message(scan_c_skipping_until);
-              repeat
-                skipuntildirective;
-                t:=Get_Directive(readid);
-              until is_conditional(t);
-            end;
-         end;
-{$endif}
       end;
       end;
 
 
 
 
@@ -463,8 +342,8 @@ const
         macropos : longint;
         macropos : longint;
         macrobuffer : pmacrobuffer;
         macrobuffer : pmacrobuffer;
       begin
       begin
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-        hs:={$ifdef NEWINPUT}current_scanner^.{$endif}readid;
+        current_scanner^.skipspace;
+        hs:=current_scanner^.readid;
         mac:=pmacrosym(macros^.search(hs));
         mac:=pmacrosym(macros^.search(hs));
         if not assigned(mac) then
         if not assigned(mac) then
           begin
           begin
@@ -493,21 +372,21 @@ const
               Message(scan_e_keyword_cant_be_a_macro);
               Message(scan_e_keyword_cant_be_a_macro);
              pattern:=hs2;
              pattern:=hs2;
            { !!!!!! handle macro params, need we this? }
            { !!!!!! handle macro params, need we this? }
-             {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
+             current_scanner^.skipspace;
            { may be a macro? }
            { may be a macro? }
              if c=':' then
              if c=':' then
                begin
                begin
-                  {$ifdef NEWINPUT}current_scanner^.{$endif}readchar;
+                  current_scanner^.readchar;
                   if c='=' then
                   if c='=' then
                     begin
                     begin
                        new(macrobuffer);
                        new(macrobuffer);
                        macropos:=0;
                        macropos:=0;
                        { first char }
                        { first char }
-                       {$ifdef NEWINPUT}current_scanner^.{$endif}readchar;
+                       current_scanner^.readchar;
                        while (c<>'}') do
                        while (c<>'}') do
                          begin
                          begin
                             macrobuffer^[macropos]:=c;
                             macrobuffer^[macropos]:=c;
-                            {$ifdef NEWINPUT}current_scanner^.{$endif}readchar;
+                            current_scanner^.readchar;
                             if c=#26 then Message(scan_f_end_of_file);
                             if c=#26 then Message(scan_f_end_of_file);
                             inc(macropos);
                             inc(macropos);
                             if macropos>maxmacrolen then
                             if macropos>maxmacrolen then
@@ -533,8 +412,8 @@ const
         hs  : string;
         hs  : string;
         mac : pmacrosym;
         mac : pmacrosym;
       begin
       begin
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-        hs:={$ifdef NEWINPUT}current_scanner^.{$endif}readid;
+        current_scanner^.skipspace;
+        hs:=current_scanner^.readid;
         mac:=pmacrosym(macros^.search(hs));
         mac:=pmacrosym(macros^.search(hs));
         if not assigned(mac) then
         if not assigned(mac) then
           begin
           begin
@@ -570,8 +449,8 @@ const
     _DIR_MESSAGE,
     _DIR_MESSAGE,
        _DIR_INFO : w:=scan_i_user_defined;
        _DIR_INFO : w:=scan_i_user_defined;
         end;
         end;
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-        Message1(w,{$ifdef NEWINPUT}current_scanner^.{$endif}readcomment);
+        current_scanner^.skipspace;
+        Message1(w,current_scanner^.readcomment);
       end;
       end;
 
 
 
 
@@ -586,7 +465,7 @@ const
 {$endif}
 {$endif}
    _DIR_SMARTLINK : sw:=cs_smartlink;
    _DIR_SMARTLINK : sw:=cs_smartlink;
         end;
         end;
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
+        current_scanner^.skipspace;
         if c='-' then
         if c='-' then
          aktswitches:=aktswitches-[sw]
          aktswitches:=aktswitches-[sw]
         else
         else
@@ -603,13 +482,12 @@ const
         hp    : pinputfile;
         hp    : pinputfile;
         found : boolean;
         found : boolean;
       begin
       begin
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-        hs:={$ifdef NEWINPUT}current_scanner^.{$endif}readcomment;
+        current_scanner^.skipspace;
+        hs:=current_scanner^.readcomment;
         while (hs<>'') and (hs[length(hs)]=' ') do
         while (hs<>'') and (hs[length(hs)]=' ') do
          dec(byte(hs[0]));
          dec(byte(hs[0]));
         hs:=FixFileName(hs);
         hs:=FixFileName(hs);
         fsplit(hs,path,name,ext);
         fsplit(hs,path,name,ext);
-{$ifdef NEWINPUT}
       { first look in the path of _d then currentmodule }
       { first look in the path of _d then currentmodule }
         path:=search(hs,path+';'+current_scanner^.inputfile^.path^+';'+includesearchpath,found);
         path:=search(hs,path+';'+current_scanner^.inputfile^.path^+';'+includesearchpath,found);
       { shutdown current file }
       { shutdown current file }
@@ -619,32 +497,11 @@ const
         current_scanner^.addfile(hp);
         current_scanner^.addfile(hp);
         if not current_scanner^.open then
         if not current_scanner^.open then
          Message1(scan_f_cannot_open_includefile,hs);
          Message1(scan_f_cannot_open_includefile,hs);
-{        status.currentsource:=current_scanner^.inputfile^.name^; }
         Message1(scan_u_start_include_file,current_scanner^.inputfile^.name^);
         Message1(scan_u_start_include_file,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;
         current_module^.current_index:=hp^.ref_index;
-{$else}
-      { first look in the path of _d then currentmodule }
-        path:=search(hs,path+';'+current_module^.current_inputfile^.path^+';'+includesearchpath,found);
-        hp:=new(pinputfile,init(path,name,ext));
-        hp^.reset;
-        if ioresult=0 then
-         begin
-           current_module^.current_inputfile^.bufpos:=longint(inputpointer)-longint(inputbuffer);
-           hp^.next:=current_module^.current_inputfile;
-           current_module^.current_inputfile:=hp;
-           status.currentsource:=current_module^.current_inputfile^.name^+current_module^.current_inputfile^.ext^;
-           current_module^.sourcefiles.register_file(hp);
-           current_module^.current_index:=hp^.ref_index;
-           inputbuffer:=current_module^.current_inputfile^.buf;
-           Message1(scan_u_start_include_file,current_module^.current_inputfile^.name^);
-           reload;
-         end
-        else
-         Message1(scan_f_cannot_open_includefile,hs);
-{$endif NEWINPUT}
       end;
       end;
 
 
 
 
@@ -655,16 +512,16 @@ const
 
 
     procedure dir_linkobject(t:tdirectivetoken);
     procedure dir_linkobject(t:tdirectivetoken);
       begin
       begin
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-        {$ifdef NEWINPUT}current_scanner^.{$endif}readstring;
+        current_scanner^.skipspace;
+        current_scanner^.readstring;
         current_module^.linkofiles.insert(FixFileName(orgpattern));
         current_module^.linkofiles.insert(FixFileName(orgpattern));
       end;
       end;
 
 
 
 
     procedure dir_linklib(t:tdirectivetoken);
     procedure dir_linklib(t:tdirectivetoken);
       begin
       begin
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-        {$ifdef NEWINPUT}current_scanner^.{$endif}readstring;
+        current_scanner^.skipspace;
+        current_scanner^.readstring;
         current_module^.linkSharedLibs.insert(orgpattern);
         current_module^.linkSharedLibs.insert(orgpattern);
       end;
       end;
 
 
@@ -675,8 +532,8 @@ const
          Message(scan_w_switch_is_global)
          Message(scan_w_switch_is_global)
         else
         else
           begin
           begin
-            {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-            if set_string_asm({$ifdef NEWINPUT}current_scanner^.{$endif}readid) then
+            current_scanner^.skipspace;
+            if set_string_asm(current_scanner^.readid) then
              aktoutputformat:=target_asm.id
              aktoutputformat:=target_asm.id
             else
             else
              Message(scan_w_illegal_switch);
              Message(scan_w_illegal_switch);
@@ -688,10 +545,10 @@ const
       var
       var
         hs : string;
         hs : string;
       begin
       begin
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
+        current_scanner^.skipspace;
         if upcase(c)='N' then
         if upcase(c)='N' then
          begin
          begin
-           hs:={$ifdef NEWINPUT}current_scanner^.{$endif}readid;
+           hs:=current_scanner^.readid;
            if hs='NORMAL' then
            if hs='NORMAL' then
             aktpackrecords:=2
             aktpackrecords:=2
            else
            else
@@ -699,7 +556,7 @@ const
          end
          end
         else
         else
          begin
          begin
-           case {$ifdef NEWINPUT}current_scanner^.{$endif}readval of
+           case current_scanner^.readval of
             1 : aktpackrecords:=1;
             1 : aktpackrecords:=1;
             2 : aktpackrecords:=2;
             2 : aktpackrecords:=2;
             4 : aktpackrecords:=4;
             4 : aktpackrecords:=4;
@@ -719,8 +576,8 @@ const
       var
       var
         s : string;
         s : string;
       begin
       begin
-        {$ifdef NEWINPUT}current_scanner^.{$endif}skipspace;
-        s:={$ifdef NEWINPUT}current_scanner^.{$endif}readid;
+        current_scanner^.skipspace;
+        s:=current_scanner^.readid;
         if s='DEFAULT' then
         if s='DEFAULT' then
          aktasmmode:=initasmmode
          aktasmmode:=initasmmode
         else
         else
@@ -804,9 +661,9 @@ const
         p  : tdirectiveproc;
         p  : tdirectiveproc;
         hs : string;
         hs : string;
       begin
       begin
-         {$ifdef NEWINPUT}current_scanner^.{$endif}gettokenpos;
-         {$ifdef NEWINPUT}current_scanner^.{$endif}readchar; {Remove the $}
-         hs:={$ifdef NEWINPUT}current_scanner^.{$endif}readid;
+         current_scanner^.gettokenpos;
+         current_scanner^.readchar; {Remove the $}
+         hs:=current_scanner^.readid;
          Message1(scan_d_handling_switch,'$'+hs);
          Message1(scan_d_handling_switch,'$'+hs);
          if hs='' then
          if hs='' then
           Message1(scan_w_illegal_switch,'$'+hs);
           Message1(scan_w_illegal_switch,'$'+hs);
@@ -814,11 +671,11 @@ const
          while (length(hs)=1) and (c in ['-','+']) do
          while (length(hs)=1) and (c in ['-','+']) do
           begin
           begin
             HandleSwitch(hs[1],c);
             HandleSwitch(hs[1],c);
-            {$ifdef NEWINPUT}current_scanner^.{$endif}readchar; {Remove + or -}
+            current_scanner^.readchar; {Remove + or -}
             if c=',' then
             if c=',' then
              begin
              begin
-               {$ifdef NEWINPUT}current_scanner^.{$endif}readchar;   {Remove , }
-               hs:={$ifdef NEWINPUT}current_scanner^.{$endif}readid; {Check for multiple switches on one line}
+               current_scanner^.readchar;   {Remove , }
+               hs:=current_scanner^.readid; {Check for multiple switches on one line}
                Message1(scan_d_handling_switch,'$'+hs);
                Message1(scan_d_handling_switch,'$'+hs);
              end
              end
             else
             else
@@ -841,14 +698,17 @@ const
             else
             else
              Message1(scan_w_illegal_directive,'$'+hs);
              Message1(scan_w_illegal_directive,'$'+hs);
           { conditionals already read the comment }
           { conditionals already read the comment }
-            if ({$ifdef NEWINPUT}current_scanner^.{$endif}comment_level>0) then
-             {$ifdef NEWINPUT}current_scanner^.{$endif}readcomment;
+            if (current_scanner^.comment_level>0) then
+             current_scanner^.readcomment;
           end;
           end;
       end;
       end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.13  1998-07-07 12:32:54  peter
+  Revision 1.14  1998-07-14 14:47:03  peter
+    * released NEWINPUT
+
+  Revision 1.13  1998/07/07 12:32:54  peter
     * status.currentsource is now calculated in verbose (more accurated)
     * status.currentsource is now calculated in verbose (more accurated)
 
 
   Revision 1.12  1998/07/07 11:20:10  peter
   Revision 1.12  1998/07/07 11:20:10  peter

+ 70 - 302
compiler/scanner.pas

@@ -34,9 +34,11 @@ unit scanner;
 {$ifdef TP}
 {$ifdef TP}
        maxmacrolen=1024;
        maxmacrolen=1024;
        InputFileBufSize=1024;
        InputFileBufSize=1024;
+       linebufincrease=64;
 {$else}
 {$else}
        maxmacrolen=16*1024;
        maxmacrolen=16*1024;
        InputFileBufSize=32*1024;
        InputFileBufSize=32*1024;
+       linebufincrease=512;
 {$endif}
 {$endif}
 
 
        id_len = 14;
        id_len = 14;
@@ -142,7 +144,6 @@ unit scanner;
           destructor done;
           destructor done;
        end;
        end;
 
 
-{$ifdef NEWINPUT}
        pscannerfile = ^tscannerfile;
        pscannerfile = ^tscannerfile;
        tscannerfile = object
        tscannerfile = object
           inputfile    : pinputfile; { current inputfile list }
           inputfile    : pinputfile; { current inputfile list }
@@ -157,13 +158,15 @@ unit scanner;
           inputpointer : pchar;
           inputpointer : pchar;
 
 
           bufstart,
           bufstart,
-          bufidx,
           bufsize      : longint;
           bufsize      : longint;
 
 
           line_no,
           line_no,
           lasttokenpos,
           lasttokenpos,
           lastlinepos  : longint;
           lastlinepos  : longint;
 
 
+          maxlinebuf   : longint;
+          linebuf      : plongint;
+
           s_point        : boolean;
           s_point        : boolean;
           comment_level,
           comment_level,
           yylexcount     : longint;
           yylexcount     : longint;
@@ -176,6 +179,7 @@ unit scanner;
           function  open:boolean;
           function  open:boolean;
           procedure close;
           procedure close;
           function  reopen:boolean;
           function  reopen:boolean;
+          procedure seekbuf(fpos:longint);
           procedure readbuf;
           procedure readbuf;
           procedure saveinputfile;
           procedure saveinputfile;
           procedure restoreinputfile;
           procedure restoreinputfile;
@@ -187,6 +191,7 @@ unit scanner;
           procedure gettokenpos;
           procedure gettokenpos;
           procedure inc_comment_level;
           procedure inc_comment_level;
           procedure dec_comment_level;
           procedure dec_comment_level;
+          procedure checkpreprocstack;
           procedure poppreprocstack;
           procedure poppreprocstack;
           procedure addpreprocstack(a:boolean;const s:string;w:tmsgconst);
           procedure addpreprocstack(a:boolean;const s:string;w:tmsgconst);
           procedure elsepreprocstack;
           procedure elsepreprocstack;
@@ -206,44 +211,12 @@ unit scanner;
           function  readpreproc:ttoken;
           function  readpreproc:ttoken;
           function  asmgetchar:char;
           function  asmgetchar:char;
        end;
        end;
-{$endif NEWINPUT}
 
 
     var
     var
         c              : char;
         c              : char;
         orgpattern,
         orgpattern,
         pattern        : string;
         pattern        : string;
-{$ifdef NEWINPUT}
         current_scanner : pscannerfile;
         current_scanner : pscannerfile;
-{$else}
-        currlinepos,
-        lastlinepos,
-        lasttokenpos,
-        inputbuffer,
-        inputpointer   : pchar;
-        s_point        : boolean;
-        comment_level,
-        yylexcount,
-        macropos       : longint;
-        lastasmgetchar : char;
-        preprocstack   : ppreprocstack;
-{$endif NEWINPUT}
-
-{$ifndef NEWINPUT}
-    procedure poppreprocstack;
-    procedure addpreprocstack(a:boolean;const s:string;w:tmsgconst);
-    procedure elsepreprocstack;
-    procedure gettokenpos;
-    function yylex : ttoken;
-    function asmgetchar : char;
-    { column position of last token }
-    function get_current_col : longint;
-    { column position of file }
-    function get_file_col : longint;
-    procedure get_cur_file_pos(var fileinfo : tfileposinfo);
-    procedure set_cur_file_pos(const fileinfo : tfileposinfo);
-    procedure InitScanner(const fn: string);
-    procedure DoneScanner(testendif:boolean);
-{$endif}
 
 
     { changes to keywords to be tp compatible }
     { changes to keywords to be tp compatible }
     procedure change_to_tp_keywords;
     procedure change_to_tp_keywords;
@@ -315,42 +288,6 @@ implementation
       end;
       end;
 
 
 
 
-{$ifndef NEWINPUT}
-
-    const
-       current_column : longint = 1;
-
-    function get_current_col : longint;
-
-      begin
-         get_current_col:=current_column;
-      end;
-
-    function get_file_col : longint;
-      begin
-        get_file_col:=lasttokenpos-lastlinepos;
-      end;
-
-
-    procedure inc_comment_level;
-      begin
-         inc(comment_level);
-         if (comment_level>1) then
-          Message1(scan_w_comment_level,tostr(comment_level));
-      end;
-
-
-    procedure dec_comment_level;
-      begin
-         if cs_tp_compatible in aktswitches then
-           comment_level:=0
-         else
-           dec(comment_level);
-      end;
-
-{$endif NEWINPUT}
-
-
 {*****************************************************************************
 {*****************************************************************************
                               TPreProcStack
                               TPreProcStack
 *****************************************************************************}
 *****************************************************************************}
@@ -367,9 +304,6 @@ implementation
       end;
       end;
 
 
 
 
-
-{$ifdef NEWINPUT}
-
 {****************************************************************************
 {****************************************************************************
                                 TSCANNERFILE
                                 TSCANNERFILE
  ****************************************************************************}
  ****************************************************************************}
@@ -396,6 +330,8 @@ implementation
         line_no:=0;
         line_no:=0;
         lastlinepos:=0;
         lastlinepos:=0;
         lasttokenpos:=0;
         lasttokenpos:=0;
+        linebuf:=nil;
+        maxlinebuf:=0;
       { load block }
       { load block }
         if not open then
         if not open then
          Message(scan_f_cannot_open_input);
          Message(scan_f_cannot_open_input);
@@ -405,18 +341,23 @@ implementation
 
 
     destructor tscannerfile.done;
     destructor tscannerfile.done;
       begin
       begin
-      { check for missing ifdefs }
-        while assigned(preprocstack) do
-         begin
-           Message3(scan_e_endif_expected,'$IF(N)(DEF)',preprocstack^.name,tostr(preprocstack^.line_nb));
-           poppreprocstack;
-         end;
+        checkpreprocstack;
       { close file }
       { close file }
         if not closed then
         if not closed then
          close;
          close;
       end;
       end;
 
 
 
 
+    procedure tscannerfile.seekbuf(fpos:longint);
+      begin
+        if closed then
+         exit;
+        seek(f,fpos);
+        bufstart:=fpos;
+        bufsize:=0;
+      end;
+
+
     procedure tscannerfile.readbuf;
     procedure tscannerfile.readbuf;
     {$ifdef TP}
     {$ifdef TP}
       var
       var
@@ -523,6 +464,8 @@ implementation
         inputfile^.saveline_no:=line_no;
         inputfile^.saveline_no:=line_no;
         inputfile^.saveinputbuffer:=inputbuffer;
         inputfile^.saveinputbuffer:=inputbuffer;
         inputfile^.saveinputpointer:=inputpointer;
         inputfile^.saveinputpointer:=inputpointer;
+        inputfile^.linebuf:=linebuf;
+        inputfile^.maxlinebuf:=maxlinebuf;
       end;
       end;
 
 
 
 
@@ -534,6 +477,8 @@ implementation
         line_no:=inputfile^.saveline_no;
         line_no:=inputfile^.saveline_no;
         inputbuffer:=inputfile^.saveinputbuffer;
         inputbuffer:=inputfile^.saveinputbuffer;
         inputpointer:=inputfile^.saveinputpointer;
         inputpointer:=inputfile^.saveinputpointer;
+        linebuf:=inputfile^.linebuf;
+        maxlinebuf:=inputfile^.maxlinebuf;
       end;
       end;
 
 
 
 
@@ -574,7 +519,6 @@ implementation
           if filenotatend then
           if filenotatend then
            begin
            begin
              readbuf;
              readbuf;
-  {           fixbuf; }
              if line_no=0 then
              if line_no=0 then
               line_no:=1;
               line_no:=1;
              inputpointer:=inputbuffer;
              inputpointer:=inputbuffer;
@@ -642,6 +586,9 @@ implementation
     procedure tscannerfile.linebreak;
     procedure tscannerfile.linebreak;
       var
       var
          cur : char;
          cur : char;
+{$ifdef SourceLine}
+         hp  : plongint;
+{$endif SourceLine}
       begin
       begin
         if (byte(inputpointer^)=0) and
         if (byte(inputpointer^)=0) and
            filenotatend then
            filenotatend then
@@ -661,118 +608,41 @@ implementation
       { increase line counters }
       { increase line counters }
         lastlinepos:=bufstart+(inputpointer-inputbuffer);
         lastlinepos:=bufstart+(inputpointer-inputbuffer);
         inc(line_no);
         inc(line_no);
+      { update linebuffer }
+{$ifdef SourceLine}
+        if line_no>maxlinebuf then
+         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 }
       { update for status }
         inc(status.compiledlines);
         inc(status.compiledlines);
         Comment(V_Status,'');
         Comment(V_Status,'');
       end;
       end;
 
 
-{$else NEWINPUT}
 
 
-    procedure gettokenpos;
-    { load the values of tokenpos and lasttokenpos }
-      begin
-        tokenpos.line:=current_module^.current_inputfile^.true_line;
-        tokenpos.column:=get_file_col;
-        tokenpos.fileindex:=current_module^.current_index;
-      end;
-
-    procedure reload;
-      var
-         readsize   : word;
-         i,saveline : longint;
+    procedure tscannerfile.checkpreprocstack;
       begin
       begin
-        if not assigned(current_module^.current_inputfile) then
-          internalerror(14);
-        if current_module^.current_inputfile^.filenotatend then
-         begin
-         { load the next piece of source }
-           blockread(current_module^.current_inputfile^.f,inputbuffer^,
-             current_module^.current_inputfile^.bufsize-1,readsize);
-         { Scan the buffer for #0 chars, which are not alllowed }
-           if readsize > 0 then
-            begin
-            { force proper line counting }
-              saveline:=current_module^.current_inputfile^.true_line;
-              i:=0;
-              inputpointer:=inputbuffer;
-              while i<readsize do
-               begin
-                 c:=inputpointer^;
-                 case c of
-                  #0 : Message(scan_f_illegal_char);
-             #10,#13 : begin
-                         if (byte(c)+byte(inputpointer[1])=23) then
-                          begin
-                            inc(longint(inputpointer));
-                            inc(i);
-                          end;
-                         inc(current_module^.current_inputfile^.true_line);
-                       end;
-                 end;
-                 inc(i);
-                 inc(longint(inputpointer));
-               end;
-              current_module^.current_inputfile^.true_line:=saveline;
-            end;
-           inputbuffer[readsize]:=#0;
-           inputpointer:=inputbuffer;
-           currlinepos:=inputpointer;
-         { Set EOF when main source and at endoffile }
-           if eof(current_module^.current_inputfile^.f) then
-            begin
-              current_module^.current_inputfile^.filenotatend:=false;
-              if current_module^.current_inputfile^.next=nil then
-               inputbuffer[readsize]:=#26;
-            end;
-         end
-        else
+      { check for missing ifdefs }
+        while assigned(preprocstack) do
          begin
          begin
-           current_module^.current_inputfile^.close;
-         { load next module }
-           current_module^.current_inputfile:=current_module^.current_inputfile^.next;
-           current_module^.current_index:=current_module^.current_inputfile^.ref_index;
-           status.currentsource:=current_module^.current_inputfile^.name^+current_module^.current_inputfile^.ext^;
-           inputbuffer:=current_module^.current_inputfile^.buf;
-           inputpointer:=inputbuffer+current_module^.current_inputfile^.bufpos;
-           currlinepos:=inputpointer;
+           Message3(scan_e_endif_expected,'$IF(N)(DEF)',preprocstack^.name,tostr(preprocstack^.line_nb));
+           poppreprocstack;
          end;
          end;
-        lastlinepos:=currlinepos;
-      { load next char }
-        c:=inputpointer^;
-        inc(longint(inputpointer));
-      end;
-
-    procedure linebreak;
-      var
-         cur : char;
-      begin
-        if (byte(inputpointer^)=0) and
-           current_module^.current_inputfile^.filenotatend then
-          begin
-             cur:=c;
-             reload;
-             if byte(cur)+byte(c)<>23 then
-               dec(longint(inputpointer));
-          end
-        else
-          begin
-          { Fix linebreak to be only newline (=#10) for all types of linebreaks }
-            if (byte(inputpointer^)+byte(c)=23) then
-              inc(longint(inputpointer));
-          end;
-        c:=newline;
-      { status }
-        Comment(V_Status,'');
-      { increase line counters }
-        inc(current_module^.current_inputfile^.true_line);
-        currlinepos:=inputpointer;
-        inc(status.compiledlines);
       end;
       end;
 
 
-{$endif NEWINPUT}
 
 
-
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}poppreprocstack;
+    procedure tscannerfile.poppreprocstack;
       var
       var
          hp : ppreprocstack;
          hp : ppreprocstack;
       begin
       begin
@@ -787,11 +657,11 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}addpreprocstack(a:boolean;const s:string;w:tmsgconst);
+    procedure tscannerfile.addpreprocstack(a:boolean;const s:string;w:tmsgconst);
       begin
       begin
         preprocstack:=new(ppreprocstack,init(((preprocstack=nil) or preprocstack^.accept) and a,preprocstack));
         preprocstack:=new(ppreprocstack,init(((preprocstack=nil) or preprocstack^.accept) and a,preprocstack));
         preprocstack^.name:=s;
         preprocstack^.name:=s;
-        preprocstack^.line_nb:={$ifndef NEWINPUT}current_module^.current_inputfile^.{$endif}line_no;
+        preprocstack^.line_nb:=line_no;
         if preprocstack^.accept then
         if preprocstack^.accept then
          Message2(w,preprocstack^.name,'accepted')
          Message2(w,preprocstack^.name,'accepted')
         else
         else
@@ -799,7 +669,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}elsepreprocstack;
+    procedure tscannerfile.elsepreprocstack;
       begin
       begin
         if assigned(preprocstack) then
         if assigned(preprocstack) then
          begin
          begin
@@ -815,7 +685,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}readchar;
+    procedure tscannerfile.readchar;
       begin
       begin
         c:=inputpointer^;
         c:=inputpointer^;
         if c=#0 then
         if c=#0 then
@@ -827,7 +697,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}readstring;
+    procedure tscannerfile.readstring;
       var
       var
         i : longint;
         i : longint;
       begin
       begin
@@ -873,7 +743,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}readnumber;
+    procedure tscannerfile.readnumber;
       var
       var
         base,
         base,
         i  : longint;
         i  : longint;
@@ -920,14 +790,14 @@ implementation
       end;
       end;
 
 
 
 
-    function {$ifdef NEWINPUT}tscannerfile.{$endif}readid:string;
+    function tscannerfile.readid:string;
       begin
       begin
         readstring;
         readstring;
         readid:=pattern;
         readid:=pattern;
       end;
       end;
 
 
 
 
-    function {$ifdef NEWINPUT}tscannerfile.{$endif}readval:longint;
+    function tscannerfile.readval:longint;
       var
       var
         l : longint;
         l : longint;
         w : word;
         w : word;
@@ -938,7 +808,7 @@ implementation
       end;
       end;
 
 
 
 
-    function {$ifdef NEWINPUT}tscannerfile.{$endif}readcomment:string;
+    function tscannerfile.readcomment:string;
       var
       var
         i : longint;
         i : longint;
       begin
       begin
@@ -972,7 +842,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}skipspace;
+    procedure tscannerfile.skipspace;
       begin
       begin
         while c in [' ',#9..#13] do
         while c in [' ',#9..#13] do
          begin
          begin
@@ -987,7 +857,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}skipuntildirective;
+    procedure tscannerfile.skipuntildirective;
       var
       var
         found : longint;
         found : longint;
       begin
       begin
@@ -1023,7 +893,7 @@ implementation
 
 
 {$i scandir.inc}
 {$i scandir.inc}
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}skipcomment;
+    procedure tscannerfile.skipcomment;
       begin
       begin
         readchar;
         readchar;
         inc_comment_level;
         inc_comment_level;
@@ -1049,7 +919,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}skipdelphicomment;
+    procedure tscannerfile.skipdelphicomment;
       begin
       begin
         inc_comment_level;
         inc_comment_level;
         readchar;
         readchar;
@@ -1067,7 +937,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure {$ifdef NEWINPUT}tscannerfile.{$endif}skipoldtpcomment;
+    procedure tscannerfile.skipoldtpcomment;
       var
       var
         found : longint;
         found : longint;
       begin
       begin
@@ -1113,7 +983,7 @@ implementation
       end;
       end;
 
 
 
 
-    function {$ifdef NEWINPUT}tscannerfile.{$endif}yylex : ttoken;
+    function tscannerfile.yylex : ttoken;
       var
       var
         y       : ttoken;
         y       : ttoken;
         code    : word;
         code    : word;
@@ -1154,10 +1024,6 @@ implementation
 
 
       { Save current token position }
       { Save current token position }
         gettokenpos;
         gettokenpos;
-{$ifndef NEWINPUT}
-        lastlinepos:=currlinepos;
-        lasttokenpos:=inputpointer;
-{$endif}
 
 
       { Check first for a identifier/keyword, this is 20+% faster (PFV) }
       { Check first for a identifier/keyword, this is 20+% faster (PFV) }
         if c in ['_','A'..'Z','a'..'z'] then
         if c in ['_','A'..'Z','a'..'z'] then
@@ -1175,28 +1041,10 @@ implementation
                   begin
                   begin
                   { don't forget the last char }
                   { don't forget the last char }
                     dec(longint(inputpointer));
                     dec(longint(inputpointer));
-{$ifdef NEWINPUT}
                     hp:=new(pinputfile,init('Macro '+pattern));
                     hp:=new(pinputfile,init('Macro '+pattern));
                     addfile(hp);
                     addfile(hp);
                     getmem(macbuf,mac^.buflen+1);
                     getmem(macbuf,mac^.buflen+1);
                     setbuf(macbuf,mac^.buflen+1);
                     setbuf(macbuf,mac^.buflen+1);
-{$else}
-                    current_module^.current_inputfile^.bufpos:=inputpointer-inputbuffer;
-                    hp:=new(pinputfile,init('','Macro '+pattern,''));
-                  { this isn't a proper way, but ... }
-                    hp^.next:=current_module^.current_inputfile;
-                    current_module^.current_inputfile:=hp;
-                    status.currentsource:=current_module^.current_inputfile^.name^;
-                    { I don't think that we should do that
-                      because otherwise the file will be searched !! (PM)
-                      but there is the problem of index !! }
-                    current_module^.sourcefiles.register_file(hp);
-                    current_module^.current_index:=hp^.ref_index;
-                  { set an own buffer }
-                    getmem(macbuf,mac^.buflen+1);
-                    current_module^.current_inputfile^.setbuf(macbuf,mac^.buflen+1);
-                    inputbuffer:=current_module^.current_inputfile^.buf;
-{$endif NEWINPUT}
                   { copy text }
                   { copy text }
                     move(mac^.buftext^,inputbuffer^,mac^.buflen);
                     move(mac^.buftext^,inputbuffer^,mac^.buflen);
                   { put end sign }
                   { put end sign }
@@ -1551,19 +1399,9 @@ implementation
            end;
            end;
         end;
         end;
 exit_label:
 exit_label:
-      { don't change the file : too risky !! }
-{$ifndef NEWINPUT}
-        if current_module^.current_index=tokenpos.fileindex then
-          begin
-             current_module^.current_inputfile^.line_no:=tokenpos.line;
-             current_module^.current_inputfile^.column:=tokenpos.column;
-             current_column:=tokenpos.column;
-          end;
-{$endif NEWINPUT}
       end;
       end;
 
 
 
 
-{$ifdef NEWINPUT}
     function tscannerfile.readpreproc:ttoken;
     function tscannerfile.readpreproc:ttoken;
       begin
       begin
          skipspace;
          skipspace;
@@ -1633,10 +1471,9 @@ exit_label:
           end;
           end;
          end;
          end;
       end;
       end;
-{$endif}
 
 
 
 
-    function {$ifdef NEWINPUT}tscannerfile.{$endif}asmgetchar : char;
+    function tscannerfile.asmgetchar : char;
       begin
       begin
          if lastasmgetchar<>#0 then
          if lastasmgetchar<>#0 then
           begin
           begin
@@ -1683,82 +1520,13 @@ exit_label:
          end;
          end;
       end;
       end;
 
 
-{$ifdef NEWINPUT}
-
-{$else NEWPPU}
-
-   procedure InitScanner(const fn: string);
-     var
-       d:dirstr;
-       n:namestr;
-       e:extstr;
-     begin
-        fsplit(fn,d,n,e);
-        current_module^.current_inputfile:=new(pinputfile,init(d,n,e));
-        if not current_module^.current_inputfile^.reset then
-         Message(scan_f_cannot_open_input);
-        current_module^.sourcefiles.register_file(current_module^.current_inputfile);
-        current_module^.current_index:=current_module^.current_inputfile^.ref_index;
-        status.currentsource:=current_module^.current_inputfile^.name^+current_module^.current_inputfile^.ext^;
-        inputbuffer:=current_module^.current_inputfile^.buf;
-        reload;
-        preprocstack:=nil;
-        comment_level:=0;
-        lasttokenpos:=inputpointer;
-        lastlinepos:=inputpointer;
-        currlinepos:=inputpointer;
-        s_point:=false;
-        block_type:=bt_general;
-     end;
-
-   procedure get_cur_file_pos(var fileinfo : tfileposinfo);
-     begin
-        with fileinfo do
-         begin
-           line:=current_module^.current_inputfile^.line_no;
-           fileindex:=current_module^.current_index;
-           column:=get_current_col;
-         end;
-     end;
-
-
-   procedure set_cur_file_pos(const fileinfo : tfileposinfo);
-     begin
-        if current_module^.current_index<>fileinfo.fileindex then
-          begin
-             current_module^.current_index:=fileinfo.fileindex;
-             current_module^.current_inputfile:=
-               pinputfile(current_module^.sourcefiles.get_file(fileinfo.fileindex));
-          end;
-        if assigned(current_module^.current_inputfile) then
-          begin
-             current_module^.current_inputfile^.line_no:=fileinfo.line;
-             current_module^.current_inputfile^.column:=fileinfo.column;
-             current_column:=fileinfo.column;
-          end;
-     end;
-
-   procedure DoneScanner(testendif:boolean);
-     begin
-       if (not testendif) then
-        begin
-          while assigned(preprocstack) do
-           begin
-             Message3(scan_e_endif_expected,'$IF(N)(DEF)',preprocstack^.name,tostr(preprocstack^.line_nb));
-             poppreprocstack;
-           end;
-        end;
-     end;
-
-
-{$endif NEWINPUT}
-
-
-
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.33  1998-07-10 10:48:40  peter
+  Revision 1.34  1998-07-14 14:47:04  peter
+    * released NEWINPUT
+
+  Revision 1.33  1998/07/10 10:48:40  peter
     * fixed realnumber scanning
     * fixed realnumber scanning
     * [] after asmblock was not uppercased anymore
     * [] after asmblock was not uppercased anymore
 
 

+ 4 - 17
compiler/symdef.inc

@@ -204,15 +204,7 @@
       if assigned(sym) then
       if assigned(sym) then
         begin
         begin
            name := sym^.name;
            name := sym^.name;
-{$ifdef NEWINPUT}
-
-
            sym_line_no:=sym^.fileinfo.line;
            sym_line_no:=sym^.fileinfo.line;
-{$else}
-           sym_line_no:=sym^.line_no;
-{$endif}
-
-
         end
         end
       else
       else
         begin
         begin
@@ -1065,15 +1057,7 @@
                 if assigned(sym) then
                 if assigned(sym) then
                   begin
                   begin
                      st := sym^.name;
                      st := sym^.name;
-{$ifdef NEWINPUT}
-
-
                      sym_line_no:=sym^.fileinfo.line;
                      sym_line_no:=sym^.fileinfo.line;
-{$else}
-                     sym_line_no:=sym^.line_no;
-{$endif}
-
-
                   end
                   end
                 else
                 else
                   begin
                   begin
@@ -2674,7 +2658,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.18  1998-07-10 10:51:04  peter
+  Revision 1.19  1998-07-14 14:47:05  peter
+    * released NEWINPUT
+
+  Revision 1.18  1998/07/10 10:51:04  peter
     * m68k updates
     * m68k updates
 
 
   Revision 1.16  1998/07/07 11:20:13  peter
   Revision 1.16  1998/07/07 11:20:13  peter

+ 4 - 26
compiler/symppu.inc

@@ -132,8 +132,6 @@
       end;
       end;
 
 
 
 
-{$ifdef NEWINPUT}
-
     procedure writesourcefiles;
     procedure writesourcefiles;
       var
       var
         hp    : pinputfile;
         hp    : pinputfile;
@@ -154,29 +152,6 @@
         current_ppu^.writeentry(ibsourcefiles);
         current_ppu^.writeentry(ibsourcefiles);
       end;
       end;
 
 
-{$else}
-
-    procedure writesourcefiles;
-      var
-        hp2   : pextfile;
-        index : longint;
-      begin
-      { second write the used source files }
-        hp2:=current_module^.sourcefiles.files;
-        index:=current_module^.sourcefiles.last_ref_index;
-        while assigned(hp2) do
-         begin
-         { only name and extension }
-           current_ppu^.putstring(hp2^.name^+hp2^.ext^);
-         { index in that order }
-           hp2^.ref_index:=index;
-           dec(index);
-           hp2:=hp2^._next;
-         end;
-        current_ppu^.writeentry(ibsourcefiles);
-      end;
-
-{$endif NEWINPUT}
 
 
     procedure writeusedunit;
     procedure writeusedunit;
       var
       var
@@ -722,7 +697,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.6  1998-07-07 11:20:14  peter
+  Revision 1.7  1998-07-14 14:47:07  peter
+    * released NEWINPUT
+
+  Revision 1.6  1998/07/07 11:20:14  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.5  1998/06/24 14:48:39  peter
   Revision 1.5  1998/06/24 14:48:39  peter

+ 22 - 43
compiler/symsym.inc

@@ -34,14 +34,7 @@
 {$ifdef GDB}
 {$ifdef GDB}
          isstabwritten := false;
          isstabwritten := false;
 {$endif GDB}
 {$endif GDB}
-{$ifdef NEWINPUT}
          fileinfo:=aktfilepos;
          fileinfo:=aktfilepos;
-{$else}
-         if assigned(current_module) and assigned(current_module^.current_inputfile) then
-           line_no:=current_module^.current_inputfile^.line_no
-         else
-           line_no:=0;
-{$endif NEWINPUT}
 {$ifdef UseBrowser}
 {$ifdef UseBrowser}
          defref:=nil;
          defref:=nil;
          lastwritten:=nil;
          lastwritten:=nil;
@@ -62,14 +55,7 @@
          right:=nil;
          right:=nil;
          setname(readstring);
          setname(readstring);
          typ:=abstractsym;
          typ:=abstractsym;
-{$ifdef NEWINPUT}       
-
          fillchar(fileinfo,sizeof(fileinfo),0);
          fillchar(fileinfo,sizeof(fileinfo),0);
-{$else} 
-
-         line_no:=0;
-{$endif}        
-
          if object_options then
          if object_options then
            properties:=symprop(readbyte)
            properties:=symprop(readbyte)
          else
          else
@@ -337,13 +323,8 @@
     function tsym.stabstring : pchar;
     function tsym.stabstring : pchar;
 
 
       begin
       begin
-         stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+tostr(
-{$ifdef NEWINPUT}
-           fileinfo.line
-{$else}
-           line_no
-{$endif}
-           )+',0');
+         stabstring:=strpnew('"'+name+'",'+tostr(N_LSYM)+',0,'+
+           tostr(fileinfo.line)+',0');
       end;
       end;
 
 
     procedure tsym.concatstabto(asmlist : paasmoutput);
     procedure tsym.concatstabto(asmlist : paasmoutput);
@@ -557,11 +538,7 @@
      stabstring :=strpnew('"'+obj+':'+RetType
      stabstring :=strpnew('"'+obj+':'+RetType
            +definition^.retdef^.numberstring+info+'",'+tostr(n_function)
            +definition^.retdef^.numberstring+info+'",'+tostr(n_function)
            +',0,'+
            +',0,'+
-{$ifdef NEWINPUT}
            tostr(aktfilepos.line)
            tostr(aktfilepos.line)
-{$else}
-           tostr(current_module^.current_inputfile^.line_no)
-{$endif}
            +','+definition^.mangledname);
            +','+definition^.mangledname);
     end;
     end;
 
 
@@ -1097,7 +1074,7 @@
             if use_gsym then st := 'G' else st := 'S';
             if use_gsym then st := 'G' else st := 'S';
             stabstring := strpnew('"'+owner^.name^+'__'+name+':'+
             stabstring := strpnew('"'+owner^.name^+'__'+name+':'+
                      +definition^.numberstring+'",'+
                      +definition^.numberstring+'",'+
-                     tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
+                     tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
          end
          end
        else if (owner^.symtabletype = globalsymtable) or
        else if (owner^.symtabletype = globalsymtable) or
           (owner^.symtabletype = unitsymtable) then
           (owner^.symtabletype = unitsymtable) then
@@ -1109,13 +1086,13 @@
             if use_gsym then st := 'G' else st := 'S';
             if use_gsym then st := 'G' else st := 'S';
             stabstring := strpnew('"'+name+':'+st
             stabstring := strpnew('"'+name+':'+st
                      +definition^.numberstring+'",'+
                      +definition^.numberstring+'",'+
-                     tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
+                     tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
          end
          end
        else if owner^.symtabletype = staticsymtable then
        else if owner^.symtabletype = staticsymtable then
          begin
          begin
             stabstring := strpnew('"'+name+':S'
             stabstring := strpnew('"'+name+':S'
                   +definition^.numberstring+'",'+
                   +definition^.numberstring+'",'+
-                  tostr(N_LCSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
+                  tostr(N_LCSYM)+',0,'+tostr(fileinfo.line)+','+mangledname);
          end
          end
        else if (owner^.symtabletype=parasymtable) then
        else if (owner^.symtabletype=parasymtable) then
          begin
          begin
@@ -1129,8 +1106,8 @@
               end;
               end;
             stabstring := strpnew('"'+name+':'+st
             stabstring := strpnew('"'+name+':'+st
                   +definition^.numberstring+'",'+
                   +definition^.numberstring+'",'+
-                  tostr(N_PSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+
-                    tostr(address+owner^.call_offset))
+                  tostr(N_PSYM)+',0,'+tostr(fileinfo.line)+','+
+                  tostr(address+owner^.call_offset));
                   {offset to ebp => will not work if the framepointer is esp
                   {offset to ebp => will not work if the framepointer is esp
                   so some optimizing will make things harder to debug }
                   so some optimizing will make things harder to debug }
          end
          end
@@ -1142,15 +1119,14 @@
               { this is the register order for GDB}
               { this is the register order for GDB}
               stabstring:=strpnew('"'+name+':r'
               stabstring:=strpnew('"'+name+':r'
                         +definition^.numberstring+'",'+
                         +definition^.numberstring+'",'+
-                        tostr(N_RSYM)+',0,'+tostr(
-              {$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(GDB_i386index[reg]));
+                        tostr(N_RSYM)+',0,'+
+                        tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
            end
            end
          else
          else
    {$endif i386}
    {$endif i386}
            stabstring := strpnew('"'+name+':'
            stabstring := strpnew('"'+name+':'
                   +definition^.numberstring+'",'+
                   +definition^.numberstring+'",'+
-                  tostr(N_LSYM)+',0,'+tostr(
-           {$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',-'+tostr(address))
+                  tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',-'+tostr(address))
        else
        else
          stabstring := inherited stabstring;
          stabstring := inherited stabstring;
   end;
   end;
@@ -1169,8 +1145,8 @@
            { this is the register order for GDB}
            { this is the register order for GDB}
               stab_str:=strpnew('"'+name+':r'
               stab_str:=strpnew('"'+name+':r'
                      +definition^.numberstring+'",'+
                      +definition^.numberstring+'",'+
-                     tostr(N_RSYM)+',0,'+tostr(
-                     {$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+tostr(GDB_i386index[reg]));
+                     tostr(N_RSYM)+',0,'+
+                     tostr(fileinfo.line)+','+tostr(GDB_i386index[reg]));
               asmlist^.concat(new(pai_stabs,init(stab_str)));
               asmlist^.concat(new(pai_stabs,init(stab_str)));
            end;
            end;
 {$endif i386}
 {$endif i386}
@@ -1287,9 +1263,9 @@
       st := 'G'
       st := 'G'
     else
     else
       st := 'S';
       st := 'S';
-    stabstring := strpnew('"'+name+':'+st
-            +definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+tostr(
-            {$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+','+mangledname);
+    stabstring := strpnew('"'+name+':'+st+
+            definition^.numberstring+'",'+tostr(n_STSYM)+',0,'+
+            tostr(fileinfo.line)+','+mangledname);
     end;
     end;
 {$endif GDB}
 {$endif GDB}
 
 
@@ -1413,8 +1389,8 @@
          { sets are not recognized by GDB}
          { sets are not recognized by GDB}
             {***}
             {***}
         end;
         end;
-    stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+tostr(
-    {$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0');
+    stabstring := strpnew('"'+name+':c='+st+'",'+tostr(N_function)+',0,'+
+                    tostr(fileinfo.line)+',0');
     end;
     end;
 
 
     procedure tconstsym.concatstabto(asmlist : paasmoutput);
     procedure tconstsym.concatstabto(asmlist : paasmoutput);
@@ -1586,7 +1562,7 @@
       else
       else
         stabchar := 't';
         stabchar := 't';
       short := '"'+name+':'+stabchar+definition^.numberstring
       short := '"'+name+':'+stabchar+definition^.numberstring
-               +'",'+tostr(N_LSYM)+',0,'+tostr({$ifdef NEWINPUT}fileinfo.line{$else}line_no{$endif})+',0';
+               +'",'+tostr(N_LSYM)+',0,'+tostr(fileinfo.line)+',0';
       stabstring := strpnew(short);
       stabstring := strpnew(short);
     end;
     end;
 
 
@@ -1644,7 +1620,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.21  1998-07-13 21:17:38  florian
+  Revision 1.22  1998-07-14 14:47:08  peter
+    * released NEWINPUT
+
+  Revision 1.21  1998/07/13 21:17:38  florian
     * changed to compile with TP
     * changed to compile with TP
 
 
   Revision 1.20  1998/07/10 00:00:05  peter
   Revision 1.20  1998/07/10 00:00:05  peter

+ 4 - 15
compiler/tree.pas

@@ -283,9 +283,6 @@ unit tree;
     procedure set_location(var destloc,sourceloc : tlocation);
     procedure set_location(var destloc,sourceloc : tlocation);
     procedure swap_location(var destloc,sourceloc : tlocation);
     procedure swap_location(var destloc,sourceloc : tlocation);
     procedure set_file_line(from,_to : ptree);
     procedure set_file_line(from,_to : ptree);
-{$ifndef NEWINPUT}
-    procedure set_current_file_line(_to : ptree);
-{$endif}
     procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
     procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
 {$ifdef extdebug}
 {$ifdef extdebug}
     procedure compare_trees(oldp,p : ptree);
     procedure compare_trees(oldp,p : ptree);
@@ -576,17 +573,6 @@ unit tree;
            _to^.fileinfo:=from^.fileinfo;
            _to^.fileinfo:=from^.fileinfo;
       end;
       end;
 
 
-{$ifndef NEWINPUT}
-    procedure set_current_file_line(_to : ptree);
-
-      begin
-         current_module^.current_inputfile:=
-           pinputfile(current_module^.sourcefiles.get_file(_to^.fileinfo.fileindex));
-         current_module^.current_inputfile^.line_no:=_to^.fileinfo.line;
-         current_module^.current_index:=_to^.fileinfo.fileindex;
-      end;
-{$endif}
-
    procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
    procedure set_tree_filepos(p : ptree;const filepos : tfileposinfo);
      begin
      begin
         p^.fileinfo:=filepos;
         p^.fileinfo:=filepos;
@@ -1609,7 +1595,10 @@ unit tree;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  1998-07-08 14:56:53  daniel
+  Revision 1.20  1998-07-14 14:47:11  peter
+    * released NEWINPUT
+
+  Revision 1.19  1998/07/08 14:56:53  daniel
   * Fixed $ifdef TP.
   * Fixed $ifdef TP.
 
 
   Revision 1.18  1998/07/07 11:20:18  peter
   Revision 1.18  1998/07/07 11:20:18  peter

+ 6 - 11
compiler/verb_def.pas

@@ -32,9 +32,6 @@ function  _internalerror(i : longint) : boolean;
 implementation
 implementation
 uses
 uses
   verbose,globals,
   verbose,globals,
-{$ifndef NEWINPUT}
-   files,
-{$endif}
   strings,dos;
   strings,dos;
 
 
 const
 const
@@ -140,22 +137,17 @@ begin
             if (verbosity and Level)=V_Fatal then
             if (verbosity and Level)=V_Fatal then
               hs:=rh_errorstr;
               hs:=rh_errorstr;
           end;
           end;
-{$ifdef NEWINPUT}
-        if (Level<$100) and (status.currentline>0) then
+        if (Level<=V_ShowFile) and (status.currentline>0) then
          begin
          begin
            if Use_Rhide then
            if Use_Rhide then
              hs:=lower(bstoslash(status.currentsource))+':'+tostr(status.currentline)+': '+hs
              hs:=lower(bstoslash(status.currentsource))+':'+tostr(status.currentline)+': '+hs
            else
            else
              hs:=status.currentsource+'('+tostr(status.currentline)+','+tostr(status.currentcolumn)+') '+hs;
              hs:=status.currentsource+'('+tostr(status.currentline)+','+tostr(status.currentcolumn)+') '+hs;
          end;
          end;
-{$else}
-        if (Level<$100) and Assigned(current_module) and Assigned(current_module^.current_inputfile) then
-          hs:=current_module^.current_inputfile^.get_file_line+' '+hs;
-{$endif NEWINPUT}
       { add the message to the text }
       { add the message to the text }
         hs:=hs+s;
         hs:=hs+s;
 {$ifdef FPC}
 {$ifdef FPC}
-        if UseStdErr and (Level<$100) then
+        if UseStdErr then
          begin
          begin
            writeln(stderr,hs);
            writeln(stderr,hs);
            flush(stderr);
            flush(stderr);
@@ -193,7 +185,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  1998-07-07 11:20:19  peter
+  Revision 1.13  1998-07-14 14:47:12  peter
+    * released NEWINPUT
+
+  Revision 1.12  1998/07/07 11:20:19  peter
     + NEWINPUT for a better inputfile and scanner object
     + NEWINPUT for a better inputfile and scanner object
 
 
   Revision 1.11  1998/06/19 15:40:00  peter
   Revision 1.11  1998/06/19 15:40:00  peter

+ 16 - 23
compiler/verbose.pas

@@ -33,22 +33,23 @@ uses messages;
 
 
 Const
 Const
   MaxErrorCount : longint = 50;
   MaxErrorCount : longint = 50;
-{ <$100 can include file and linenr info }
+{ <$10000 will show file and line }
   V_Fatal       = $0;
   V_Fatal       = $0;
   V_Error       = $1;
   V_Error       = $1;
-  V_Normal      = $2;
+  V_Normal      = $2; { doesn't show a text like Error: }
   V_Warning     = $4;
   V_Warning     = $4;
   V_Note        = $8;
   V_Note        = $8;
   V_Hint        = $10;
   V_Hint        = $10;
-  V_Info        = $100;
-  V_Status      = $200;
-  V_Used        = $400;
-  V_Tried       = $800;
-  V_Macro       = $1000;
-  V_Procedure   = $2000;
-  V_Conditional = $4000;
-  V_Debug       = $8000;
-
+  V_Macro       = $100;
+  V_Procedure   = $200;
+  V_Conditional = $400;
+  V_Info        = $10000;
+  V_Status      = $20000;
+  V_Used        = $40000;
+  V_Tried       = $80000;
+  V_Debug       = $100000;
+
+  V_ShowFile    = $ffff;
   V_All         = $ffffffff;
   V_All         = $ffffffff;
   V_Default     = V_Fatal + V_Error + V_Normal;
   V_Default     = V_Fatal + V_Error + V_Normal;
 
 
@@ -97,10 +98,7 @@ var
 
 
 implementation
 implementation
 uses
 uses
-{$ifdef NEWINPUT}
   files,
   files,
-{$endif}
-
   globals;
   globals;
 
 
 procedure LoadMsgFile(const fn:string);
 procedure LoadMsgFile(const fn:string);
@@ -233,11 +231,9 @@ begin
   if (l and V_Error)<>0 then
   if (l and V_Error)<>0 then
    inc(status.errorcount);
    inc(status.errorcount);
 { fix status }
 { fix status }
-{$ifdef NEWINPUT}
   status.currentline:=aktfilepos.line;
   status.currentline:=aktfilepos.line;
   status.currentcolumn:=aktfilepos.column;
   status.currentcolumn:=aktfilepos.column;
   if assigned(current_module) and
   if assigned(current_module) and
-
      ((current_module^.unit_index<>lastmoduleidx) or
      ((current_module^.unit_index<>lastmoduleidx) or
       (current_module^.current_index<>lastfileidx)) then
       (current_module^.current_index<>lastfileidx)) then
    begin
    begin
@@ -245,8 +241,6 @@ begin
      lastmoduleidx:=current_module^.unit_index;
      lastmoduleidx:=current_module^.unit_index;
      lastfileidx:=current_module^.current_index;
      lastfileidx:=current_module^.current_index;
    end;
    end;
-
-{$endif}
 { show comment }
 { show comment }
   if do_comment(l,s) or dostop or (status.errorcount>=maxerrorcount) then
   if do_comment(l,s) or dostop or (status.errorcount>=maxerrorcount) then
    stop
    stop
@@ -300,11 +294,9 @@ begin
   Replace(s,'$VER',version_string);
   Replace(s,'$VER',version_string);
   Replace(s,'$TARGET',target_string);
   Replace(s,'$TARGET',target_string);
 { fix status }
 { fix status }
-{$ifdef NEWINPUT}
   status.currentline:=aktfilepos.line;
   status.currentline:=aktfilepos.line;
   status.currentcolumn:=aktfilepos.column;
   status.currentcolumn:=aktfilepos.column;
   if assigned(current_module) and
   if assigned(current_module) and
-
      ((current_module^.unit_index<>lastmoduleidx) or
      ((current_module^.unit_index<>lastmoduleidx) or
       (current_module^.current_index<>lastfileidx)) then
       (current_module^.current_index<>lastfileidx)) then
    begin
    begin
@@ -312,8 +304,6 @@ begin
      lastmoduleidx:=current_module^.unit_index;
      lastmoduleidx:=current_module^.unit_index;
      lastfileidx:=current_module^.current_index;
      lastfileidx:=current_module^.current_index;
    end;
    end;
-
-{$endif}
 { show comment }
 { show comment }
   if do_comment(v,s) or dostop or (status.errorcount>=maxerrorcount) then
   if do_comment(v,s) or dostop or (status.errorcount>=maxerrorcount) then
    stop;
    stop;
@@ -352,7 +342,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.10  1998-07-07 12:32:56  peter
+  Revision 1.11  1998-07-14 14:47:13  peter
+    * released NEWINPUT
+
+  Revision 1.10  1998/07/07 12:32:56  peter
     * status.currentsource is now calculated in verbose (more accurated)
     * status.currentsource is now calculated in verbose (more accurated)
 
 
   Revision 1.9  1998/07/07 11:20:20  peter
   Revision 1.9  1998/07/07 11:20:20  peter