diff options
author | Julian Oes <julian@oes.ch> | 2014-01-28 12:31:23 +0100 |
---|---|---|
committer | Julian Oes <julian@oes.ch> | 2014-01-28 12:31:23 +0100 |
commit | 99875bbd28ee813950efb9402b3acce55c34469b (patch) | |
tree | 8716876c974ed0e81513b31017466f166f5ad189 /Tools | |
parent | 547080f1882918a65db4e7cba396ae2c72d84544 (diff) | |
download | px4-firmware-99875bbd28ee813950efb9402b3acce55c34469b.tar.gz px4-firmware-99875bbd28ee813950efb9402b3acce55c34469b.tar.bz2 px4-firmware-99875bbd28ee813950efb9402b3acce55c34469b.zip |
FSM visualisation script: cope with prefixed state names
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/fsm_visualisation.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Tools/fsm_visualisation.py b/Tools/fsm_visualisation.py index 5532b99bc..c678ef0f4 100755 --- a/Tools/fsm_visualisation.py +++ b/Tools/fsm_visualisation.py @@ -59,7 +59,7 @@ def main(): # first get all states and events for table_line in table_source.split('\n'): - match = re.search(r'/\*\s+STATE_(\w+)\s+\*/', table_line) + match = re.search(r'/\*\s+\w+_STATE_(\w+)\s+\*/', table_line) if match: states.append(str(match.group(1))) # go to next line @@ -86,9 +86,9 @@ def main(): for table_line in table_source.split('\n'): # get states - # from: /* STATE_NONE */ + # from: /* NAV_STATE_NONE */ # extract only "NONE" - match = re.search(r'/\*\s+STATE_(\w+)\s+\*/', table_line) + match = re.search(r'/\*\s+\w+_STATE_(\w+)\s+\*/', table_line) if match: state = match.group(1) state_index = states.index(state) @@ -100,14 +100,14 @@ def main(): continue # get event and next state - # from /* EVENT_READY_REQUESTED */ {ACTION(&Navigator::start_ready), STATE_READY} + # from /* EVENT_READY_REQUESTED */ {ACTION(&Navigator::start_ready), NAV_STATE_READY} # extract "READY_REQUESTED" and "READY" if there is ACTION - match_action = re.search(r'/\*\s+EVENT_(\w+)\s+\*/\s+\{ACTION\((?:.|\n)*STATE_(\w+)', table_line) + match_action = re.search(r'/\*\s+EVENT_(\w+)\s+\*/\s+\{ACTION\((?:.|\n)*\w+_STATE_(\w+)', table_line) # get event and next state - # from /* EVENT_NONE_REQUESTED */ {NO_ACTION, STATE_NONE}, - # extract "NONE_REQUESTED" and "STATE_NONE" if there is NO_ACTION - match_no_action = re.search(r'/\*\s+EVENT_(\w+)\s+\*/\s+\{NO_ACTION(?:.|\n)*STATE_(\w+)', table_line) + # from /* EVENT_NONE_REQUESTED */ {NO_ACTION, NAV_STATE_NONE}, + # extract "NONE_REQUESTED" and "NAV_STATE_NONE" if there is NO_ACTION + match_no_action = re.search(r'/\*\s+EVENT_(\w+)\s+\*/\s+\{NO_ACTION(?:.|\n)*\w+_STATE_(\w+)', table_line) # ignore lines with brackets only if match_action or match_no_action: |