function TForm1.linedebug(a:string):integer;
var linenumber,colnumber,messageseparator:integer;
string1,parse2,parse3,ki,sourcefile,errmessage:string;
begin
colnumber:=0;
messageseparator:= pos(': ',a);
errmessage:=copy(a,messageseparator,length(a));
string1:= copy (a,0,pos(': ',a)-1);
sourcefile:=copy(string1,0,pos(':',string1)-1);
ki:=copy(string1,pos(':',string1)+1,length(string1));
if pos(':',ki)<> 0 then
begin
parse2:=copy(ki,pos(':',ki)+1,length(ki));
parse3:=copy(ki,0,pos(':',ki)-1);
end else parse3:=ki;
linedebug:=strtoint(parse3);
except
on Exception : EConvertError do
linedebug:=-1;
end;
end;
Mengikut artikel "4.4 Formatting Error Messages" dari GNU Coding Standards, Error messages from compilers should look like this:
source-file-name:lineno: messageIf you want to mention the column number, use one of these formats:
source-file-name:lineno:column: message
source-file-name:lineno.column: message Source code yang saya kongsikan diatas adalah compatible dengan error message jenis pertama yang disertakan dengan column iaitu contohnya "coderama.c:50:20: declaration expected" dimana ia akan parse line number sebagai 50 dan column number sebagai 20 dan "coderama.c:15: declaration expected", line number sebagai 15 dan column sebagai 0. Terima kaseh. Selamat bercoderama!
Tiada ulasan: