aboutsummaryrefslogtreecommitdiffstats
path: root/src/extract/libgamma-method-extract
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-31 08:18:52 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-31 08:19:09 +0200
commit1ca2dac381acf7d3d4edbc1097f89ab7e280acda (patch)
tree9ab9dc53930ef2ee1eb29e52af2bd67e0bf9d8c0 /src/extract/libgamma-method-extract
parentextraction of constants into the info manual (diff)
downloadlibgamma-1ca2dac381acf7d3d4edbc1097f89ab7e280acda.tar.gz
libgamma-1ca2dac381acf7d3d4edbc1097f89ab7e280acda.tar.bz2
libgamma-1ca2dac381acf7d3d4edbc1097f89ab7e280acda.tar.xz
extraction of libgamma_crtc_information
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-xsrc/extract/libgamma-method-extract37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/extract/libgamma-method-extract b/src/extract/libgamma-method-extract
index b521971..42a66c8 100755
--- a/src/extract/libgamma-method-extract
+++ b/src/extract/libgamma-method-extract
@@ -46,6 +46,22 @@ if sys.argv[1] == '--list':
test2 = lambda line : not line.split(' ')[1] == 'LIBGAMMA_SUBPIXEL_ORDER_COUNT'
defs = [line for line in data.split('\n') if test1(line) and test2(line)]
print('\n'.join([d.strip().split(' ')[0].rstrip(',') for d in defs]))
+ elif sys.argv[2] == '--info-t':
+ data = data[data.find('\ntypedef struct libgamma_crtc_information'):]
+ data = data[:data.find('\n}')]
+ test1 = lambda line : line.startswith(' ') and line.endswith(';')
+ test2 = lambda line : ' * ' not in line
+ defs = [line for line in data.split('\n') if test1(line) and test2(line)]
+ print('\n'.join([d.strip().split(' ')[-1].rstrip(';') for d in defs]))
+elif sys.argv[1] == '--type':
+ if sys.argv[2] == '--info-t':
+ data = data[data.find('\ntypedef struct libgamma_crtc_information'):]
+ data = data[:data.find('\n}')]
+ test1 = lambda line : line.startswith(' ')
+ test2 = lambda line : ' * ' not in line
+ test3 = lambda line : line.strip().split(' ')[-1] == sys.argv[3] + ';'
+ defs = [line for line in data.split('\n') if test1(line) and test2(line) and test3(line)]
+ print('\n'.join([' '.join(d.strip().split(' ')[:-1]) for d in defs]))
else:
if sys.argv[1] in ('--method', '--info'):
i = data.find('\n#define ' + sys.argv[2])
@@ -56,7 +72,7 @@ else:
data = data[i + len('/**\n'):]
data = [line[3:] for line in data.split('\n')]
print('\n'.join(data))
- if sys.argv[1] in ('--connector', '--subpixel'):
+ elif sys.argv[1] in ('--connector', '--subpixel'):
while '\n ' in data:
data = data.replace('\n ', '\n')
i = data.find('\n' + sys.argv[2])
@@ -67,4 +83,23 @@ else:
data = data[i + len('/**\n'):]
data = [line[2:] for line in data.split('\n')]
print('\n'.join(data))
+ elif sys.argv[1] == '--info-t':
+ data = data[data.find('\ntypedef struct libgamma_crtc_information'):]
+ data = data[:data.find('\n}')]
+ test1 = lambda line : line.startswith(' ')
+ test2 = lambda line : ' * ' not in line
+ test3 = lambda line : line.strip().split(' ')[-1] == sys.argv[2] + ';'
+ defs = [line for line in data.split('\n') if test1(line) and test2(line) and test3(line)]
+ line = defs[0]
+ i = data.find('\n' + line)
+ data = data[:i]
+ while '\n ' in data:
+ data = data.replace('\n ', '\n')
+ i = data.rfind('\n*/')
+ data = data[:i]
+ i = data.rfind('/**\n')
+ data = data[i + len('/**\n'):]
+ data = [line[2:] for line in data.split('\n')]
+ print('\n'.join(data))
+