mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-26 08:31:56 +00:00
Add filter_spec Python script for filtering OpenGL specification files.
This commit is contained in:
parent
27e9398c4d
commit
a062a5f0d2
32
auto/bin/filter_spec.py
Executable file
32
auto/bin/filter_spec.py
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
section = re.compile('^(Name|Name Strings?|Number|Dependencies|New Procedures and Functions|New Tokens|Additions to .*|Changes to .*|Modifications to .*|Add new Section .*)\s*$')
|
||||||
|
token = re.compile('^\s+(([A-Z0-9][A-Z0-9_x]*):?\s+((?:0x)?[0-9A-F]+)([^\?]*))?\s*$')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
from optparse import OptionParser
|
||||||
|
import os
|
||||||
|
|
||||||
|
parser = OptionParser('usage: %prog [options] [SOURCES...]')
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
for i in args:
|
||||||
|
lines = open(i).readlines()
|
||||||
|
f = open(i,'w')
|
||||||
|
current = ''
|
||||||
|
for j in lines:
|
||||||
|
m = section.match(j)
|
||||||
|
if m:
|
||||||
|
current = m.group(1).strip()
|
||||||
|
if current in [ 'Name', 'Name String', 'Name Strings', 'Number', 'Dependencies', 'New Procedures and Functions', 'New Tokens']:
|
||||||
|
print >>f, j,
|
||||||
|
continue
|
||||||
|
if current=='New Tokens':
|
||||||
|
if token.match(j):
|
||||||
|
print >>f, j,
|
||||||
|
elif current in [ 'Name', 'Name String', 'Name Strings', 'Number', 'Dependencies', 'New Procedures and Functions']:
|
||||||
|
print >>f, j,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user