diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-31 07:32:09 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-31 07:32:09 +0200 |
commit | bdeb7f77f16b1e482904866ff21e43f8bfc01bb0 (patch) | |
tree | e5587a577db53a58ea52fd2579fa0cbb89007491 /src | |
parent | split out error identification for failure of open from libgamma_linux_drm_partition_initialise (diff) | |
download | libgamma-bdeb7f77f16b1e482904866ff21e43f8bfc01bb0.tar.gz libgamma-bdeb7f77f16b1e482904866ff21e43f8bfc01bb0.tar.bz2 libgamma-bdeb7f77f16b1e482904866ff21e43f8bfc01bb0.tar.xz |
move files around
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/extract/libgamma-error-extract | 41 | ||||
-rwxr-xr-x | src/extract/libgamma-method-extract | 44 | ||||
-rw-r--r-- | src/lib/edid.c (renamed from src/edid.c) | 0 | ||||
-rw-r--r-- | src/lib/edid.h (renamed from src/edid.h) | 0 | ||||
-rw-r--r-- | src/lib/fake-quartz-cg.c (renamed from src/fake-quartz-cg.c) | 0 | ||||
-rw-r--r-- | src/lib/fake-quartz-cg.h (renamed from src/fake-quartz-cg.h) | 0 | ||||
-rw-r--r-- | src/lib/fake-w32-gdi.c (renamed from src/fake-w32-gdi.c) | 0 | ||||
-rw-r--r-- | src/lib/fake-w32-gdi.h (renamed from src/fake-w32-gdi.h) | 0 | ||||
-rw-r--r-- | src/lib/gamma-dummy.c (renamed from src/gamma-dummy.c) | 0 | ||||
-rw-r--r-- | src/lib/gamma-dummy.h (renamed from src/gamma-dummy.h) | 0 | ||||
-rw-r--r-- | src/lib/gamma-helper.c (renamed from src/gamma-helper.c) | 0 | ||||
-rw-r--r-- | src/lib/gamma-helper.h (renamed from src/gamma-helper.h) | 0 | ||||
-rw-r--r-- | src/lib/gamma-linux-drm.c (renamed from src/gamma-linux-drm.c) | 0 | ||||
-rw-r--r-- | src/lib/gamma-linux-drm.h (renamed from src/gamma-linux-drm.h) | 0 | ||||
-rw-r--r-- | src/lib/gamma-quartz-cg.c (renamed from src/gamma-quartz-cg.c) | 0 | ||||
-rw-r--r-- | src/lib/gamma-quartz-cg.h (renamed from src/gamma-quartz-cg.h) | 0 | ||||
-rw-r--r-- | src/lib/gamma-w32-gdi.c (renamed from src/gamma-w32-gdi.c) | 0 | ||||
-rw-r--r-- | src/lib/gamma-w32-gdi.h (renamed from src/gamma-w32-gdi.h) | 0 | ||||
-rw-r--r-- | src/lib/gamma-x-randr.c (renamed from src/gamma-x-randr.c) | 0 | ||||
-rw-r--r-- | src/lib/gamma-x-randr.h (renamed from src/gamma-x-randr.h) | 0 | ||||
-rw-r--r-- | src/lib/gamma-x-vidmode.c (renamed from src/gamma-x-vidmode.c) | 0 | ||||
-rw-r--r-- | src/lib/gamma-x-vidmode.h (renamed from src/gamma-x-vidmode.h) | 0 | ||||
-rw-r--r-- | src/lib/libgamma-error.c.gpp (renamed from src/libgamma-error.c.gpp) | 2 | ||||
-rw-r--r-- | src/lib/libgamma-error.h (renamed from src/libgamma-error.h) | 0 | ||||
-rw-r--r-- | src/lib/libgamma-facade.c (renamed from src/libgamma-facade.c) | 0 | ||||
-rw-r--r-- | src/lib/libgamma-facade.h (renamed from src/libgamma-facade.h) | 0 | ||||
-rw-r--r-- | src/lib/libgamma-method.c (renamed from src/libgamma-method.c) | 0 | ||||
-rw-r--r-- | src/lib/libgamma-method.h (renamed from src/libgamma-method.h) | 0 | ||||
-rw-r--r-- | src/lib/libgamma.h (renamed from src/libgamma.h) | 0 | ||||
-rw-r--r-- | src/test/test.c | 61 |
30 files changed, 147 insertions, 1 deletions
diff --git a/src/extract/libgamma-error-extract b/src/extract/libgamma-error-extract new file mode 100755 index 0000000..09169f8 --- /dev/null +++ b/src/extract/libgamma-error-extract @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# -*- python -*- + +# 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/>. + +import sys +import os + +with open(os.path.dirname(sys.argv[0]) + '/../lib/libgamma-error.h', 'rb') as file: + data = file.read() +data = data.decode('utf-8', 'error') + +if sys.argv[1] == '--list': + defs = [line for line in data.split('\n') if line.startswith('#define') and not line.endswith('_H')] + defs = [line.split(' ')[1] for line in defs if 'LIBGAMMA_ERROR_MIN' not in line] + print('\n'.join(defs)) + +else: + i = data.find('\n#define ' + sys.argv[1]) + data = data[:i] + i = data.rfind('\n */') + data = data[:i] + i = data.rfind('/**\n') + data = data[i + len('/**\n'):] + data = [line[3:] for line in data.split('\n')] + print('\n'.join(data)) + diff --git a/src/extract/libgamma-method-extract b/src/extract/libgamma-method-extract new file mode 100755 index 0000000..983f606 --- /dev/null +++ b/src/extract/libgamma-method-extract @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# -*- python -*- + +# 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/>. + +import sys +import os + +with open(os.path.dirname(sys.argv[0]) + '/../lib/libgamma-method.h', 'rb') as file: + data = file.read() +data = data.decode('utf-8', 'error') + +if sys.argv[1] == '--list': + if sys.argv[2] == '--method': + test1 = lambda line : line.startswith('#define LIBGAMMA_METHOD_') + test2 = lambda line : line.split(' ')[1] not in ('LIBGAMMA_METHOD_MAX', 'LIBGAMMA_METHOD_COUNT') + 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])) +else: + if sys.argv[1] == '--method': + 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 = [line[3:] for line in data.split('\n')] + print('\n'.join(data)) + diff --git a/src/edid.c b/src/lib/edid.c index 76867c7..76867c7 100644 --- a/src/edid.c +++ b/src/lib/edid.c diff --git a/src/edid.h b/src/lib/edid.h index 68df0e9..68df0e9 100644 --- a/src/edid.h +++ b/src/lib/edid.h diff --git a/src/fake-quartz-cg.c b/src/lib/fake-quartz-cg.c index f599dbb..f599dbb 100644 --- a/src/fake-quartz-cg.c +++ b/src/lib/fake-quartz-cg.c diff --git a/src/fake-quartz-cg.h b/src/lib/fake-quartz-cg.h index 8f995ea..8f995ea 100644 --- a/src/fake-quartz-cg.h +++ b/src/lib/fake-quartz-cg.h diff --git a/src/fake-w32-gdi.c b/src/lib/fake-w32-gdi.c index 541b3c8..541b3c8 100644 --- a/src/fake-w32-gdi.c +++ b/src/lib/fake-w32-gdi.c diff --git a/src/fake-w32-gdi.h b/src/lib/fake-w32-gdi.h index 1995847..1995847 100644 --- a/src/fake-w32-gdi.h +++ b/src/lib/fake-w32-gdi.h diff --git a/src/gamma-dummy.c b/src/lib/gamma-dummy.c index e508b4a..e508b4a 100644 --- a/src/gamma-dummy.c +++ b/src/lib/gamma-dummy.c diff --git a/src/gamma-dummy.h b/src/lib/gamma-dummy.h index 342d119..342d119 100644 --- a/src/gamma-dummy.h +++ b/src/lib/gamma-dummy.h diff --git a/src/gamma-helper.c b/src/lib/gamma-helper.c index dd4e027..dd4e027 100644 --- a/src/gamma-helper.c +++ b/src/lib/gamma-helper.c diff --git a/src/gamma-helper.h b/src/lib/gamma-helper.h index e0711ff..e0711ff 100644 --- a/src/gamma-helper.h +++ b/src/lib/gamma-helper.h diff --git a/src/gamma-linux-drm.c b/src/lib/gamma-linux-drm.c index 36ba442..36ba442 100644 --- a/src/gamma-linux-drm.c +++ b/src/lib/gamma-linux-drm.c diff --git a/src/gamma-linux-drm.h b/src/lib/gamma-linux-drm.h index 3d244aa..3d244aa 100644 --- a/src/gamma-linux-drm.h +++ b/src/lib/gamma-linux-drm.h diff --git a/src/gamma-quartz-cg.c b/src/lib/gamma-quartz-cg.c index 3832ca5..3832ca5 100644 --- a/src/gamma-quartz-cg.c +++ b/src/lib/gamma-quartz-cg.c diff --git a/src/gamma-quartz-cg.h b/src/lib/gamma-quartz-cg.h index 90f5244..90f5244 100644 --- a/src/gamma-quartz-cg.h +++ b/src/lib/gamma-quartz-cg.h diff --git a/src/gamma-w32-gdi.c b/src/lib/gamma-w32-gdi.c index f8c00ee..f8c00ee 100644 --- a/src/gamma-w32-gdi.c +++ b/src/lib/gamma-w32-gdi.c diff --git a/src/gamma-w32-gdi.h b/src/lib/gamma-w32-gdi.h index 0e17720..0e17720 100644 --- a/src/gamma-w32-gdi.h +++ b/src/lib/gamma-w32-gdi.h diff --git a/src/gamma-x-randr.c b/src/lib/gamma-x-randr.c index 9870f6b..9870f6b 100644 --- a/src/gamma-x-randr.c +++ b/src/lib/gamma-x-randr.c diff --git a/src/gamma-x-randr.h b/src/lib/gamma-x-randr.h index dc1ecdc..dc1ecdc 100644 --- a/src/gamma-x-randr.h +++ b/src/lib/gamma-x-randr.h diff --git a/src/gamma-x-vidmode.c b/src/lib/gamma-x-vidmode.c index a73f36f..a73f36f 100644 --- a/src/gamma-x-vidmode.c +++ b/src/lib/gamma-x-vidmode.c diff --git a/src/gamma-x-vidmode.h b/src/lib/gamma-x-vidmode.h index 8378726..8378726 100644 --- a/src/gamma-x-vidmode.h +++ b/src/lib/gamma-x-vidmode.h diff --git a/src/libgamma-error.c.gpp b/src/lib/libgamma-error.c.gpp index 9b274ab..d443f74 100644 --- a/src/libgamma-error.c.gpp +++ b/src/lib/libgamma-error.c.gpp @@ -28,7 +28,7 @@ £>set -u -£>cd info +£>cd src/extract £>export PATH=".:${PATH}" diff --git a/src/libgamma-error.h b/src/lib/libgamma-error.h index 06a7077..06a7077 100644 --- a/src/libgamma-error.h +++ b/src/lib/libgamma-error.h diff --git a/src/libgamma-facade.c b/src/lib/libgamma-facade.c index c94d9e3..c94d9e3 100644 --- a/src/libgamma-facade.c +++ b/src/lib/libgamma-facade.c diff --git a/src/libgamma-facade.h b/src/lib/libgamma-facade.h index fdf46ae..fdf46ae 100644 --- a/src/libgamma-facade.h +++ b/src/lib/libgamma-facade.h diff --git a/src/libgamma-method.c b/src/lib/libgamma-method.c index 4c81549..4c81549 100644 --- a/src/libgamma-method.c +++ b/src/lib/libgamma-method.c diff --git a/src/libgamma-method.h b/src/lib/libgamma-method.h index 8496631..8496631 100644 --- a/src/libgamma-method.h +++ b/src/lib/libgamma-method.h diff --git a/src/libgamma.h b/src/lib/libgamma.h index 9a5b9be..9a5b9be 100644 --- a/src/libgamma.h +++ b/src/lib/libgamma.h diff --git a/src/test/test.c b/src/test/test.c new file mode 100644 index 0000000..011136e --- /dev/null +++ b/src/test/test.c @@ -0,0 +1,61 @@ +/** + * 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/>. + */ +#include <libgamma.h> + +#include <stdio.h> +#include <stdlib.h> + + +static const char* method_name(int method) +{ + switch (method) + { + case LIBGAMMA_METHOD_DUMMY: return "dummy"; + case LIBGAMMA_METHOD_X_RANDR: return "RandR X extension"; + case LIBGAMMA_METHOD_X_VIDMODE: return "VidMode X extension"; + case LIBGAMMA_METHOD_LINUX_DRM: return "Linux DRM"; + case LIBGAMMA_METHOD_W32_GDI: return "Windows GDI"; + case LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS: return "Quartz using CoreGraphics"; + default: +#if LIBGAMMA_METHOD_COUNT != 6 +# warning List of adjustment methods is out of date +#endif + return "(unknown)"; + } +} + + +int main(void) +{ + int* methods = malloc(LIBGAMMA_METHOD_COUNT * sizeof(int)); + size_t n = libgamma_list_methods(methods, LIBGAMMA_METHOD_COUNT, 0); + size_t i; + + if (n > LIBGAMMA_METHOD_COUNT) + { + printf("Warning: you should to recompile the program, libgamma has been updated.\n"); + methods = realloc(methods, n * sizeof(int)); + libgamma_list_methods(methods, n, 0); + } + + for (i = 0; i < n; i++) + printf("%s\n", method_name(methods[i])); + + return 0; +} + |