From 0447332ed30b061abd9b282b95efe6d197a035ef Mon Sep 17 00:00:00 2001 From: David Benepe Date: Sat, 5 Feb 2022 15:55:15 -0500 Subject: [PATCH] More progress with regional names x2 --- tools/python/fix_regional_names.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tools/python/fix_regional_names.py b/tools/python/fix_regional_names.py index 3d7f6412..af7edcf9 100755 --- a/tools/python/fix_regional_names.py +++ b/tools/python/fix_regional_names.py @@ -31,7 +31,34 @@ def precheckForErrors(version): return None return symMapPath -def filterSymMapText(symMapText) +def filterSymMapText(symMapText): + newSymMapText = '' + + lines = symMapText.split('\n') + + state = 0 + # 0 = Looking for .main section + # 1 = Looking for file section + # 2 = Processing file section + + for i in range(0, len(lines)): + line = lines[i] + if state == 0: + if line.startswith('.main'): + state = 1 + elif state == 1: + if line.startswith(' build/'): + if '/lib/' not in line: + state = 2 + elif state == 2: + if line.startswith(' build/'): + if '/lib/' in line: + state = 1 + continue + if line.startswith('/DISCARD/'): + break + newSymMapText += line + '\n' + return newSymMapText def getSymbolsFromMapText(symMapText): symbols = set()