|
1 # Copyright (c) 2009 Symbian Foundation Ltd |
|
2 # This component and the accompanying materials are made available |
|
3 # under the terms of the License "Eclipse Public License v1.0" |
|
4 # which accompanies this distribution, and is available |
|
5 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
6 # |
|
7 # Initial Contributors: |
|
8 # Symbian Foundation Ltd - initial contribution. |
|
9 # |
|
10 # Contributors: |
|
11 # |
|
12 # Description: |
|
13 # Raptor parser module. |
|
14 # Extract, analyzes and dumps text in <buildlog> context which doesn't belong to any <recipe> tags |
|
15 |
|
16 package RaptorUnreciped; |
|
17 |
|
18 use strict; |
|
19 use RaptorCommon; |
|
20 |
|
21 our $reset_status = {}; |
|
22 my $buildlog_status = {}; |
|
23 my $buildlog_subtag_status = {}; |
|
24 |
|
25 $reset_status->{name} = 'reset_status'; |
|
26 $reset_status->{next_status} = {buildlog=>$buildlog_status}; |
|
27 |
|
28 $buildlog_status->{name} = 'buildlog_status'; |
|
29 $buildlog_status->{next_status} = {'?default?'=>$buildlog_subtag_status}; |
|
30 $buildlog_status->{on_start} = 'RaptorUnreciped::on_start_buildlog'; |
|
31 $buildlog_status->{on_end} = 'RaptorUnreciped::on_end_buildlog'; |
|
32 $buildlog_status->{on_chars} = 'RaptorUnreciped::on_chars_buildlog'; |
|
33 |
|
34 $buildlog_subtag_status->{name} = 'buildlog_subtag_status'; |
|
35 $buildlog_subtag_status->{next_status} = {}; |
|
36 |
|
37 my $characters = ''; |
|
38 |
|
39 sub on_start_buildlog |
|
40 { |
|
41 my $filename = "$::basedir/unreciped.txt"; |
|
42 print "Writing unreciped file $filename\n" if (!-f$filename); |
|
43 open(FILE, ">>$filename"); |
|
44 } |
|
45 |
|
46 sub on_chars_buildlog |
|
47 { |
|
48 my ($ch) = @_; |
|
49 |
|
50 my $characters = $ch->{Data}; |
|
51 |
|
52 print FILE $characters if ($characters =~ m,[^\s^\r^\n],); |
|
53 |
|
54 #print "characters is now -->$characters<--\n"; |
|
55 } |
|
56 |
|
57 sub on_end_buildlog |
|
58 { |
|
59 close(FILE); |
|
60 } |
|
61 |
|
62 |
|
63 1; |