efm_filter.pl 978 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env perl
  2. #
  3. # This program works as a filter that reads from stdin, copies to
  4. # stdout *and* creates an error file that can be read by vim.
  5. #
  6. # This program has only been tested on SGI, Irix5.3.
  7. #
  8. # Written by Ives Aerts in 1996. This little program is not guaranteed
  9. # to do (or not do) anything at all and can be freely used for
  10. # whatever purpose you can think of.
  11. $args = @ARGV;
  12. unless ($args == 1) {
  13. die("Usage: vimccparse <output filename>\n");
  14. }
  15. $filename = @ARGV[0];
  16. open (OUT, ">$filename") || die ("Can't open file: \"$filename\"");
  17. while (<STDIN>) {
  18. print;
  19. if ( (/"(.*)", line (\d+): (e)rror\((\d+)\):/)
  20. || (/"(.*)", line (\d+): (w)arning\((\d+)\):/) ) {
  21. $file=$1;
  22. $line=$2;
  23. $errortype="\u$3";
  24. $errornr=$4;
  25. chop($errormsg=<STDIN>);
  26. $errormsg =~ s/^\s*//;
  27. $sourceline=<STDIN>;
  28. $column=index(<STDIN>, "^") - 1;
  29. print OUT "$file>$line:$column:$errortype:$errornr:$errormsg\n";
  30. }
  31. }
  32. close(OUT);
  33. exit(0);