2011-03-31 8 views
1

Delphi 2010 명령 줄 컴파일러 (dcc32.exe) 줄 번호를 파이프의 GUI 응용 프로그램 진행 표시 줄로 다시 전달할 수있는 방법이 있습니까? JEDI JVCL 설치에Delphi 2010 Comandline 컴파일러 줄 번호 얻기

C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(20) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(339) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(341) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(512) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(1024) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(1536) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(2048) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(2560) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(3072) 
C:\Components\Dabbler\Pipes\Demos\Demo3\TestUnit\uGlobal.pas(3342) 

답변

6

봐 : 좋은 기능은 다음 문자열에서 (행 번호)를 호출하는 것입니다 무엇을 대안으로

. 그것은 정확히 이것을 수행하며 오픈 소스이므로 어떻게 완료되었는지 확인할 수 있습니다.

+0

+1 JCL 및/또는 JVCL 소스 설치 프로그램을 확인하는 것이 좋습니다. ;) – RRUZ

2

줄 끝까지 탐색하십시오. 거기에있는 문자는 닫는 괄호 여야합니다. 여는 괄호까지 뒤로 탐색하십시오. 건너 뛴 문자가 줄 번호입니다.

function ExtractLineNumber(const Line: string): Integer; 
var 
    i, len: Integer; 
begin 
    i := Length(Line); 
    Assert(Line[i] = ')', 'unexpected line format'); 
    len := -1; 
    while (i > 0) and (Line[i] <> '(') do begin 
    Dec(i); 
    Inc(len); 
    end; 
    Assert(i > 0, 'unexpected line format'); 
    Assert(len > 0, 'unexpected line format'); 
    Result := StrToInt(Copy(Line, i + 1, len)); 
end; 
+0

+1, 다른 방법은 정규식을 사용하는 것입니다. –

+0

몇 가지 테스트를 한 후 정규식을 사용하는 것처럼 경고, 힌트 및 기타 출력이 생성 될 때 ExtractLineNumber의 오류를 제거하는 방법이 있습니다. 모두에게 감사드립니다. – Bill