Program ClipperFilter;

Var
  Line   : String;
  Msg    : String;
  Source : Text;
  Row    : Word;
  Col    : Word;
  Index  : Word;
  Result : Integer;
  FileName : String;

Begin
  FileName := '';
  Assign(Source,ParamStr(1));
  {$I-}
  Reset(Source);
  {$I+}
  If IOResult <> 0 Then Halt(0);
  While Not Eof(Source) Do
  Begin
    ReadLn(Source,Line);
    If (Pos('Compiling ',Line) > 0) And (FileName = '')
      Then Begin
        While Line[1] = ' ' Do Delete(Line,1,1);
        Delete(Line,1,10);
        FileName := Line;
      End
    Else If Pos('line ',Line) = 1 Then
    Begin
      Delete(Line,1,5);
      Index := Pos(':',Line);
      If Index > 0 Then
      Begin
        Val(Copy(Line,1,Pred(Index)),Row,Result);
        If Result = 0 Then
        Begin
          Delete(Line,1,Index+2);
          Msg := Line;
          ReadLn(Source,Line);
          ReadLn(Source,Line);
          Col := Pos('^',Line);
          WriteLn(FileName,', ',Row,', ',Col,', ',Msg);
        End;
      End;
    End;
  End;
  Close(Source);
  Erase(Source);
End.
