This third revision with additional %FUNC% macro and 'unknown' strings changed to internalerror.
Regards Jörg
Index: scanner.pas =================================================================== --- scanner.pas (Revision 17417) +++ scanner.pas (Arbeitskopie) @@ -237,7 +237,7 @@ systems, switches, symbase,symtable,symtype,symsym,symconst,symdef,defutil, - fmodule; + procinfo,fmodule; var { dictionaries with the supported directives } @@ -1712,11 +1712,33 @@ hs:=getdatestr else if hs='FILE' then - hs:=current_module.sourcefiles.get_file_name(current_filepos.fileindex) + begin + hp:=ascend_from_macros(current_module.sourcefiles.get_file(current_filepos.fileindex)); + if assigned(hp) then hs:=hp.name^ else internalerror(201105101) + end else if hs='LINE' then - hs:=tostr(current_filepos.line) + begin + hp:=ascend_from_macros(current_module.sourcefiles.get_file(current_filepos.fileindex)); + if assigned(hp) then hs:=tostr(hp.saveline_no) else internalerror(201105102) + end else + if hs='PATH' then + begin + hp:=ascend_from_macros(current_module.sourcefiles.get_file(current_filepos.fileindex)); + if assigned(hp) then hs:=hp.path^ else internalerror(201105103); + if hs='' then hs:=CurDirRelPath(target_info) + end + else + if hs='FUNC' then + begin + if assigned(current_procinfo) then + if assigned(current_procinfo.procdef) then + if assigned(current_procinfo.procdef.procsym) then + hs:=current_procinfo.procdef.procsym.realname + else internalerror(201105104); + end + else if hs='FPCVERSION' then hs:=version_string else @@ -3473,7 +3495,7 @@ mac.is_used:=true; inc(yylexcount); insertmacro(pattern,mac.buftext,mac.buflen, - mac.fileinfo.line,mac.fileinfo.fileindex); + current_scanner.line_no,current_scanner.inputfile.ref_index); { handle empty macros } if c=#0 then reload; Index: fmodule.pas =================================================================== --- fmodule.pas (Revision 17417) +++ fmodule.pas (Arbeitskopie) @@ -235,6 +235,7 @@ function get_source_file(moduleindex,fileindex : longint) : tinputfile; procedure addloadedunit(hp:tmodule); function find_module_from_symtable(st:tsymtable):tmodule; + function ascend_from_macros(f:tinputfile) : tinputfile; implementation @@ -336,6 +337,13 @@ end; + function ascend_from_macros(f:tinputfile) : tinputfile; + begin + while assigned(f) and f.is_macro do f:=f.next; + ascend_from_macros:=f; + end; + + procedure addloadedunit(hp:tmodule); begin hp.moduleid:=loaded_units.count;
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel