generate more verbose messages in case of PPU/unit not found

git-svn-id: trunk@4817 -
This commit is contained in:
micha 2006-10-07 09:23:38 +00:00
parent 88e00bd264
commit 97722babad
2 changed files with 87 additions and 39 deletions

View File

@ -43,6 +43,7 @@ interface
tppumodule = class(tmodule)
ppufile : tcompilerppufile; { the PPU file }
sourcefn : pstring; { Source specified with "uses .. in '..'" }
comments : tstringlist;
{$ifdef Test_Double_checksum}
crc_array : pointer;
crc_size : longint;
@ -63,6 +64,8 @@ interface
procedure load_implementation;
procedure load_symtable_refs;
procedure load_usedunits;
procedure printcomments;
procedure queuecomment(s:string;v,w:longint);
procedure writesourcefiles;
procedure writeusedunit(intf:boolean);
procedure writelinkcontainer(var p:tlinkcontainer;id:byte;strippath:boolean);
@ -93,7 +96,8 @@ uses
symtable, symsym,
scanner,
aasmbase,ogbase,
parser;
parser,
comphook;
{****************************************************************************
Helpers
@ -131,6 +135,8 @@ uses
if assigned(ppufile) then
ppufile.free;
ppufile:=nil;
comments.free;
comments:=nil;
stringdispose(sourcefn);
inherited Destroy;
end;
@ -146,13 +152,34 @@ uses
inherited reset;
end;
procedure tppumodule.queuecomment(s:string;v,w:longint);
begin
if comments = nil then
comments := tstringlist.create;
comments.insert(s);
end;
procedure tppumodule.printcomments;
var
comment: string;
begin
if comments = nil then
exit;
{ comments are inserted in reverse order }
repeat
comment := comments.getlast;
if length(comment) = 0 then
exit;
do_comment(v_normal, comment);
until false;
end;
function tppumodule.openppu:boolean;
var
ppufiletime : longint;
begin
openppu:=false;
Message1(unit_t_ppu_loading,ppufilename^);
Message1(unit_t_ppu_loading,ppufilename^,@queuecomment);
{ Get ppufile time (also check if the file exists) }
ppufiletime:=getnamedfiletime(ppufilename^);
if ppufiletime=-1 then
@ -178,7 +205,7 @@ uses
{ check for allowed PPU versions }
if not (ppufile.GetPPUVersion = CurrentPPUVersion) then
begin
Message1(unit_u_ppu_invalid_version,tostr(ppufile.GetPPUVersion));
Message1(unit_u_ppu_invalid_version,tostr(ppufile.GetPPUVersion),@queuecomment);
ppufile.free;
ppufile:=nil;
exit;
@ -188,7 +215,7 @@ uses
begin
ppufile.free;
ppufile:=nil;
Message(unit_u_ppu_invalid_processor);
Message(unit_u_ppu_invalid_processor,@queuecomment);
exit;
end;
{ check target }
@ -196,7 +223,7 @@ uses
begin
ppufile.free;
ppufile:=nil;
Message(unit_u_ppu_invalid_target);
Message(unit_u_ppu_invalid_target,@queuecomment);
exit;
end;
{$ifdef cpufpemu}
@ -1211,7 +1238,7 @@ uses
(pu.u.crc<>pu.checksum)
) then
begin
Message2(unit_u_recompile_crc_change,realmodulename^,pu.u.realmodulename^);
Message2(unit_u_recompile_crc_change,realmodulename^,pu.u.realmodulename^,@queuecomment);
recompile_reason:=rr_crcchanged;
do_compile:=true;
exit;
@ -1256,7 +1283,7 @@ uses
{ need to recompile the current unit ? }
if (pu.u.interface_crc<>pu.interface_checksum) then
begin
Message2(unit_u_recompile_crc_change,realmodulename^,pu.u.realmodulename^+' {impl}');
Message2(unit_u_recompile_crc_change,realmodulename^,pu.u.realmodulename^+' {impl}',@queuecomment);
recompile_reason:=rr_crcchanged;
do_compile:=true;
exit;
@ -1445,12 +1472,19 @@ uses
search_unit(true,true);
if not(sources_avail) then
begin
printcomments;
if recompile_reason=rr_noppu then
Message1(unit_f_cant_find_ppu,realmodulename^)
else
Message1(unit_f_cant_compile_unit,realmodulename^);
end;
end;
{ we found the sources, we do not need the verbose messages anymore }
if comments <> nil then
begin
comments.free;
comments:=nil;
end;
{ Flag modules to reload }
flagdependent(old_current_module);
{ Reset the module }

View File

@ -68,6 +68,9 @@ interface
var
msg : pmessage;
type
tmsgqueueevent = procedure(s:string;v,w:longint) of object;
const
msgfilename : string = '';
@ -84,16 +87,16 @@ interface
procedure Internalerror(i:longint);
procedure Comment(l:longint;s:string);
function MessagePchar(w:longint):pchar;
procedure Message(w:longint);
procedure Message1(w:longint;const s1:string);
procedure Message2(w:longint;const s1,s2:string);
procedure Message3(w:longint;const s1,s2,s3:string);
procedure Message4(w:longint;const s1,s2,s3,s4:string);
procedure MessagePos(const pos:tfileposinfo;w:longint);
procedure MessagePos1(const pos:tfileposinfo;w:longint;const s1:string);
procedure MessagePos2(const pos:tfileposinfo;w:longint;const s1,s2:string);
procedure MessagePos3(const pos:tfileposinfo;w:longint;const s1,s2,s3:string);
procedure MessagePos4(const pos:tfileposinfo;w:longint;const s1,s2,s3,s4:string);
procedure Message(w:longint;onqueue:tmsgqueueevent=nil);
procedure Message1(w:longint;const s1:string;onqueue:tmsgqueueevent=nil);
procedure Message2(w:longint;const s1,s2:string;onqueue:tmsgqueueevent=nil);
procedure Message3(w:longint;const s1,s2,s3:string;onqueue:tmsgqueueevent=nil);
procedure Message4(w:longint;const s1,s2,s3,s4:string;onqueue:tmsgqueueevent=nil);
procedure MessagePos(const pos:tfileposinfo;w:longint;onqueue:tmsgqueueevent=nil);
procedure MessagePos1(const pos:tfileposinfo;w:longint;const s1:string;onqueue:tmsgqueueevent=nil);
procedure MessagePos2(const pos:tfileposinfo;w:longint;const s1,s2:string;onqueue:tmsgqueueevent=nil);
procedure MessagePos3(const pos:tfileposinfo;w:longint;const s1,s2,s3:string;onqueue:tmsgqueueevent=nil);
procedure MessagePos4(const pos:tfileposinfo;w:longint;const s1,s2,s3,s4:string;onqueue:tmsgqueueevent=nil);
{ message calls with codegenerror support }
procedure cgmessage(t : longint);
@ -486,13 +489,15 @@ var
end;
Procedure Msg2Comment(s:string);
Procedure Msg2Comment(s:string;w:longint;onqueue:tmsgqueueevent);
var
idx,i,v : longint;
dostop : boolean;
doqueue : boolean;
begin
{Reset}
dostop:=false;
doqueue:=false;
v:=0;
{Parse options}
idx:=pos('_',s);
@ -564,13 +569,22 @@ var
Delete(s,1,idx);
{ check verbosity level }
if not CheckVerbosity(v) then
exit;
begin
doqueue := onqueue <> nil;
if not doqueue then
exit;
end;
if (v and V_LineInfoMask)<>0 then
v:=v or V_LineInfo;
{ fix status }
UpdateStatus;
{ Fix replacements }
DefaultReplacements(s);
if doqueue then
begin
onqueue(s,v,w);
exit;
end;
{ show comment }
if do_comment(v,s) or dostop then
raise ECompilerAbort.Create;
@ -590,98 +604,98 @@ var
end;
procedure Message(w:longint);
procedure Message(w:longint;onqueue:tmsgqueueevent=nil);
begin
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[]));
Msg2Comment(msg^.Get(w,[]),w,onqueue);
end;
procedure Message1(w:longint;const s1:string);
procedure Message1(w:longint;const s1:string;onqueue:tmsgqueueevent=nil);
begin
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1]));
Msg2Comment(msg^.Get(w,[s1]),w,onqueue);
end;
procedure Message2(w:longint;const s1,s2:string);
procedure Message2(w:longint;const s1,s2:string;onqueue:tmsgqueueevent=nil);
begin
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1,s2]));
Msg2Comment(msg^.Get(w,[s1,s2]),w,onqueue);
end;
procedure Message3(w:longint;const s1,s2,s3:string);
procedure Message3(w:longint;const s1,s2,s3:string;onqueue:tmsgqueueevent=nil);
begin
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1,s2,s3]));
Msg2Comment(msg^.Get(w,[s1,s2,s3]),w,onqueue);
end;
procedure Message4(w:longint;const s1,s2,s3,s4:string);
procedure Message4(w:longint;const s1,s2,s3,s4:string;onqueue:tmsgqueueevent=nil);
begin
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1,s2,s3,s4]));
Msg2Comment(msg^.Get(w,[s1,s2,s3,s4]),w,onqueue);
end;
procedure MessagePos(const pos:tfileposinfo;w:longint);
procedure MessagePos(const pos:tfileposinfo;w:longint;onqueue:tmsgqueueevent=nil);
var
oldpos : tfileposinfo;
begin
oldpos:=aktfilepos;
aktfilepos:=pos;
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[]));
Msg2Comment(msg^.Get(w,[]),w,onqueue);
aktfilepos:=oldpos;
end;
procedure MessagePos1(const pos:tfileposinfo;w:longint;const s1:string);
procedure MessagePos1(const pos:tfileposinfo;w:longint;const s1:string;onqueue:tmsgqueueevent=nil);
var
oldpos : tfileposinfo;
begin
oldpos:=aktfilepos;
aktfilepos:=pos;
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1]));
Msg2Comment(msg^.Get(w,[s1]),w,onqueue);
aktfilepos:=oldpos;
end;
procedure MessagePos2(const pos:tfileposinfo;w:longint;const s1,s2:string);
procedure MessagePos2(const pos:tfileposinfo;w:longint;const s1,s2:string;onqueue:tmsgqueueevent=nil);
var
oldpos : tfileposinfo;
begin
oldpos:=aktfilepos;
aktfilepos:=pos;
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1,s2]));
Msg2Comment(msg^.Get(w,[s1,s2]),w,onqueue);
aktfilepos:=oldpos;
end;
procedure MessagePos3(const pos:tfileposinfo;w:longint;const s1,s2,s3:string);
procedure MessagePos3(const pos:tfileposinfo;w:longint;const s1,s2,s3:string;onqueue:tmsgqueueevent=nil);
var
oldpos : tfileposinfo;
begin
oldpos:=aktfilepos;
aktfilepos:=pos;
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1,s2,s3]));
Msg2Comment(msg^.Get(w,[s1,s2,s3]),w,onqueue);
aktfilepos:=oldpos;
end;
procedure MessagePos4(const pos:tfileposinfo;w:longint;const s1,s2,s3,s4:string);
procedure MessagePos4(const pos:tfileposinfo;w:longint;const s1,s2,s3,s4:string;onqueue:tmsgqueueevent=nil);
var
oldpos : tfileposinfo;
begin
oldpos:=aktfilepos;
aktfilepos:=pos;
MaybeLoadMessageFile;
Msg2Comment(msg^.Get(w,[s1,s2,s3,s4]));
Msg2Comment(msg^.Get(w,[s1,s2,s3,s4]),w,onqueue);
aktfilepos:=oldpos;
end;