From 502f7d4f5e19458c13e4cef97593ad46990c71a3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 3 Feb 2022 17:13:49 +0100 Subject: [PATCH] update output file format --- events/event_parser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/events/event_parser.py b/events/event_parser.py index 7f227e2..fa6e21c 100644 --- a/events/event_parser.py +++ b/events/event_parser.py @@ -247,15 +247,15 @@ def write_translation_source_file( outputfile = open(filename, "w") definitions = "" - function = "const char * translateEvents(Event event) {\n\tswitch( (event & 0xffff) ) {\n" + function = "const char * translateEvents(Event event) {\n switch( (event & 0xffff) ) {\n" for entry in event_list: event_id = entry[0] event_value = entry[1] definitions += \ f"const char *{event_value[EVENT_ENTRY_NAME_IDX]}_STRING " \ f"= \"{event_value[EVENT_ENTRY_NAME_IDX]}\";\n" - function += f"\tcase({event_id}):\n\t\treturn {event_value[EVENT_ENTRY_NAME_IDX]}_STRING;\n" - function += '\tdefault:\n\t\treturn "UNKNOWN_EVENT";\n' + function += f" case({event_id}):\n return {event_value[EVENT_ENTRY_NAME_IDX]}_STRING;\n" + function += ' default:\n return "UNKNOWN_EVENT";\n' outputfile.write( f"/**\n * @brief Auto-generated event translation file. " f"Contains {len(event_list)} translations.\n" @@ -263,7 +263,7 @@ def write_translation_source_file( f" * Generated on: {date_string}\n */\n" ) outputfile.write("#include \"translateEvents.h\"\n\n") - outputfile.write(definitions + "\n" + function + "\t}\n\treturn 0;\n}\n") + outputfile.write(definitions + "\n" + function + " }\n return 0;\n}\n") outputfile.close()