# Convert error output format of GHS compiler # # "PATH_FILE", line LINE_NUMBER: || #ERROR_NUMBER: ERRORTEXT # # in VS2005 error format (automatic open of file and curor at error line by double click on error output or by pressing F4) # # ../PATH_FILE(LINE_NUMBER) : GHS | [(catastrophic)] ERROR_NUMBER: ERRORTEXT # BEGIN { ErrLinePattern = "\", line [0-9]+: "; } END { } { # Replace the "\" character with "/" character in the first field. gsub(/\\/, "/", $1); if ($0 ~ ErrLinePattern) { Path = $1; # The variable VarAddPath is specified by calling the awk script. sub(/\"/, VarAddPath, Path); sub(/\",/, "", Path); ErrLine = $3; sub(/:/, "", ErrLine); #if (!/catastrophic error/) #{ short form of 'if !($0 ~ /catastrophic error/)' also possible 'if !($0 ~ "catastrophic error")' if ($4 != "catastrophic") { # standard errors sub(/error/, "GHS error ", $4); # standard warnings sub(/warning/, " GHS warning ", $4); ErrNr = $5; FirstErrTxt = " " $6; } else { # catastrophic errors sub(/catastrophic/, "GHS error (catastrophic) ", $4); ErrNr = $6; FirstErrTxt = "" } sub(/#/, "", ErrNr); Output = Path "(" ErrLine ") : " $4 ErrNr FirstErrTxt \ " " $7 " " $8 " " $9 \ " " $10 " " $11 " " $12 \ " " $13 " " $14 " " $15 \ "\n"; print(Output); } else { print($0); } }