| 
									
										
										
										
											2014-01-17 17:11:46 +01:00
										 |  |  | #!/usr/bin/perl -w | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-15 14:52:30 +01:00
										 |  |  | # Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							| 
									
										
										
										
											2022-08-19 15:59:36 +02:00
										 |  |  | # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0 | 
					
						
							| 
									
										
										
										
											2016-01-15 14:52:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-17 17:11:46 +01:00
										 |  |  | =head1 NAME | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | purify2tasks.pl - Convert Rational Purify logs into Qt Creator task files. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =head1 SYNOPSIS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     purify2tasks.pl < logfile > taskfile | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | =cut | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use strict; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | my $lastMessage = ''; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | while (my $line = <STDIN> ) { | 
					
						
							|  |  |  |     chomp($line); | 
					
						
							|  |  |  |     # --- extract file name based matching: | 
					
						
							|  |  |  |     # Classname::function [c:\path\file.cpp:389] | 
					
						
							|  |  |  |     if ($line =~ / \[(.*:\d+)\]$/) { | 
					
						
							|  |  |  |         my $capture = $1; | 
					
						
							|  |  |  |         my $lastColon = rindex($capture, ':'); | 
					
						
							|  |  |  |         my $fileName = substr($capture, 0, $lastColon); | 
					
						
							|  |  |  |         my $lineNumber = substr($capture, $lastColon + 1); | 
					
						
							|  |  |  |         $fileName =~ s|\\|/|g; | 
					
						
							|  |  |  |         print $fileName, "\t", $lineNumber, "\tpurify\t", $lastMessage,"\n"; | 
					
						
							|  |  |  |     # match a warning/error report | 
					
						
							|  |  |  |     } elsif ($line =~ /^\[[W|E|I]\] /) { | 
					
						
							|  |  |  |         $lastMessage = substr($line, 4); | 
					
						
							| 
									
										
										
										
											2016-11-10 11:19:38 +01:00
										 |  |  |         $lastMessage =~ s/\\/\\\\/g; | 
					
						
							| 
									
										
										
										
											2014-01-17 17:11:46 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } |