mirror of
https://github.com/rene-dev/stmbl.git
synced 2024-12-20 23:52:15 +00:00
25 lines
777 B
Python
Executable File
25 lines
777 B
Python
Executable File
#!/usr/bin/env python
|
|
import re
|
|
import sys
|
|
|
|
cmd = []
|
|
|
|
for infile in sys.argv[1:]:
|
|
with open(infile) as f:
|
|
for line_number, line in enumerate(f):
|
|
match = re.search('COMMAND\("(\w*)", *(\w*), *"([^"]*)"\);', line)
|
|
if match:
|
|
cmd.append((match.groups(), infile, line_number))
|
|
|
|
print ("//generated by " + sys.argv[0] + " DO NOT EDIT")
|
|
|
|
for (name, ptr, doc), file_name, line_number in cmd:
|
|
print ("extern void " + ptr + "(char *); // found in " + file_name + " line: " + str(line_number + 1))
|
|
|
|
print ("\n")
|
|
|
|
print ("cmd_t cmd[] = {")
|
|
for (name, ptr, doc), file_name, line_number in cmd:
|
|
print (" {\"" + name + "\", \"" + doc + "\", " + ptr + "}, // found in " + file_name + " line: " + str(line_number + 1))
|
|
print ("};")
|