2020-08-01 18:55:49 +02:00
|
|
|
import os
|
|
|
|
import re
|
|
|
|
|
|
|
|
def replace_func(match):
|
|
|
|
match = match.group()
|
|
|
|
|
|
|
|
if match.startswith("."):
|
|
|
|
return match
|
|
|
|
return "glabel " + match[:-1]
|
|
|
|
|
2020-08-01 20:03:34 +02:00
|
|
|
for root, dirs, files in os.walk("asm"):
|
2020-08-01 18:55:49 +02:00
|
|
|
for file in files:
|
|
|
|
for file in files:
|
|
|
|
if file.endswith(".s"):
|
|
|
|
with open(os.path.join(root, file)) as f:
|
|
|
|
old_file_text = f.read()
|
|
|
|
|
|
|
|
new_file_text = re.sub(".*:", replace_func, old_file_text)
|
|
|
|
|
|
|
|
if old_file_text != new_file_text:
|
|
|
|
with open(os.path.join(root, file), "w", newline="\n") as f:
|
|
|
|
f.write(new_file_text)
|