Files
RTLPlayground/httpd/treatasm.py
T
René van Dorst e859769e5c http: use python3.
Fix compile issue where system don't have python2.
I get error below.

/bin/sh: line 1: ./treatasm.py: cannot execute: required file not found
make[1]: *** [Makefile:15: httpd.rel] Error 127

Debian has python3 a long time so use it.
See https://wiki.debian.org/Python
2025-08-27 23:11:12 +02:00

26 lines
588 B
Python
Executable File

#!/usr/bin/env python3
import re
import sys
isBanked = False
regex_bank = re.compile(r'^\s*\.area\s+BANK\d+\s*\(CODE\)')
regex_const = re.compile(r'^\s*\.area\s+CONST\s*\(CODE\)')
regex_area = re.compile(r'^\s*\.area\s+\(CODE\)')
with open(sys.argv[1], "r") as file:
for line in file:
line = line.rstrip()
bmatch = re.search(regex_bank, line)
if bmatch:
isBanked = True
print(line)
else:
cmatch = re.search(regex_const, line)
if not isBanked or not cmatch:
print(line)
amatch = re.search(regex_area, line)
if amatch:
isBanked = False
print(line)