diff options
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | info/behead | 28 | ||||
-rw-r--r-- | info/libgamma.texinfo | 53 | ||||
-rwxr-xr-x | src/extract/libgamma-method-extract | 43 |
4 files changed, 105 insertions, 21 deletions
@@ -148,7 +148,7 @@ obj/test/%.o: src/test/%.c doc: info pdf dvi ps obj/libgamma.texinfo: info/libgamma.texinfo $(foreach H,$(HEADERS_INFO),src/lib/$(H).h) \ - src/extract/libgamma-*-extract info/texise + src/extract/libgamma-*-extract info/texise info/behead mkdir -p obj $(GPP) --symbol '£' --input $< --output $@ diff --git a/info/behead b/info/behead new file mode 100755 index 0000000..3da8de3 --- /dev/null +++ b/info/behead @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# libgamma — Display server abstraction layer for gamma ramp adjustments +# Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this library. If not, see <http://www.gnu.org/licenses/>. + +beheading="$1" + +data="$(cat)" +lines="$(echo "${data}" | wc -l)" +lines=$(( ${lines} - ${beheading} )) + +if (( $lines > 0 )); then + echo "$(echo "${data}" | tail -n ${lines})" +fi + diff --git a/info/libgamma.texinfo b/info/libgamma.texinfo index 25548fb..cbbfe4b 100644 --- a/info/libgamma.texinfo +++ b/info/libgamma.texinfo @@ -619,7 +619,58 @@ CRTC information. @node Monitors @section Monitors -TODO +@command{libgamma} have a three level hierarchy for addressing +monitors. These levels are: + +@table @asis +@item Sites +£>libgamma-method-extract --doc --site-t | behead 2 | texise +@item Partitions +£>libgamma-method-extract --doc --part-t | behead 2 | texise +@item CRTC:s (cathode ray tube controllers) @footnote{Do not be fooled by the legacy name, they are general video controllers.} +£>libgamma-method-extract --doc --crtc-t | behead 2 | texise +@end table + +@command{libgamma} keeps tracks of these layers states, +because of this there are one state data structure per +layer that also identifies the instance of the layer. + +The state and identity of the site is track by +the data structure @code{libgamma_site_state_t} +@footnote{@code{struct libgamma_site_state}}. +This structure contains the following variables: + +@table @code +£>for site in $(libgamma-method-extract --list --site-t); do +@item £{site} +£>libgamma-method-extract --site-t $site | texise | sed -e 's/"/``/1' | sed -e 's/"/'\'\''/' +£>done +@end table + +The state and identity of the partition is track by +the data structure @code{libgamma_partition_state_t} +@footnote{@code{struct libgamma_partition_state}}. +This structure contains the following variables: + +@table @code +£>for part in $(libgamma-method-extract --list --part-t); do +@item £{part} +£>libgamma-method-extract --part-t $part | texise +£>done +@end table + +The state and identity of the partition is track +by the data structure @code{libgamma_crtc_state_t} +@footnote{@code{struct libgamma_crtc_state}}. +This structure contains the following variables; + +@table @code +£>for crtc in $(libgamma-method-extract --list --crtc-t); do +@item £{crtc} +£>libgamma-method-extract --crtc-t $crtc | texise +£>done +@end table + diff --git a/src/extract/libgamma-method-extract b/src/extract/libgamma-method-extract index 178ca01..88c41f0 100755 --- a/src/extract/libgamma-method-extract +++ b/src/extract/libgamma-method-extract @@ -67,14 +67,20 @@ def type_struct(name): print(' '.join(line.split(' ')[:-1])) +def doc_typedef(name): + global data + data = data[:data.find('\ntypedef ' + name):] + data = data[:data.rfind('\n */')] + data = data[data.rfind('/**\n') + len('/**\n'):] + data = [line[3:] for line in data.split('\n')] + print('\n'.join(data)) + + def doc_define(): global data - i = data.find('\n#define ' + sys.argv[2]) - data = data[:i] - i = data.rfind('\n */') - data = data[:i] - i = data.rfind('/**\n') - data = data[i + len('/**\n'):] + data = data[:data.find('\n#define ' + sys.argv[2])] + data = data[:data.rfind('\n */')] + data = data[data.rfind('/**\n') + len('/**\n'):] data = [line[3:] for line in data.split('\n')] print('\n'.join(data)) @@ -82,12 +88,9 @@ def doc_enum(): global data 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 = data[:data.find('\n' + sys.argv[2])] + data = data[:data.rfind('\n*/')] + data = data[data.rfind('/**\n') + len('/**\n'):] data = [line[2:] for line in data.split('\n')] print('\n'.join(data)) @@ -100,20 +103,20 @@ def doc_struct(name): 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] + data = data[:data.find('\n' + line)] 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 = data[:data.rfind('\n*/')] + data = data[data.rfind('/**\n') + len('/**\n'):] data = [line[2:] for line in data.split('\n')] print('\n'.join(data)) struct_map = {'--info-t' : 'libgamma_crtc_information', - '--cap-t' : 'libgamma_method_capabilities'} + '--cap-t' : 'libgamma_method_capabilities', + '--site-t' : 'libgamma_site_state', + '--part-t' : 'libgamma_partition_state', + '--crtc-t' : 'libgamma_crtc_state'} if sys.argv[1] == '--list': if sys.argv[2] == '--method': list_define('LIBGAMMA_METHOD_', 'MAX', 'COUNT') @@ -123,6 +126,8 @@ if sys.argv[1] == '--list': elif sys.argv[2] in struct_map: list_struct(struct_map[sys.argv[2]]) elif sys.argv[1] == '--type': if sys.argv[2] in struct_map: type_struct(struct_map[sys.argv[2]]) +elif sys.argv[1] == '--doc': + if sys.argv[2] in struct_map: doc_typedef('struct ' + struct_map[sys.argv[2]]) else: if sys.argv[1] in ('--method', '--info'): doc_define() elif sys.argv[1] in ('--connector', '--subpixel'): doc_enum() |