Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preprocess header file in sipdiff to reduce noise
and common sources of trouble.
- Loading branch information
Showing
1 changed file
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
#!/bin/bash | ||
|
||
for file in $*; do | ||
d=${file#*/} | ||
d=${d%/*} | ||
f=${file##*/} | ||
f=${f%.*} | ||
d=${file#*/} | ||
d=${d%/*} | ||
f=${file##*/} | ||
f=${f%.*} | ||
|
||
vimdiff src/$d/$f.h python/$d/$f.sip | ||
tempfile=$(mktemp ${f}XXXX --suffix=.h) | ||
|
||
# Remove comments | ||
sed 's/a/aA/g;s/__/aB/g;s/#/aC/g' "src/$d/$f.h" | gcc -P -E $arg - | sed 's/aC/#/g;s/aB/__/g;s/aA/a/g' > $tempfile | ||
|
||
# Remove override keyword | ||
sed -i 's/ override;/;/g' $tempfile | ||
|
||
# Remove preprocessor directives | ||
sed -i '/^#/d' $tempfile | ||
|
||
# Remove CORE_EXPORT etc | ||
sed -i 's/ [A-Z]*_EXPORT//g' $tempfile | ||
|
||
# Remove public keyword from inherited classes | ||
sed -i 's/\(class.*:\) public\(.*\)/\1\2/g' $tempfile | ||
|
||
vimdiff $tempfile python/$d/$f.sip | ||
|
||
rm $tempfile | ||
done |