]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix class()
authorMartin Taibr <taibr.martin@gmail.com>
Sun, 8 Oct 2017 18:08:31 +0000 (20:08 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Sun, 8 Oct 2017 18:08:31 +0000 (20:08 +0200)
qcsrc/tools/uncrustify.sh

index b36953e366231db2192a145697470e6fa5d016a4..5d7bca54a4671dee3ed854d8b561a88c17134bfa 100755 (executable)
@@ -6,6 +6,12 @@ fix_function_types() {
        sed -e 's/)\([A-Za-z_]\)/) \1/g' "$@"
 }
 
+fix_class() {
+       # uncrustify changes stuff like `class(WaypointSprite) .float helpme;`
+       # into `class(WaypointSprite).float helpme;` - revert it
+       sed -E -e 's/(class\([A-Za-z1-9_]+\))(\.[A-Za-z1-9_]+)/\1 \2/g' "$@"
+}
+
 if [ -z "$UNCRUSTIFY_CONFIG" ]; then
        UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg
 fi
@@ -13,10 +19,12 @@ fi
 case "$#" in
        0)
                uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\
-               fix_function_types
+               fix_function_types |\
+               fix_class
                ;;
        *)
                uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" ;\
-               fix_function_types -i "$@"
+               fix_function_types -i "$@";\
+               fix_class -i "$@"
                ;;
 esac