From be291b2423c0ec87b5eecde6689da640e4f96080 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 20 Mar 2023 17:22:13 -0500 Subject: [PATCH] Show "Including ..." lines for all headers when using a sym file. Previously, only the last header from a group of headers represented together would be listed. --- Header.pas | 40 ++++++++++++++++++++++++++++++++-------- cc.notes | 2 ++ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Header.pas b/Header.pas index ff91a57..27665cb 100644 --- a/Header.pas +++ b/Header.pas @@ -1204,7 +1204,7 @@ type var done: boolean; {for loop termination test} typeDispList: typeDispPtr; {type displacement/pointer table} - includeFileName: gsosInStringPtr; {name of include file} + includesPtr: ptr; {ptr to includes section from sym file} i: 1..maxint; {loop/index variable} @@ -1305,7 +1305,6 @@ var while len > 0 do begin giRec.pCount := 7; giRec.pathname := pointer(ReadLongString); - includeFileName := giRec.pathname; {save name to print later} len := len - (giRec.pathname^.size + 18); GetFileInfoGS(giRec); if ToolError = 0 then begin @@ -1323,6 +1322,34 @@ var end; {DatesMatch} + procedure PrintIncludes; + + { Print "Including ..." lines for the headers } + + type + longptr = ^longint; + + var + dataPtr: ptr; {pointer to data from sym file} + endPtr: ptr; {pointer to end of includes section} + i: 1..maxint; {loop/index variable} + includeNamePtr: gsosInStringPtr; {pointer to an include file name} + + begin {PrintIncludes} + dataPtr := includesPtr; + endPtr := pointer(ord4(dataPtr) + longptr(dataPtr)^ + 4); + dataPtr := pointer(ord4(dataPtr) + 4); + while dataPtr <> endPtr do begin + includeNamePtr := gsosInStringPtr(dataPtr); + write('Including '); + for i := 1 to includeNamePtr^.size do + write(includeNamePtr^.theString[i]); + writeln; + dataPtr := pointer(ord4(dataPtr) + includeNamePtr^.size + 18); + end; {while} + end; {PrintIncludes} + + procedure ReadMacroTable; { Read macros from the symbol file } @@ -1980,14 +2007,11 @@ if not ignoreSymbols then begin PurgeSymbols; typeDispList := nil; while not done do begin + includesPtr := symPtr; if DatesMatch then begin if SourceMatches then begin - if progress then begin - write('Including '); - for i := 1 to includeFileName^.size do - write(includeFileName^.theString[i]); - writeln; - end; {if} + if progress then + PrintIncludes; ReadMacroTable; ReadSymbolTable; ReadPragmas; diff --git a/cc.notes b/cc.notes index e947a5d..eee8204 100644 --- a/cc.notes +++ b/cc.notes @@ -2150,6 +2150,8 @@ int foo(int[42]); 239. If a listing was produced using the +L option when a Defaults.h file was present, an extra blank first line would be listed (in ORCA/C 2.1) or the first line of the source file would be listed twice (in ORCA/C 2.2 betas). +240. If a .sym file was in use, ORCA/C might not print "Including ..." messages for certain header files. + -- Bugs from C 2.1.0 that have been fixed ----------------------------------- 1. In some situations, fread() reread the first 1K or so of the file.