Expand file tree Collapse file tree 3 files changed +81
-23
lines changed Original file line number Diff line number Diff line change 43
43
44
44
set -e
45
45
46
- export ARTISTIC_STYLE_OPTIONS=" \
47
- --preserve-date \
48
- --indent-preprocessor \
49
- --brackets=break \
50
- --convert-tabs \
51
- --indent=spaces=2 \
52
- --indent-classes \
53
- --indent-labels \
54
- --indent-namespaces \
55
- --indent-switches \
56
- --one-line=keep-blocks \
57
- --one-line=keep-statements \
58
- --max-instatement-indent=40 \
59
- --min-conditional-indent=-1 \
60
- --suffix=none"
61
-
62
- export ARTISTIC_STYLE_OPTIONS=" \
63
- $ARTISTIC_STYLE_OPTIONS \
64
- --pad=oper \
65
- --pad=paren-in \
66
- --unpad=paren"
46
+ astyleit ()
47
+ {
48
+ scripts/sort_includes.pl " $1 "
49
+
50
+ $ASTYLE \
51
+ --preserve-date \
52
+ --indent-preprocessor \
53
+ --brackets=break \
54
+ --convert-tabs \
55
+ --indent=spaces=2 \
56
+ --indent-classes \
57
+ --indent-labels \
58
+ --indent-namespaces \
59
+ --indent-switches \
60
+ --one-line=keep-blocks \
61
+ --one-line=keep-statements \
62
+ --max-instatement-indent=40 \
63
+ --min-conditional-indent=-1 \
64
+ --suffix=none \
65
+ --pad=oper \
66
+ --pad=paren-in \
67
+ --unpad=paren " $1 "
68
+ }
67
69
68
70
for f in " $@ " ; do
69
71
case " $f " in
@@ -73,7 +75,7 @@ for f in "$@"; do
73
75
;;
74
76
75
77
* .cpp|* .h|* .c|* .h|* .cxx|* .hxx|* .c++|* .h++|* .cc|* .hh|* .C|* .H|* .hpp)
76
- cmd=" $ASTYLE $ARTISTIC_STYLE_OPTIONS "
78
+ cmd=astyleit
77
79
;;
78
80
79
81
* .ui|* .qgm|* .txt|* .t2t|resources/context_help/* )
Original file line number Diff line number Diff line change 31
31
32
32
if [ " $1 " = " -c" ]; then
33
33
echo " Cleaning..."
34
- find . \( -name " *.prepare" -o -name " *.astyle" -o -name " *.nocopyright" -o -name " astyle.*.diff" -o -name " sha-*.diff" \) -print -delete
34
+ find . \( -name " *.prepare" -o -name " *.astyle" -o -name " *.nocopyright" -o -name " astyle.*.diff" -o -name " sha-*.diff" -o -name " *.sortinc " \) -print -delete
35
35
fi
36
36
37
37
set -e
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl -i.sortinc -n
2
+ # ##########################################################################
3
+ # sort_includes.pl
4
+ # ---------------------
5
+ # begin : June 2015
6
+ # copyright : (C) 2015 by Juergen E. Fischer
7
+ # email : jef at norbit dot de
8
+ #
9
+ # ##########################################################################
10
+ # #
11
+ # This program is free software; you can redistribute it and/or modify #
12
+ # it under the terms of the GNU General Public License as published by #
13
+ # the Free Software Foundation; either version 2 of the License, or #
14
+ # (at your option) any later version. #
15
+ # #
16
+ # ##########################################################################
17
+
18
+ # adapted from scripts/sort_includes.sh
19
+
20
+ use strict;
21
+ use warnings;
22
+
23
+ our %uis ;
24
+ our %sys ;
25
+ our %others ;
26
+ our $sorting ;
27
+
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;
40
+ next ;
41
+ }
42
+
43
+ if ( $sorting ) {
44
+ print foreach sort keys %uis ;
45
+ print foreach sort keys %sys ;
46
+ print foreach sort keys %others ;
47
+
48
+ undef %uis ;
49
+ undef %sys ;
50
+ undef %others ;
51
+ }
52
+
53
+
54
+ $sorting =0;
55
+
56
+ print ;
0 commit comments