mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 15:59:28 +01:00 
			
		
		
		
	* fixed macro within macro endless-loop
This commit is contained in:
		
							parent
							
								
									1936476701
								
							
						
					
					
						commit
						eb72952214
					
				@ -444,6 +444,12 @@ uses
 | 
				
			|||||||
        tempopen:=false;
 | 
					        tempopen:=false;
 | 
				
			||||||
        if is_macro then
 | 
					        if is_macro then
 | 
				
			||||||
         begin
 | 
					         begin
 | 
				
			||||||
 | 
					           { seek buffer postion to bufstart }
 | 
				
			||||||
 | 
					           if bufstart>0 then
 | 
				
			||||||
 | 
					            begin
 | 
				
			||||||
 | 
					              move(buf[bufstart],buf[0],bufsize-bufstart+1);
 | 
				
			||||||
 | 
					              bufstart:=0;
 | 
				
			||||||
 | 
					            end;
 | 
				
			||||||
           tempopen:=true;
 | 
					           tempopen:=true;
 | 
				
			||||||
           exit;
 | 
					           exit;
 | 
				
			||||||
         end;
 | 
					         end;
 | 
				
			||||||
@ -593,6 +599,9 @@ uses
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    procedure tfilemanager.register_file(f : pinputfile);
 | 
					    procedure tfilemanager.register_file(f : pinputfile);
 | 
				
			||||||
      begin
 | 
					      begin
 | 
				
			||||||
 | 
					         { don't register macro's }
 | 
				
			||||||
 | 
					         if f^.is_macro then
 | 
				
			||||||
 | 
					          exit;
 | 
				
			||||||
         inc(last_ref_index);
 | 
					         inc(last_ref_index);
 | 
				
			||||||
         f^.ref_next:=files;
 | 
					         f^.ref_next:=files;
 | 
				
			||||||
         f^.ref_index:=last_ref_index;
 | 
					         f^.ref_index:=last_ref_index;
 | 
				
			||||||
@ -1331,7 +1340,10 @@ end;
 | 
				
			|||||||
end.
 | 
					end.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  $Log$
 | 
					  $Log$
 | 
				
			||||||
  Revision 1.103  1999-09-16 08:00:50  pierre
 | 
					  Revision 1.104  1999-09-27 23:40:12  peter
 | 
				
			||||||
 | 
					    * fixed macro within macro endless-loop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Revision 1.103  1999/09/16 08:00:50  pierre
 | 
				
			||||||
   + compiled_module to avoid wrong file info when load PPU files
 | 
					   + compiled_module to avoid wrong file info when load PPU files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Revision 1.102  1999/08/31 15:51:10  pierre
 | 
					  Revision 1.102  1999/08/31 15:51:10  pierre
 | 
				
			||||||
 | 
				
			|||||||
@ -94,7 +94,7 @@ unit scanner;
 | 
				
			|||||||
          procedure nextfile;
 | 
					          procedure nextfile;
 | 
				
			||||||
          procedure addfile(hp:pinputfile);
 | 
					          procedure addfile(hp:pinputfile);
 | 
				
			||||||
          procedure reload;
 | 
					          procedure reload;
 | 
				
			||||||
          procedure insertmacro(p:pchar;len:longint);
 | 
					          procedure insertmacro(const macname:string;p:pchar;len:longint);
 | 
				
			||||||
        { Scanner things }
 | 
					        { Scanner things }
 | 
				
			||||||
          procedure gettokenpos;
 | 
					          procedure gettokenpos;
 | 
				
			||||||
          procedure inc_comment_level;
 | 
					          procedure inc_comment_level;
 | 
				
			||||||
