mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# GNU prefix command for mac os support (gsed, gsplit)
|
|
GP=
|
|
if [[ "$OSTYPE" =~ darwin* ]]; then
|
|
GP=g
|
|
fi
|
|
|
|
for file in $*; do
|
|
d=${file#*/}
|
|
d=${d%/*}
|
|
f=${file##*/}
|
|
f=${f%.*}
|
|
|
|
tempfile=$(${GP}mktemp ${f}XXXX --suffix=.h)
|
|
|
|
# Remove comments
|
|
${GP}sed 's/a/aA/g;s/__/aB/g;s/#/aC/g' "src/$d/$f.h" | cpp -E $arg - | ${GP}sed 's/aC/#/g;s/aB/__/g;s/aA/a/g' > $tempfile
|
|
|
|
# Remove override keyword
|
|
${GP}sed -i 's/ override;/;/g' $tempfile
|
|
|
|
# Remove preprocessor directives
|
|
${GP}sed -i '/^#/d' $tempfile
|
|
|
|
# Remove CORE_EXPORT etc
|
|
${GP}sed -i 's/ [A-Z]*_EXPORT//g' $tempfile
|
|
|
|
# Remove public keyword from inherited classes
|
|
${GP}sed -i 's/\(class.*:\) public\(.*\)/\1\2/g' $tempfile
|
|
|
|
# Remove Q_OBJECT,ENUMS,PROPERTY
|
|
${GP}sed -i -r '/^\s*Q_(OBJECT|ENUMS|PROPERTY).*?$/d' $tempfile
|
|
|
|
# Remove function definition in header
|
|
${GP}sed -i -r 's/^(\s*)?(inline )?(void|bool|int|double|Q\w+)(\s+[^ ]*?\(.*?\)( const)?)\s*\{.*?\}$/\1\3\4;/g' $tempfile
|
|
|
|
# Remove nullptr
|
|
${GP}sed -i 's/nullptr/0/g' $tempfile
|
|
|
|
vimdiff $tempfile python/$d/$f.sip
|
|
|
|
rm $tempfile
|
|
done
|