mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 01:29:19 +02:00
* resursive macro's fixed in preprocessor
This commit is contained in:
parent
fa8ec60ee6
commit
25213e4efb
@ -333,26 +333,38 @@ implementation
|
|||||||
var
|
var
|
||||||
hs: string;
|
hs: string;
|
||||||
mac : tmacro;
|
mac : tmacro;
|
||||||
|
macrocount,
|
||||||
len : integer;
|
len : integer;
|
||||||
begin
|
begin
|
||||||
preproc_substitutedtoken := current_scanner.preproc_pattern;
|
result := current_scanner.preproc_pattern;
|
||||||
mac:=tmacro(current_scanner.macros.search(preproc_substitutedtoken));
|
{ allow macro support in macro's }
|
||||||
if assigned(mac) then
|
macrocount:=0;
|
||||||
begin
|
repeat
|
||||||
if mac.defined and assigned(mac.buftext) then
|
mac:=tmacro(current_scanner.macros.search(result));
|
||||||
begin
|
if not assigned(mac) then
|
||||||
if mac.buflen>255 then
|
break;
|
||||||
|
|
||||||
|
inc(macrocount);
|
||||||
|
if macrocount>max_macro_nesting then
|
||||||
begin
|
begin
|
||||||
len:=255;
|
Message(scan_w_macro_deep_ten);
|
||||||
Message(scan_w_macro_cut_after_255_chars);
|
break;
|
||||||
end
|
end;
|
||||||
else
|
|
||||||
len:=mac.buflen;
|
if mac.defined and assigned(mac.buftext) then
|
||||||
hs[0]:=char(len);
|
begin
|
||||||
move(mac.buftext^,hs[1],len);
|
if mac.buflen>255 then
|
||||||
preproc_substitutedtoken:=upcase(hs);
|
begin
|
||||||
end;
|
len:=255;
|
||||||
end;
|
Message(scan_w_macro_cut_after_255_chars);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
len:=mac.buflen;
|
||||||
|
hs[0]:=char(len);
|
||||||
|
move(mac.buftext^,hs[1],len);
|
||||||
|
result:=upcase(hs);
|
||||||
|
end;
|
||||||
|
until false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function read_factor : string;
|
function read_factor : string;
|
||||||
@ -1717,7 +1729,7 @@ implementation
|
|||||||
readnumber;
|
readnumber;
|
||||||
readval_asstring:=pattern;
|
readval_asstring:=pattern;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tscannerfile.readcomment:string;
|
function tscannerfile.readcomment:string;
|
||||||
var
|
var
|
||||||
@ -2968,7 +2980,10 @@ exit_label:
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.71 2004-02-25 00:54:47 olle
|
Revision 1.72 2004-02-26 16:15:45 peter
|
||||||
|
* resursive macro's fixed in preprocessor
|
||||||
|
|
||||||
|
Revision 1.71 2004/02/25 00:54:47 olle
|
||||||
+ mode mac: preproc support for hexadecimal numbers
|
+ mode mac: preproc support for hexadecimal numbers
|
||||||
+ mode mac: preproc support for TRUE, FALSE
|
+ mode mac: preproc support for TRUE, FALSE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user