| 1 | 1 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,55 @@ |
| 1 |
+#!/usr/bin/env python3 |
|
| 2 |
+ |
|
| 3 |
+ |
|
| 4 |
+import collections |
|
| 5 |
+import subprocess |
|
| 6 |
+import re |
|
| 7 |
+ |
|
| 8 |
+ |
|
| 9 |
+def run(*args): |
|
| 10 |
+ return subprocess.run(args, stdout=subprocess.PIPE).stdout.decode() |
|
| 11 |
+ |
|
| 12 |
+def info(): |
|
| 13 |
+ info = dict() |
|
| 14 |
+ re_extension = re.compile(r'^(\w+):') |
|
| 15 |
+ re_function = re.compile(r'^ (\w+):') |
|
| 16 |
+ lines = run('glewinfo')
|
|
| 17 |
+ for line in lines.splitlines(): |
|
| 18 |
+ match = re_extension.match(line) |
|
| 19 |
+ if match: |
|
| 20 |
+ extension = match.group(1) |
|
| 21 |
+ continue |
|
| 22 |
+ match = re_function.match(line) |
|
| 23 |
+ if match: |
|
| 24 |
+ info[match.group(1)] = extension |
|
| 25 |
+ continue |
|
| 26 |
+ return info |
|
| 27 |
+ |
|
| 28 |
+def compat(info): |
|
| 29 |
+ compat = collections.defaultdict(lambda: collections.defaultdict(list)) |
|
| 30 |
+ lines = run('grep', '-RIon', '--exclude-dir=.git', '-E', r'\<gl[A-Z]\w+\>')
|
|
| 31 |
+ for line in lines.splitlines(): |
|
| 32 |
+ file, line_nr, function = line.split(':')
|
|
| 33 |
+ location = f'{file}:{line_nr}'
|
|
| 34 |
+ extension = info.get(function, 'NOT_FOUND') |
|
| 35 |
+ compat[extension][function].append(location) |
|
| 36 |
+ return compat |
|
| 37 |
+ |
|
| 38 |
+def report(compat, with_locations): |
|
| 39 |
+ for extension, functions in sorted(compat.items()): |
|
| 40 |
+ print(f'{extension}')
|
|
| 41 |
+ for function, locations in sorted(functions.items()): |
|
| 42 |
+ print(f' {function}')
|
|
| 43 |
+ if with_locations: |
|
| 44 |
+ for location in locations: |
|
| 45 |
+ print(f' {location}')
|
|
| 46 |
+ |
|
| 47 |
+def main(): |
|
| 48 |
+ c = compat(info()) |
|
| 49 |
+ report(c, False) |
|
| 50 |
+ print('')
|
|
| 51 |
+ report(c, True) |
|
| 52 |
+ |
|
| 53 |
+ |
|
| 54 |
+if __name__ == '__main__': |
|
| 55 |
+ main() |