eliminate comments in map_parser.py

This commit is contained in:
2026-06-17 15:18:02 +03:00
parent 1534d825a4
commit 7e040662fc

View File

@@ -104,65 +104,4 @@ if __name__ == "__main__":
except Exception as unexpected_arr:
print(f"Error code 3: {str(unexpected_arr)}", file=sys.stderr)
sys.exit(3)
# def parse_iar_map_text(map_text):
# entries = {}
#
# lines = map_text.splitlines()
# section_lines = []
# inside_entry_list = False
#
# for line in lines:
# # Если встретили заголовок (независимо от количества звездочек и пробелов)
# if "ENTRY LIST" in line:
# inside_entry_list = True
# continue # Пропускаем саму строку заголовка
#
# if inside_entry_list:
# # Если дошли до следующей крупной секции (строка из множества звезд) — выходим
# if "********" in line:
# break
# section_lines.append(line)
#
# if not inside_entry_list:
# print("Ошибка: Секция ENTRY LIST не найдена в файле.")
# return entries
#
# # 2. Регулярное выражение для разбора строк (символы ?, $, . внутри \S+)
# pattern = re.compile(
# r"^\s*(?P<name>\S+)\s+(?P<address>0x[0-9a-fA-F]+)\s+(?P<size>0x[0-9a-fA-F]+|--)\s+(?P<type>\w+)"
# )
#
# # 3. Парсим собранные строки
# for line in section_lines:
# line = line.strip()
# match = pattern.match(line)
# if match:
# data = match.groupdict()
# name = data["name"]
# raw_size = data["size"]
#
# size_val = None if raw_size == "--" else int(raw_size, 16)
#
# entries[name] = {
# "address": data["address"],
# "size_hex": raw_size if raw_size != "--" else None,
# "size_bytes": size_val,
# "type": data["type"],
# }
#
# return entries
#
# fname_map = r"C:\Danila\work\sputnik_test\src\sputnik\Debug\sputnik.map"
#
# with open(fname_map, 'r', encoding="utf-8") as f:
# data = f.read()
# # print(data)
#
# result_json = parse_iar_map_text(data)
#
# json_map_file = "map.json"
# with open(json_map_file, 'w', encoding='utf-8') as f:
# # Выводим в stdout готовый JSON (Qt-стенд сможет его легко прочесть)
# json.dump(result_json, f, indent=2, ensure_ascii=False)
sys.exit(3)