- supports definition of event ids in hexadecimal format

- subsystem id can be extracted also when the subsystem id is not defined separately in the header file
This commit is contained in:
Jakob Meier 2024-12-22 18:16:59 +01:00
parent bbe55592ec
commit 497781555d
2 changed files with 7 additions and 6 deletions

View File

@ -91,7 +91,7 @@ class EventParser(FileParser):
**kwargs,
):
subsystem_id_assignment_match = re.search(
rf"([\w]*)[\s]*=[\s]*{SUBSYSTEM_ID_NAMESPACE}::([A-Z_0-9]*);",
rf"{SUBSYSTEM_ID_NAMESPACE}::([A-Z_0-9]*)",
moving_window[self.moving_window_center_idx],
)
if subsystem_id_assignment_match:
@ -99,7 +99,7 @@ class EventParser(FileParser):
# class / source file
try:
self.current_id = self.interfaces[
subsystem_id_assignment_match.group(2)
subsystem_id_assignment_match.group(1)
][0]
self.my_id = self.return_number_from_string(self.current_id)
except KeyError as e:
@ -165,6 +165,8 @@ class EventParser(FileParser):
)
severity = event_full_match.group(3)
else:
if event_full_match.group(1) == "EV_REPLY_INVALID_SIZE":
print(f"Group 3: {event_full_match.group(3)}")
full_id = (self.my_id * 100) + self.return_number_from_string(
event_full_match.group(3)
)
@ -188,12 +190,11 @@ class EventParser(FileParser):
# One line event definition.
regex_string = (
r"static const(?:expr)? Event[\s]*([\w]*)[\s]*=[\s]*"
r"MAKE_EVENT\(([0-9]{1,3}),[\s]*severity::([A-Z]*)\)[\s]*;"
r"MAKE_EVENT\((0x[0-9a-fA-F]+|[0-9]{1,3}),[\s]*severity::([A-Z]*)\)[\s]*;"
)
else:
regex_string = (
r"static const(?:expr)? Event[\s]*([\w]*)[\s]*=[\s]*"
r"event::makeEvent\(([\w]*),[\s]*([0-9]{1,3})[\s]*,[\s]*severity::([A-Z]*)\)[\s]*;"
r"static const(?:expr)? Event\s*([\w]+)\s*=\s*event::makeEvent\(([\w:]+),\s*(0x[0-9a-fA-F]+|[0-9]{1,3})\s*,\s*severity::([A-Z]+)\)\s*;"
)
event_full_match = re.search(regex_string, full_string)
return event_full_match

View File

@ -221,7 +221,7 @@ class FileParser:
self.__debug_moving_window
and self.__debug_moving_window_filename in file_name
):
print(f"Moving window post line anaylsis post EOF")
print(f"Moving window post line analysis post EOF")
print(moving_window)
pass