@ -143,7 +143,6 @@ implementation
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const
 | 
					    const
 | 
				
			||||||
      { use any special name that is an invalid file name to avoid problems }
 | 
					      { use any special name that is an invalid file name to avoid problems }
 | 
				
			||||||
      macro_special_name = '____Macro____';
 | 
					 | 
				
			||||||
      preprocstring : array [preproctyp] of string[7]
 | 
					      preprocstring : array [preproctyp] of string[7]
 | 
				
			||||||
        = ('$IFDEF','$IFNDEF','$IF','$IFOPT','$ELSE');
 | 
					        = ('$IFDEF','$IFNDEF','$IF','$IFOPT','$ELSE');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -341,8 +340,11 @@ implementation
 | 
				
			|||||||
         begin
 | 
					         begin
 | 
				
			||||||
           repeat
 | 
					           repeat
 | 
				
			||||||
           { still more to read?, then change the #0 to a space so its seen
 | 
					           { still more to read?, then change the #0 to a space so its seen
 | 
				
			||||||
             as a seperator }
 | 
					             as a seperator, this can't be used for macro's which can change
 | 
				
			||||||
             if (c=#0) and (bufsize>0) and (inputpointer-inputbuffer<bufsize) then
 | 
					             the place of the #0 in the buffer with tempopen }
 | 
				
			||||||
 | 
					             if (c=#0) and (bufsize>0) and
 | 
				
			||||||
 | 
					                not(inputfile^.is_macro) and
 | 
				
			||||||
 | 
					                (inputpointer-inputbuffer<bufsize) then
 | 
				
			||||||
              begin
 | 
					              begin
 | 
				
			||||||
                c:=' ';
 | 
					                c:=' ';
 | 
				
			||||||
                inc(longint(inputpointer));
 | 
					                inc(longint(inputpointer));
 | 
				
			||||||
@ -389,7 +391,7 @@ implementation
 | 
				
			|||||||
      end;
 | 
					      end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    procedure tscannerfile.insertmacro(p:pchar;len:longint);
 | 
					    procedure tscannerfile.insertmacro(const macname:string;p:pchar;len:longint);
 | 
				
			||||||
      var
 | 
					      var
 | 
				
			||||||
        hp : pinputfile;
 | 
					        hp : pinputfile;
 | 
				
			||||||
      begin
 | 
					      begin
 | 
				
			||||||
@ -400,7 +402,7 @@ implementation
 | 
				
			|||||||
        tempcloseinputfile;
 | 
					        tempcloseinputfile;
 | 
				
			||||||
      { create macro 'file' }
 | 
					      { create macro 'file' }
 | 
				
			||||||
        { use special name to dispose after !! }
 | 
					        { use special name to dispose after !! }
 | 
				
			||||||
        hp:=new(pinputfile,init(macro_special_name));
 | 
					        hp:=new(pinputfile,init('_Macro_.'+macname));
 | 
				
			||||||
        addfile(hp);
 | 
					        addfile(hp);
 | 
				
			||||||
        with inputfile^ do
 | 
					        with inputfile^ do
 | 
				
			||||||
         begin
 | 
					         begin
 | 
				
			||||||
@ -1102,7 +1104,7 @@ implementation
 | 
				
			|||||||
                 mac:=pmacrosym(macros^.search(pattern));
 | 
					                 mac:=pmacrosym(macros^.search(pattern));
 | 
				
			||||||
                 if assigned(mac) and (assigned(mac^.buftext)) then
 | 
					                 if assigned(mac) and (assigned(mac^.buftext)) then
 | 
				
			||||||
                  begin
 | 
					                  begin
 | 
				
			||||||
                    insertmacro(mac^.buftext,mac^.buflen);
 | 
					                    insertmacro(pattern,mac^.buftext,mac^.buflen);
 | 
				
			||||||
                  { handle empty macros }
 | 
					                  { handle empty macros }
 | 
				
			||||||
                    if c=#0 then
 | 
					                    if c=#0 then
 | 
				
			||||||
                     reload;
 | 
					                     reload;
 | 
				
			||||||
@ -1669,7 +1671,10 @@ exit_label:
 | 
				
			|||||||
end.
 | 
					end.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  $Log$
 | 
					  $Log$
 | 
				
			||||||
  Revision 1.95  1999-09-03 10:02:48  peter
 | 
					  Revision 1.96  1999-09-27 23:40:10  peter
 | 
				
			||||||
 | 
					    * fixed macro within macro endless-loop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Revision 1.95  1999/09/03 10:02:48  peter
 | 
				
			||||||
    * $IFNDEF is 7 chars and not 6 chars
 | 
					    * $IFNDEF is 7 chars and not 6 chars
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Revision 1.94  1999/09/02 18:47:47  daniel
 | 
					  Revision 1.94  1999/09/02 18:47:47  daniel
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user