This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/7496
contrib/fsm-to-dot: don't match on event names in comments
Strip comments from function bodies before matching on event names.
In osmo-bsc's gscon FSM, there often are event names in comments. The naive
parsing of fsm-to-dot.py mistakes these as events causing state transitions,
but the comments are just explaining how states interact.
Makes me reconsider parsing the C with clang instead, but I got away with a
dirty hack once more.
Change-Id: I56d70ae14d363f7ca655dced16d93d795b3f940d
---
M contrib/fsm-to-dot.py
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/96/7496/1
diff --git a/contrib/fsm-to-dot.py b/contrib/fsm-to-dot.py
index 276fccc..ce94a4e 100755
--- a/contrib/fsm-to-dot.py
+++ b/contrib/fsm-to-dot.py
@@ -566,6 +566,8 @@
re_state_trigger = re.compile(r'osmo_fsm_inst_state_chg\([^,]+,\W*([A-Z_][A-Z_0-9]*)\W*,', re.M)
re_fsm_alloc = re.compile(r'osmo_fsm_inst_alloc[_child]*\(\W*&([a-z_][a-z_0-9]*),', re.M)
re_fsm_event_dispatch = re.compile(r'osmo_fsm_inst_dispatch\(\W*[^,]+,\W*([A-Z_][A-Z_0-9]*)\W*,', re.M)
+re_comment_multiline = re.compile(r'/\*.*?\*/', re.M | re.S)
+re_comment_single_line = re.compile(r'//.*$', re.M | re.S)
class CFile():
def __init__(c_file, path):
@@ -625,6 +627,8 @@
for m in re_func.finditer(c_file.src):
name = m.group(1)
func_src = c_file.extract_block('{', '}', m.start())
+ func_src = ''.join(re_comment_multiline.split(func_src))
+ func_src = ''.join(re_comment_single_line.split(func_src))
funcs[name] = func_src
c_file.funcs = funcs
c_file.find_fsm_allocators()
--
To view, visit https://gerrit.osmocom.org/7496
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I56d70ae14d363f7ca655dced16d93d795b3f940d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>