Add project files.
This commit is contained in:
22
gen_rt2rth.py
Normal file
22
gen_rt2rth.py
Normal file
@@ -0,0 +1,22 @@
|
||||
with open("record_types.txt", "r") as f:
|
||||
data = f.read()
|
||||
|
||||
GROUPING = 3
|
||||
PREFIX = "RT_"
|
||||
line = []
|
||||
out = ""
|
||||
for i, l in enumerate(data.split("\n")):
|
||||
word = l.strip()
|
||||
#bytes_ = [ord(c) for c in word]
|
||||
#le_hex = "".join([hex(c)[2:] for c in reversed(bytes_)])
|
||||
#line += [f"0x{le_hex}u"]
|
||||
line += [f"[{word}] = {PREFIX}{word}"]
|
||||
|
||||
if (i + 1) % GROUPING == 0:
|
||||
out += ", ".join(line) + ",\n"
|
||||
line = []
|
||||
|
||||
if line:
|
||||
out += ", ".join(line) + ",\n"
|
||||
|
||||
print(out)
|
||||
Reference in New Issue
Block a user