Compare commits

..

No commits in common. "main" and "v0.3.0" have entirely different histories.
main ... v0.3.0

4 changed files with 12 additions and 28 deletions

View File

@ -8,15 +8,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased] # [unreleased]
# [v0.3.2]
- Added handling for duplicate event names when writing the event translation
file.
# [v0.3.1]
- Sorted returnvalue export by raw returnvalue.
# [v0.3.0] # [v0.3.0]
- Description parser is now more generic and parses a list of meta informations. - Description parser is now more generic and parses a list of meta informations.

View File

@ -1,5 +1,5 @@
__version__ = "0.3.2" __version__ = "0.3.0"
VERSION_MAJOR = 0 VERSION_MAJOR = 0
VERSION_MINOR = 3 VERSION_MINOR = 3
VERSION_REVISION = 2 VERSION_REVISION = 0

View File

@ -274,16 +274,10 @@ def write_translation_source_file(
event_id = entry[0] event_id = entry[0]
event_value = entry[1] event_value = entry[1]
name = event_value.name name = event_value.name
if name in lut: if name not in lut:
_LOGGER.warning( definitions += f"const char *{name}_STRING " f'= "{name}";\n'
"Duplicate name detected when generating event translation source file" function += f" case ({event_id}):\n " f"return {name}_STRING;\n"
) lut.update({name: event_value})
_LOGGER.warning(f"Name: {name}, Event Entry: {event_value}")
name = f"{name}_{event_id}"
_LOGGER.info(f"Created unique name {name}")
definitions += f"const char *{name}_STRING " f'= "{name}";\n'
function += f" case ({event_id}):\n " f"return {name}_STRING;\n"
lut.update({name: event_value})
function += ' default:\n return "UNKNOWN_EVENT";\n' function += ' default:\n return "UNKNOWN_EVENT";\n'
out.write( out.write(
f"/**\n * @brief Auto-generated event translation file. " f"/**\n * @brief Auto-generated event translation file. "

View File

@ -461,17 +461,16 @@ class ReturnValueParser(FileParser):
f"Full ID (hex){column_sep} Name{column_sep} Description{column_sep} " f"Full ID (hex){column_sep} Name{column_sep} Description{column_sep} "
f"Unique ID{column_sep} Subsytem Name{column_sep} File Path\n" f"Unique ID{column_sep} Subsytem Name{column_sep} File Path\n"
) )
for k, entry in sorted(list_of_entries.items()): for entry in list_of_entries.items():
# entry: tuple
if column_sep == ";": if column_sep == ";":
entry.description = entry.description.replace(";", ",") entry[1].description = entry[1].description.replace(";", ",")
elif column_sep == ",": elif column_sep == ",":
# Quote the description # Quote the description
entry.description = f'"{entry.description}"' entry[1].description = f'"{entry[1].description}"'
out.write( out.write(
f"{k:#06x}{column_sep}{entry.name}{column_sep}{entry.description}" f"{entry[0]:#06x}{column_sep}{entry[1].name}{column_sep}{entry[1].description}"
f"{column_sep}{entry.unique_id}{column_sep}{entry.subsystem_name}" f"{column_sep}{entry[1].unique_id}{column_sep}{entry[1].subsystem_name}"
f"{column_sep}{entry.file_name.as_posix()}\n" f"{column_sep}{entry[1].file_name.as_posix()}\n"
) )
def build_checked_string( def build_checked_string(