You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
799 B

#!/usr/bin/env python2
#
# Extract unique DUK_USE_xxx flags from current code base:
#
# $ python extract_unique_options.py ../src/*.c ../src/*.h ../src/*.h.in
#
import os, sys, re
# DUK_USE_xxx/DUK_OPT_xxx are used as placeholders and not matched
# (only uppercase allowed)
re_use = re.compile(r'DUK_USE_[A-Z0-9_]+')
re_opt = re.compile(r'DUK_OPT_[A-Z0-9_]+')
def main():
uses = {}
opts = {}
for fn in sys.argv[1:]:
f = open(fn, 'rb')
for line in f:
for t in re.findall(re_use, line):
if t[-1] != '_': # skip e.g. 'DUK_USE_'
uses[t] = True
for t in re.findall(re_opt, line):
if t[-1] != '_':
opts[t] = True
f.close()
k = opts.keys()
k.sort()
for i in k:
print(i)
k = uses.keys()
k.sort()
for i in k:
print(i)
if __name__ == '__main__':
main()