aboutsummaryrefslogtreecommitdiffstats
path: root/info
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-28 06:17:08 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-28 06:20:23 +0200
commit5fdffde89ad7a24001b8aa49c243fbbcd6fedbbf (patch)
treed2dedd186cad15c3983ea3af33fbaacc6f58ba3c /info
parentnamespace some definitions (diff)
downloadlibgamma-5fdffde89ad7a24001b8aa49c243fbbcd6fedbbf.tar.gz
libgamma-5fdffde89ad7a24001b8aa49c243fbbcd6fedbbf.tar.bz2
libgamma-5fdffde89ad7a24001b8aa49c243fbbcd6fedbbf.tar.xz
info: errors
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'info')
-rwxr-xr-xinfo/libgamma-error-extract41
-rw-r--r--info/libgamma.texinfo48
-rwxr-xr-xinfo/texise32
3 files changed, 121 insertions, 0 deletions
diff --git a/info/libgamma-error-extract b/info/libgamma-error-extract
new file mode 100755
index 0000000..3f4aa1f
--- /dev/null
+++ b/info/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]) + '/../src/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/info/libgamma.texinfo b/info/libgamma.texinfo
index 1869145..2a7ea57 100644
--- a/info/libgamma.texinfo
+++ b/info/libgamma.texinfo
@@ -29,6 +29,9 @@ Texts. A copy of the license is included in the section entitled
@end quotation
@end copying
+£>set -u
+£>cd info
+
@ifnottex
@node Top
@top libgamma -- Display server abstraction layer for gamma ramp adjustments
@@ -382,6 +385,10 @@ and for the freedom of all.
@node API
@chapter API
+@menu
+* Errors:: Error codes and how to handle errors.
+@end menu
+
To use @command{libgamma} add ``@code{#include <libgamma.h>}''
to and C file or C header file that requires anything
from @command{libgamma}. @file{libgamma.h} is the only
@@ -446,6 +453,47 @@ You may also want to add checks for update to
+@node Errors
+@section Errors
+
+Many @command{libgamma} functions will return
+@command{libgamma} specific error codes rather
+than setting @code{errno} and return @code{-1}.
+However @code{errno} may have been set, but
+should in such case be ignored unless
+@code{LIBGAMMA_ERRNO_SET} has been returned.
+Other functions do set @code{errno} and return
+@code{-1}. Other functions may store the error
+code. In this case @code{LIBGAMMA_ERRNO_SET}
+cannot be stored but the value that @code{errno}
+had when an error occured can be stored instead
+of a @command{libgamma} specific error codes.
+@code{errno} values are allows positive whereas
+@command{libgamma} specific error codes are
+allows negative. On success zero is returned
+or stored.
+
+If @code{LIBGAMMA_DEVICE_REQUIRE_GROUP} is returned
+the ID of the required group is stored in
+@code{libgamma_group_gid} and the name of that
+group is stored in @code{libgamma_group_name}.
+@code{NULL} is stored if the name of the group
+cannto be determined. @file{libgamma.h} give
+you access to these variables, they are defined
+as @code{gid_t} and @code{const char*} types
+respectively.
+
+@command{libgamma} defines the following error codes
+that its functions may return:
+@table @code
+£>for err in $(libgamma-error-extract --list); do
+@item £{err}
+£>libgamma-error-extract $err | texise
+£>done
+@end table
+
+
+
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include fdl.texinfo
diff --git a/info/texise b/info/texise
new file mode 100755
index 0000000..c778777
--- /dev/null
+++ b/info/texise
@@ -0,0 +1,32 @@
+#!/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
+
+data = sys.stdin.read()[:-1]
+
+n = 0
+while '`' in data:
+ i = data.find('`')
+ replacement = '@code{' if n % 2 == 0 else '}'
+ data = data[:i] + replacement + data[i + 1:]
+ n += 1
+
+print(data)
+