diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-31 08:00:51 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-31 08:00:51 +0200 |
commit | d25ea3e8c64766f3cf392f7c5ccf5b09ae013677 (patch) | |
tree | 5e2ae3bb84a9abf1d2f7151b303d48905250c36d /src/extract | |
parent | derp (diff) | |
download | libgamma-d25ea3e8c64766f3cf392f7c5ccf5b09ae013677.tar.gz libgamma-d25ea3e8c64766f3cf392f7c5ccf5b09ae013677.tar.bz2 libgamma-d25ea3e8c64766f3cf392f7c5ccf5b09ae013677.tar.xz |
extraction of constants into the info manual
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/extract')
-rwxr-xr-x | src/extract/libgamma-method-extract | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/extract/libgamma-method-extract b/src/extract/libgamma-method-extract index 983f606..b521971 100755 --- a/src/extract/libgamma-method-extract +++ b/src/extract/libgamma-method-extract @@ -31,8 +31,23 @@ if sys.argv[1] == '--list': test3 = lambda line : not line.endswith('_H') defs = [line for line in data.split('\n') if test1(line) and test2(line) and test3(line)] print('\n'.join([d.split(' ')[1] for d in defs])) + elif sys.argv[2] == '--info': + test1 = lambda line : line.startswith('#define LIBGAMMA_CRTC_INFO_') + test2 = lambda line : not line.split(' ')[1] == 'LIBGAMMA_CRTC_INFO_COUNT' + defs = [line for line in data.split('\n') if test1(line) and test2(line)] + print('\n'.join([d.split(' ')[1] for d in defs])) + elif sys.argv[2] == '--connector': + test1 = lambda line : line.strip().startswith('LIBGAMMA_CONNECTOR_TYPE_') + test2 = lambda line : not line.split(' ')[1] == 'LIBGAMMA_CONNECTOR_TYPE_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] == '--subpixel': + test1 = lambda line : line.strip().startswith('LIBGAMMA_SUBPIXEL_ORDER_') + 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])) else: - if sys.argv[1] == '--method': + if sys.argv[1] in ('--method', '--info'): i = data.find('\n#define ' + sys.argv[2]) data = data[:i] i = data.rfind('\n */') @@ -41,4 +56,15 @@ 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'): + while '\n ' in data: + data = data.replace('\n ', '\n') + i = data.find('\n' + sys.argv[2]) + data = data[:i] + 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)) |