From 1c7e29740fe02dff2b5a580630dfb96b59f9932d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 31 May 2014 08:37:35 +0200 Subject: extraction of libgamma_method_capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- info/libgamma.texinfo | 15 ++++++++++++++ src/extract/libgamma-method-extract | 40 ++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/info/libgamma.texinfo b/info/libgamma.texinfo index 012d104..bc73b65 100644 --- a/info/libgamma.texinfo +++ b/info/libgamma.texinfo @@ -467,6 +467,7 @@ and for the freedom of all. @menu * Adjustment methods:: Selecting adjustment method. +* Adjustment method capabilities:: Identifying capabilities of adjustment methods. * CRTC information:: Retrieving information about CRTC:s. * Errors:: Error codes and how to handle errors. @end menu @@ -555,6 +556,20 @@ values. +@node Adjustment method capabilities +@section Adjustment method capabilities + +Capabilities. + +@table @code +£>for cap in $(libgamma-method-extract --list --cap-t); do +@item £{cap} [£(libgamma-method-extract --type --cap-t $cap)] +£>libgamma-method-extract --cap-t $cap | texise +£>done +@end table + + + @node CRTC information @section CRTC information diff --git a/src/extract/libgamma-method-extract b/src/extract/libgamma-method-extract index 42a66c8..6477c8a 100755 --- a/src/extract/libgamma-method-extract +++ b/src/extract/libgamma-method-extract @@ -53,6 +53,13 @@ if sys.argv[1] == '--list': 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[2] == '--cap-t': + data = data[data.find('\ntypedef struct libgamma_method_capabilities'):] + 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(' : ')[0].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'):] @@ -62,6 +69,20 @@ elif sys.argv[1] == '--type': 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])) + elif sys.argv[2] == '--cap-t': + data = data[data.find('\ntypedef struct libgamma_method_capabilities'):] + data = data[:data.find('\n}')] + test1 = lambda line : line.startswith(' ') + test2 = lambda line : ' * ' not in line + test3 = lambda line : line.strip().split(' : ')[0].split(' ')[-1].rstrip(';') == sys.argv[3] + defs = [line for line in data.split('\n') if test1(line) and test2(line) and test3(line)] + line = defs[0].strip().rstrip(';') + if ' : ' in line: + line = line.split(' : ') + line[0] = ' '.join(line[0].split(' ')[:-1]) + print(':'.join(line)) + else: + print(' '.join(line.split(' ')[:-1])) else: if sys.argv[1] in ('--method', '--info'): i = data.find('\n#define ' + sys.argv[2]) @@ -101,5 +122,22 @@ else: data = data[i + len('/**\n'):] data = [line[2:] for line in data.split('\n')] print('\n'.join(data)) - + elif sys.argv[1] == '--cap-t': + data = data[data.find('\ntypedef struct libgamma_method_capabilities'):] + data = data[:data.find('\n}')] + test1 = lambda line : line.startswith(' ') + test2 = lambda line : ' * ' not in line + test3 = lambda line : line.strip().split(' : ')[0].split(' ')[-1].rstrip(';') == 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)) -- cgit v1.2.3-70-g09d2