generated from loic/c-template
25 lines
474 B
Python
25 lines
474 B
Python
#!/usr/bin/env python3
|
|
import sys
|
|
import re
|
|
|
|
|
|
def encode(data: bytes) -> str:
|
|
parts = []
|
|
for b in data:
|
|
parts.append(str(b))
|
|
return ', '.join(parts)
|
|
|
|
|
|
def main():
|
|
path = sys.argv[1] if len(sys.argv) > 1 else 'src/Colleen.s'
|
|
|
|
with open(path, 'rb') as f:
|
|
content = f.read()
|
|
|
|
template = re.sub(rb'^src: db .*$', b'src: db ~', content, flags=re.MULTILINE)
|
|
|
|
print(f'src: db {encode(template)}')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|