mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
unify_includes.pl:
* renamed from sort_includes.pl * don't destroy order just remove duplicate includes * run after astyle
This commit is contained in:
parent
d077a1681c
commit
49286b304d
@ -45,8 +45,6 @@ set -e
|
|||||||
|
|
||||||
astyleit()
|
astyleit()
|
||||||
{
|
{
|
||||||
scripts/sort_includes.pl "$1"
|
|
||||||
|
|
||||||
$ASTYLE \
|
$ASTYLE \
|
||||||
--preserve-date \
|
--preserve-date \
|
||||||
--indent-preprocessor \
|
--indent-preprocessor \
|
||||||
@ -65,6 +63,8 @@ astyleit()
|
|||||||
--pad=oper \
|
--pad=oper \
|
||||||
--pad=paren-in \
|
--pad=paren-in \
|
||||||
--unpad=paren "$1"
|
--unpad=paren "$1"
|
||||||
|
|
||||||
|
scripts/unify_includes.pl "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
for f in "$@"; do
|
for f in "$@"; do
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/perl -i.sortinc -n
|
#!/usr/bin/perl -i.sortinc -n
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# sort_includes.pl
|
# unify_includes.pl
|
||||||
# ---------------------
|
# ---------------------
|
||||||
# begin : June 2015
|
# begin : June 2015
|
||||||
# copyright : (C) 2015 by Juergen E. Fischer
|
# copyright : (C) 2015 by Juergen E. Fischer
|
||||||
@ -20,39 +20,22 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
our %uis;
|
our %inc;
|
||||||
our %sys;
|
our @inc;
|
||||||
our %others;
|
|
||||||
our $sorting;
|
|
||||||
|
|
||||||
BEGIN { $sorting = 0; }
|
END { die "header files not empty" if @inc; }
|
||||||
END { die "header files not empty" if keys %uis || keys %sys || keys %others; }
|
|
||||||
|
|
||||||
if(/^\s*#include/ ) {
|
|
||||||
if(/"ui_/ ) {
|
|
||||||
$uis{$_}=1;
|
|
||||||
} elsif(/</) {
|
|
||||||
$sys{$_}=1;
|
|
||||||
} else {
|
|
||||||
$others{$_}=1;
|
|
||||||
}
|
|
||||||
$sorting=1;
|
|
||||||
|
|
||||||
|
if( /^\s*#include/ ) {
|
||||||
|
push @inc, $_ unless exists $inc{$_};
|
||||||
|
$inc{$_}=1;
|
||||||
next unless eof;
|
next unless eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $sorting ) {
|
if( %inc ) {
|
||||||
print foreach sort keys %uis;
|
print foreach @inc;
|
||||||
print foreach sort keys %sys;
|
undef %inc;
|
||||||
print foreach sort keys %others;
|
undef @inc;
|
||||||
|
|
||||||
undef %uis;
|
|
||||||
undef %sys;
|
|
||||||
undef %others;
|
|
||||||
|
|
||||||
last if eof;
|
last if eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sorting=0;
|
|
||||||
|
|
||||||
print;
|
print;
|
Loading…
x
Reference in New Issue
Block a user