File tree 2 files changed +13
-30
lines changed
2 files changed +13
-30
lines changed Original file line number Diff line number Diff line change 45
45
46
46
astyleit ()
47
47
{
48
- scripts/sort_includes.pl " $1 "
49
-
50
48
$ASTYLE \
51
49
--preserve-date \
52
50
--indent-preprocessor \
@@ -65,6 +63,8 @@ astyleit()
65
63
--pad=oper \
66
64
--pad=paren-in \
67
65
--unpad=paren " $1 "
66
+
67
+ scripts/unify_includes.pl " $1 "
68
68
}
69
69
70
70
for f in " $@ " ; do
Original file line number Diff line number Diff line change 1
1
# !/usr/bin/perl -i.sortinc -n
2
2
# ##########################################################################
3
- # sort_includes .pl
3
+ # unify_includes .pl
4
4
# ---------------------
5
5
# begin : June 2015
6
6
# copyright : (C) 2015 by Juergen E. Fischer
20
20
use strict;
21
21
use warnings;
22
22
23
- our %uis ;
24
- our %sys ;
25
- our %others ;
26
- our $sorting ;
23
+ our %inc ;
24
+ our @inc ;
27
25
28
- BEGIN { $sorting = 0; }
29
- END { die " header files not empty" if keys %uis || keys %sys || keys %others ; }
30
-
31
- if (/ ^\s *#include/ ) {
32
- if (/ "ui_/ ) {
33
- $uis {$_ }=1;
34
- } elsif (/ </ ) {
35
- $sys {$_ }=1;
36
- } else {
37
- $others {$_ }=1;
38
- }
39
- $sorting =1;
26
+ END { die " header files not empty" if @inc ; }
40
27
28
+ if ( / ^\s *#include/ ) {
29
+ push @inc , $_ unless exists $inc {$_ };
30
+ $inc {$_ }=1;
41
31
next unless eof ;
42
32
}
43
33
44
- if ( $sorting ) {
45
- print foreach sort keys %uis ;
46
- print foreach sort keys %sys ;
47
- print foreach sort keys %others ;
48
-
49
- undef %uis ;
50
- undef %sys ;
51
- undef %others ;
52
-
34
+ if ( %inc ) {
35
+ print foreach @inc ;
36
+ undef %inc ;
37
+ undef @inc ;
53
38
last if eof ;
54
39
}
55
40
56
- $sorting =0;
57
-
58
41
print ;
You can’t perform that action at this time.
0 commit comments