forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite cluster callback implementations to not have per-field argume…
…nts. This commit was generated by running: find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,]+,([^,)]+ commandData\)\n{\n)/\1\2/g;' find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,)]+,[^,)]+ ([a-zA-Z0-9]+),([^,)]+ commandData\)\n{\n)/\1\3 auto & \2 = commandData.\2;\n\n/g;' find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,)]+,[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),([^,)]+ commandData\)\n{\n)/\1\4 auto & \2 = commandData.\2;\n auto & \3 = commandData.\3;\n\n/g;' find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,)]+,[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),([^,)]+ commandData\)\n{\n)/\1\5 auto & \2 = commandData.\2;\n auto & \3 = commandData.\3;\n auto & \4 = commandData.\4;\n\n/g;' find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,)]+,[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),([^,)]+ commandData\)\n{\n)/\1\6 auto & \2 = commandData.\2;\n auto & \3 = commandData.\3;\n auto & \4 = commandData.\4;\n auto & \5 = commandData.\5;\n\n/g;' find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,)]+,[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),([^,)]+ commandData\)\n{\n)/\1\7 auto & \2 = commandData.\2;\n auto & \3 = commandData.\3;\n auto & \4 = commandData.\4;\n auto & \5 = commandData.\5;\n auto & \6 = commandData.\6;\n\n/g;' find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,)]+,[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),([^,)]+ commandData\)\n{\n)/\1\8 auto & \2 = commandData.\2;\n auto & \3 = commandData.\3;\n auto & \4 = commandData.\4;\n auto & \5 = commandData.\5;\n auto & \6 = commandData.\6;\n auto & \7 = commandData.\7;\n\n/g;' find src/app/clusters examples/tv-app/linux/include/content-launcher examples/window-app/common/src -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef; } s/(bool emberAf[a-zA-Z0-9]*Cluster[a-zA-Z0-9]*Callback\([^,]+,[^,]+,)[^,)]+,[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),[^,)]+ ([a-zA-Z0-9]+),([^,)]+ commandData\)\n{\n)/\1\9 auto & \2 = commandData.\2;\n auto & \3 = commandData.\3;\n auto & \4 = commandData.\4;\n auto & \5 = commandData.\5;\n auto & \6 = commandData.\6;\n auto & \7 = commandData.\7;\n auto & \8 = commandData.\8;\n\n/g;' and then restyling. For all of those regexps the idea is to grab the first two arguments (command obj and command path) as-is, as well as the last (commandData) argument. The endpoint argument is dropped, because almost nothing uses it right now and it's easier to fix up the things that do (to use the command path) than to fix up all the things that don't (to not have it). For the other arguments, each one is rewritten into a variable at the top of the function, assigned from the corresponding member of the field struct. There are multiple passes because each pass only deals with functions that have a fixed number of arguments. Fixes project-chip#8974 Fixes project-chip#8977
- Loading branch information
1 parent
253fe50
commit 0074e2d
Showing
37 changed files
with
527 additions
and
244 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
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
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
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
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
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
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
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
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
Oops, something went wrong.