aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-08-09 17:10:34 +0200
committerMattias Andrée <maandree@kth.se>2018-08-09 17:10:34 +0200
commitc49204d755be85998361e9a3d04755a78362a72c (patch)
tree3cfa95ce3e567d7bed1317f4498fbf3f66913ecc
parentDisable global interpretor lock while running external C code (diff)
downloadpylibcoopgamma-c49204d755be85998361e9a3d04755a78362a72c.tar.gz
pylibcoopgamma-c49204d755be85998361e9a3d04755a78362a72c.tar.bz2
pylibcoopgamma-c49204d755be85998361e9a3d04755a78362a72c.tar.xz
Fix Python 3.7 compatility1.1.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--src/libcoopgamma.py76
-rw-r--r--src/libcoopgamma_native.pyx.gpp186
-rwxr-xr-xsrc/test38
3 files changed, 150 insertions, 150 deletions
diff --git a/src/libcoopgamma.py b/src/libcoopgamma.py
index 65cbc63..37856c1 100644
--- a/src/libcoopgamma.py
+++ b/src/libcoopgamma.py
@@ -869,7 +869,7 @@ class Context:
Send all pending outbound data
If this function or another function that sends a request to the server fails
- with EINTR, call this function to complete the transfer. The `async` parameter
+ with EINTR, call this function to complete the transfer. The `async_ctx` parameter
will always be in a properly configured state if a function fails with EINTR.
'''
error = libcoopgamma_native.libcoopgamma_native_flush(self.address)
@@ -906,28 +906,28 @@ class Context:
'''
libcoopgamma_native.libcoopgamma_native_skip_message(self.address)
- def get_crtcs_send(self, async):
+ def get_crtcs_send(self, async_ctx):
'''
List all available CRTC:s, send request part
- @param async:AsyncContext Slot for information about the request that is
- needed to identify and parse the response
+ @param async_ctx:AsyncContext Slot for information about the request that is
+ needed to identify and parse the response
'''
- error = libcoopgamma_native.libcoopgamma_native_get_crtcs_send(self.address, async.address)
+ error = libcoopgamma_native.libcoopgamma_native_get_crtcs_send(self.address, async_ctx.address)
if error != 0:
raise ErrorReport.create_error(error)
- def get_crtcs_recv(self, async):
+ def get_crtcs_recv(self, async_ctx):
'''
List all available CRTC:s, receive response part
- @param async:AsyncContext Information about the request
- @return :list<str> A list of names. You should only free the outer
- pointer, inner pointers are subpointers of the
- outer pointer and cannot be freed.
+ @param async_ctx:AsyncContext Information about the request
+ @return :list<str> A list of names. You should only free the outer
+ pointer, inner pointers are subpointers of the
+ outer pointer and cannot be freed.
'''
- ret = libcoopgamma_native.libcoopgamma_native_get_crtcs_recv(self.address, async.address)
+ ret = libcoopgamma_native.libcoopgamma_native_get_crtcs_recv(self.address, async_ctx.address)
if isinstance(ret, int):
raise ErrorReport.create_error(ret)
return ret
@@ -949,26 +949,26 @@ class Context:
raise ErrorReport.create_error(ret)
return ret
- def get_gamma_info_send(self, crtc, async):
+ def get_gamma_info_send(self, crtc, async_ctx):
'''
Retrieve information about a CRTC:s gamma ramps, send request part
- @param crtc:str The name of the CRT
- @param async:AsyncContext Slot for information about the request that is
- needed to identify and parse the response
+ @param crtc:str The name of the CRT
+ @param async_ctx:AsyncContext Slot for information about the request that is
+ needed to identify and parse the response
'''
- error = libcoopgamma_native.libcoopgamma_native_get_gamma_info_send(crtc, self.address, async.address)
+ error = libcoopgamma_native.libcoopgamma_native_get_gamma_info_send(crtc, self.address, async_ctx.address)
if error != 0:
raise ErrorReport.create_error(error)
- def get_gamma_info_recv(self, async):
+ def get_gamma_info_recv(self, async_ctx):
'''
Retrieve information about a CRTC:s gamma ramps, receive response part
- @param async:AsyncContext Information about the request
- @return :CRTCInfo Information about the CRTC
+ @param async_ctx:AsyncContext Information about the request
+ @return :CRTCInfo Information about the CRTC
'''
- value = libcoopgamma_native.libcoopgamma_native_get_gamma_info_recv(self.address, async.address)
+ value = libcoopgamma_native.libcoopgamma_native_get_gamma_info_recv(self.address, async_ctx.address)
if isinstance(value, int):
raise ErrorReport.create_error(value)
(successful, value) = value
@@ -996,27 +996,27 @@ class Context:
raise ErrorReport.create_error(value)
return CRTCInfo(*value)
- def get_gamma_send(self, query, async):
+ def get_gamma_send(self, query, async_ctx):
'''
Retrieve the current gamma ramp adjustments, send request part
- @param query:FilterQuery The query to send
- @param async:AsyncContext Slot for information about the request that is
- needed to identify and parse the response
+ @param query:FilterQuery The query to send
+ @param async_ctx:AsyncContext Slot for information about the request that is
+ needed to identify and parse the response
'''
error = libcoopgamma_native.libcoopgamma_native_get_gamma_send(
- query, self.address, async.address)
+ query, self.address, async_ctx.address)
if error != 0:
raise ErrorReport.create_error(error)
- def get_gamma_recv(self, async):
+ def get_gamma_recv(self, async_ctx):
'''
Retrieve the current gamma ramp adjustments, receive response part
- @param async:AsyncContext Information about the request
- @return :FilterTable Filter table
+ @param async_ctx:AsyncContext Information about the request
+ @return :FilterTable Filter table
'''
- value = libcoopgamma_native.libcoopgamma_native_get_gamma_recv(self.address, async.address)
+ value = libcoopgamma_native.libcoopgamma_native_get_gamma_recv(self.address, async_ctx.address)
if isinstance(value, int):
raise ErrorReport.create_error(value)
(successful, value) = value
@@ -1044,26 +1044,26 @@ class Context:
raise ErrorReport.create_error(value)
return FilterTable(*value)
- def set_gamma_send(self, filtr, async):
+ def set_gamma_send(self, filtr, async_ctx):
'''
Apply, update, or remove a gamma ramp adjustment, send request part
- @param filtr:Filter The filter to apply, update, or remove, gamma ramp
- meta-data must match the CRTC's
- @param async:AsyncContext Slot for information about the request that is
- needed to identify and parse the response
+ @param filtr:Filter The filter to apply, update, or remove, gamma ramp
+ meta-data must match the CRTC's
+ @param async_ctx:AsyncContext Slot for information about the request that is
+ needed to identify and parse the response
'''
- error = libcoopgamma_native.libcoopgamma_native_set_gamma_send(filtr, self.address, async.address)
+ error = libcoopgamma_native.libcoopgamma_native_set_gamma_send(filtr, self.address, async_ctx.address)
if error != 0:
raise ErrorReport.create_error(error)
- def set_gamma_recv(self, async):
+ def set_gamma_recv(self, async_ctx):
'''
Apply, update, or remove a gamma ramp adjustment, receive response part
- @param async:AsyncContext Information about the request
+ @param async_ctx:AsyncContext Information about the request
'''
- error = libcoopgamma_native.libcoopgamma_native_set_gamma_recv(self.address, async.address)
+ error = libcoopgamma_native.libcoopgamma_native_set_gamma_recv(self.address, async_ctx.address)
if error is not None:
raise ErrorReport.create_error(error)
diff --git a/src/libcoopgamma_native.pyx.gpp b/src/libcoopgamma_native.pyx.gpp
index 2f57023..eee05ec 100644
--- a/src/libcoopgamma_native.pyx.gpp
+++ b/src/libcoopgamma_native.pyx.gpp
@@ -578,7 +578,7 @@ Send all pending outbound data
If this function or another function that sends a request
to the server fails with EINTR, call this function to
-complete the transfer. The `async` parameter will always
+complete the transfer. The `async_ctx` parameter will always
be in a properly configured state if a function fails
with EINTR.
@@ -615,29 +615,29 @@ Tell the library that you will not be parsing a receive message
@param ctx The state of the library, must be connected
'''
-cdef extern int libcoopgamma_get_crtcs_send(libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async) nogil
+cdef extern int libcoopgamma_get_crtcs_send(libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async_ctx) nogil
'''
List all available CRTC:s, send request part
Cannot be used before connecting to the server
-@param ctx The state of the library, must be connected
-@param async Information about the request, that is needed to
- identify and parse the response, is stored here
-@return Zero on success, -1 on error
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request, that is needed to
+ identify and parse the response, is stored here
+@return Zero on success, -1 on error
'''
-cdef extern char** libcoopgamma_get_crtcs_recv(libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async) nogil
+cdef extern char** libcoopgamma_get_crtcs_recv(libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async_ctx) nogil
'''
List all available CRTC:s, receive response part
-@param ctx The state of the library, must be connected
-@param async Information about the request
-@return A `NULL`-terminated list of names. You should only free
- the outer pointer, inner pointers are subpointers of the
- outer pointer and cannot be freed. `NULL` on error, in
- which case `ctx->error` (rather than `errno`) is read
- for information about the error.
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request
+@return A `NULL`-terminated list of names. You should only free
+ the outer pointer, inner pointers are subpointers of the
+ outer pointer and cannot be freed. `NULL` on error, in
+ which case `ctx->error` (rather than `errno`) is read
+ for information about the error.
'''
cdef extern char** libcoopgamma_get_crtcs_sync(libcoopgamma_context_t* ctx) nogil
@@ -660,29 +660,29 @@ operation without disconnection from the server
'''
cdef extern int libcoopgamma_get_gamma_info_send(const char* crtc, libcoopgamma_context_t* ctx,
- libcoopgamma_async_context_t* async) nogil
+ libcoopgamma_async_context_t* async_ctx) nogil
'''
Retrieve information about a CRTC:s gamma ramps, send request part
Cannot be used before connecting to the server
-@param crtc The name of the CRTC
-@param ctx The state of the library, must be connected
-@param async Information about the request, that is needed to
- identify and parse the response, is stored here
-@return Zero on success, -1 on error
+@param crtc The name of the CRTC
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request, that is needed to
+ identify and parse the response, is stored here
+@return Zero on success, -1 on error
'''
cdef extern int libcoopgamma_get_gamma_info_recv(libcoopgamma_crtc_info_t* info, libcoopgamma_context_t* ctx,
- libcoopgamma_async_context_t* async) nogil
+ libcoopgamma_async_context_t* async_ctx) nogil
'''
Retrieve information about a CRTC:s gamma ramps, receive response part
-@param info Output parameter for the information, must be initialised
-@param ctx The state of the library, must be connected
-@param async Information about the request
-@return Zero on success, -1 on error, in which case `ctx->error`
- (rather than `errno`) is read for information about the error
+@param info Output parameter for the information, must be initialised
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request
+@return Zero on success, -1 on error, in which case `ctx->error`
+ (rather than `errno`) is read for information about the error
'''
cdef extern int libcoopgamma_get_gamma_info_sync(const char* crtc, libcoopgamma_crtc_info_t* info,
@@ -705,29 +705,29 @@ operation without disconnection from the server
'''
cdef extern int libcoopgamma_get_gamma_send(const libcoopgamma_filter_query_t* query,
- libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async) nogil
+ libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async_ctx) nogil
'''
Retrieve the current gamma ramp adjustments, send request part
Cannot be used before connecting to the server
-@param query The query to send
-@param ctx The state of the library, must be connected
-@param async Information about the request, that is needed to
- identify and parse the response, is stored here
-@return Zero on success, -1 on error
+@param query The query to send
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request, that is needed to
+ identify and parse the response, is stored here
+@return Zero on success, -1 on error
'''
cdef extern int libcoopgamma_get_gamma_recv(libcoopgamma_filter_table_t* table, libcoopgamma_context_t* ctx,
- libcoopgamma_async_context_t* async) nogil
+ libcoopgamma_async_context_t* async_ctx) nogil
'''
Retrieve the current gamma ramp adjustments, receive response part
-@param table Output for the response, must be initialised
-@param ctx The state of the library, must be connected
-@param async Information about the request
-@return Zero on success, -1 on error, in which case `ctx->error`
- (rather than `errno`) is read for information about the error
+@param table Output for the response, must be initialised
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request
+@return Zero on success, -1 on error, in which case `ctx->error`
+ (rather than `errno`) is read for information about the error
'''
cdef extern int libcoopgamma_get_gamma_sync(const libcoopgamma_filter_query_t* query,
@@ -750,27 +750,27 @@ operation without disconnection from the server
'''
cdef extern int libcoopgamma_set_gamma_send(const libcoopgamma_filter_t* filtr, libcoopgamma_context_t* ctx,
- libcoopgamma_async_context_t* async) nogil
+ libcoopgamma_async_context_t* async_ctx) nogil
'''
Apply, update, or remove a gamma ramp adjustment, send request part
Cannot be used before connecting to the server
-@param filtr The filter to apply, update, or remove, gamma ramp meta-data must match the CRTC's
-@param ctx The state of the library, must be connected
-@param async Information about the request, that is needed to
- identify and parse the response, is stored here
-@return Zero on success, -1 on error
+@param filtr The filter to apply, update, or remove, gamma ramp meta-data must match the CRTC's
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request, that is needed to
+ identify and parse the response, is stored here
+@return Zero on success, -1 on error
'''
-cdef extern int libcoopgamma_set_gamma_recv(libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async) nogil
+cdef extern int libcoopgamma_set_gamma_recv(libcoopgamma_context_t* ctx, libcoopgamma_async_context_t* async_ctx) nogil
'''
Apply, update, or remove a gamma ramp adjustment, receive response part
-@param ctx The state of the library, must be connected
-@param async Information about the request
-@return Zero on success, -1 on error, in which case `ctx->error`
- (rather than `errno`) is read for information about the error
+@param ctx The state of the library, must be connected
+@param async_ctx Information about the request
+@return Zero on success, -1 on error, in which case `ctx->error`
+ (rather than `errno`) is read for information about the error
'''
cdef extern int libcoopgamma_set_gamma_sync(const libcoopgamma_filter_t* filtr, libcoopgamma_context_t* ctx) nogil
@@ -1198,7 +1198,7 @@ def libcoopgamma_native_flush(address : int):
If this function or another function that sends a request
to the server fails with EINTR, call this function to
- complete the transfer. The `async` parameter will always
+ complete the transfer. The `async_ctx` parameter will always
be in a properly configured state if a function fails
with EINTR.
@@ -1247,32 +1247,32 @@ def libcoopgamma_native_skip_message(address : int):
libcoopgamma_skip_message(<libcoopgamma_context_t*><void*><intptr_t>address)
-def libcoopgamma_native_get_crtcs_send(address : int, async : int):
+def libcoopgamma_native_get_crtcs_send(address : int, async_ctx : int):
'''
List all available CRTC:s, send request part
- @param address:int The address of the state of the library, must be connected
- @param async:int The address of the `AsyncContext` for the request
- @return :int Zero on success, the value of `errno` on failure
+ @param address:int The address of the state of the library, must be connected
+ @param async_ctx:int The address of the `AsyncContext` for the request
+ @return :int Zero on success, the value of `errno` on failure
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
if libcoopgamma_get_crtcs_send(ctx, actx) < 0:
return int(errno)
return 0
-def libcoopgamma_native_get_crtcs_recv(address : int, async : int):
+def libcoopgamma_native_get_crtcs_recv(address : int, async_ctx : int):
'''
List all available CRTC:s, receive response part
@param address:int The address of the state of the library, must be connected
- @param async:int The address of the `AsyncContext` for the request
+ @param async_ctx:int The address of the `AsyncContext` for the request
@return :int|list<str> The value of `errno` (on failure), or (on success)
a list of the names of the available CRTC:s
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
cdef char** crtcs = libcoopgamma_get_crtcs_recv(ctx, actx)
cdef bytes bs
if crtcs is NULL:
@@ -1319,20 +1319,20 @@ def libcoopgamma_native_get_crtcs_sync(address : int):
return ret
-def libcoopgamma_native_get_gamma_info_send(crtc : str, address : int, async : int):
+def libcoopgamma_native_get_gamma_info_send(crtc : str, address : int, async_ctx : int):
'''
Retrieve information about a CRTC:s gamma ramps, send request part
Cannot be used before connecting to the server
- @param crtc:crtc The name of the CRTC
- @param address:int The address of the state of the library, must be connected
- @param async:int The address of the information about the request, that is
- needed to identify and parse the response, is stored here
- @return :int Zero on success, the value of `errno` on error
+ @param crtc:crtc The name of the CRTC
+ @param address:int The address of the state of the library, must be connected
+ @param async_ctx:int The address of the information about the request, that is
+ needed to identify and parse the response, is stored here
+ @return :int Zero on success, the value of `errno` on error
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
cdef char* ccrtc = NULL
try:
bs = crtc.encode('utf-8') + bytes([0])
@@ -1348,18 +1348,18 @@ def libcoopgamma_native_get_gamma_info_send(crtc : str, address : int, async : i
return 0
-def libcoopgamma_native_get_gamma_info_recv(address : int, async : int):
+def libcoopgamma_native_get_gamma_info_recv(address : int, async_ctx : int):
'''
Retrieve information about a CRTC:s gamma ramps, receive response part
@param address:int The address of the state of the library, must be connected
- @param async:int The address of the information about the request
+ @param async_ctx:int The address of the information about the request
@return :int|(:bool, :tuple) The value of `errno` (on failure) or:
Element 0: whether the call was successful
Element 1: tuple with the data for the structure response (possibly error)
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
cdef libcoopgamma_crtc_info_t info
cdef bytes bs
try:
@@ -1428,21 +1428,21 @@ def libcoopgamma_native_get_gamma_info_sync(crtc : str, address : int):
return ret
-def libcoopgamma_native_get_gamma_send(query, address : int, async : int):
+def libcoopgamma_native_get_gamma_send(query, address : int, async_ctx : int):
'''
Retrieve the current gamma ramp adjustments, send request part
Cannot be used before connecting to the server
- @param query:Query The query to send
- @param address:int The address of the state of the library, must be connected
- @param async:int The address of the information about the request, that is
- needed to identify and parse the response, is stored here
- @return Zero on success, the value of `errno` on failure
+ @param query:Query The query to send
+ @param address:int The address of the state of the library, must be connected
+ @param async_ctx:int The address of the information about the request, that is
+ needed to identify and parse the response, is stored here
+ @return Zero on success, the value of `errno` on failure
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
cdef libcoopgamma_filter_query_t qry
crtc_bs = query.crtc.encode('utf-8') + bytes([0])
qry.high_priority = <int64_t>(query.high_priority)
@@ -1461,18 +1461,18 @@ def libcoopgamma_native_get_gamma_send(query, address : int, async : int):
return 0
-def libcoopgamma_native_get_gamma_recv(address : int, async : int):
+def libcoopgamma_native_get_gamma_recv(address : int, async_ctx : int):
'''
Retrieve the current gamma ramp adjustments, receive response part
@param address:int The address of the state of the library, must be connected
- @param async:int The address of the information about the request
+ @param async_ctx:int The address of the information about the request
@return :int|(:bool, :tuple) The value of `errno` (on failure) or:
Element 0: whether the call was successful
Element 1: tuple with the data for the structure response (possibly error)
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
cdef libcoopgamma_filter_table_t table
cdef bytes bs
cdef libcoopgamma_ramps_t* rampsp
@@ -1766,21 +1766,21 @@ def libcoopgamma_native_copy_ramps(intptr_t dest_address, src, libcoopgamma_dept
dest.u_blue = <void*>bd
-def libcoopgamma_native_set_gamma_send(filtr, address : int, async : int):
+def libcoopgamma_native_set_gamma_send(filtr, address : int, async_ctx : int):
'''
Apply, update, or remove a gamma ramp adjustment, send request part
Cannot be used before connecting to the server
- @param filtr:Filter The filter to apply, update, or remove, gamma ramp
- meta-data must match the CRTC's
- @param address:int The address of the state of the library, must be connected
- @param async:int The address of the information about the request, that is needed to
- identify and parse the response, is stored here
- @return :int Zero on success, the value of `errno` on failure
+ @param filtr:Filter The filter to apply, update, or remove, gamma ramp
+ meta-data must match the CRTC's
+ @param address:int The address of the state of the library, must be connected
+ @param async_ctx:int The address of the information about the request, that is needed to
+ identify and parse the response, is stored here
+ @return :int Zero on success, the value of `errno` on failure
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
cdef libcoopgamma_filter_t flr
crtc_bs = filtr.crtc.encode('utf-8') + bytes([0])
clss_bs = filtr.fclass.encode('utf-8') + bytes([0])
@@ -1817,18 +1817,18 @@ def libcoopgamma_native_set_gamma_send(filtr, address : int, async : int):
return 0
-def libcoopgamma_native_set_gamma_recv(address : int, async : int):
+def libcoopgamma_native_set_gamma_recv(address : int, async_ctx : int):
'''
Apply, update, or remove a gamma ramp adjustment, receive response part
- @param address:int The address of the state of the library, must be connected
- @param async:int The address of the information about the request
- @return :tuple? The value of `errno` (on failure) or:
- Element 0: whether the call was successful
- Element 1: tuple with the data for the structure response (possibly error)
+ @param address:int The address of the state of the library, must be connected
+ @param async_ctx:int The address of the information about the request
+ @return :tuple? The value of `errno` (on failure) or:
+ Element 0: whether the call was successful
+ Element 1: tuple with the data for the structure response (possibly error)
'''
cdef libcoopgamma_context_t* ctx = <libcoopgamma_context_t*><void*><intptr_t>address
- cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async
+ cdef libcoopgamma_async_context_t* actx = <libcoopgamma_async_context_t*><void*><intptr_t>async_ctx
cdef bytes bs
if libcoopgamma_set_gamma_recv(ctx, actx) < 0:
desc = None
diff --git a/src/test b/src/test
index eb34691..f2bb71e 100755
--- a/src/test
+++ b/src/test
@@ -159,7 +159,7 @@ time.sleep(0.5)
g.set_nonbreaking(False)
-async = cg.AsyncContext()
+asynch = cg.AsyncContext()
def flush(e):
if e.errno in (errno.EINTR, errno.EWOULDBLOCK, errno.EAGAIN):
@@ -176,21 +176,21 @@ def flush(e):
raise e
try:
- g.get_crtcs_send(async)
+ g.get_crtcs_send(asynch)
except OSError as e:
flush(e)
-if g.synchronise([async]) != 0:
+if g.synchronise([asynch]) != 0:
sys.exit(1)
-if g.get_crtcs_recv(async) != crtcs:
+if g.get_crtcs_recv(asynch) != crtcs:
sys.exit(2)
try:
- g.get_gamma_info_send(crtc, async)
+ g.get_gamma_info_send(crtc, asynch)
except OSError as e:
flush(e)
-if g.synchronise([async]) != 0:
+if g.synchronise([asynch]) != 0:
sys.exit(3)
-info2 = g.get_gamma_info_recv(async)
+info2 = g.get_gamma_info_recv(asynch)
if info2.cooperative != info.cooperative:
sys.exit(4)
if info2.depth != info.depth:
@@ -227,20 +227,20 @@ if info.gamut is not None:
try:
g.set_gamma_send(cg.Filter(crtc = crtc, fclass = 'pylibcoopgamma::test::test',
- lifespan = cg.Lifespan.REMOVE), async)
+ lifespan = cg.Lifespan.REMOVE), asynch)
except OSError as e:
flush(e)
-if g.synchronise([async]) != 0:
+if g.synchronise([asynch]) != 0:
sys.exit(1)
-g.set_gamma_recv(async)
+g.set_gamma_recv(asynch)
try:
- g.get_gamma_send(cg.FilterQuery(crtc = crtc, coalesce = False), async)
+ g.get_gamma_send(cg.FilterQuery(crtc = crtc, coalesce = False), asynch)
except OSError as e:
flush(e)
-if g.synchronise([async]) != 0:
+if g.synchronise([asynch]) != 0:
sys.exit(5)
-table = g.get_gamma_recv(async)
+table = g.get_gamma_recv(asynch)
if table.red_size != table_nc.red_size:
sys.exit(6)
if table.green_size != table_nc.green_size:
@@ -264,12 +264,12 @@ for i, (fltr1, fltr2) in enumerate(zip(table.filters, table_nc.filters)):
sys.exit(6)
try:
- g.get_gamma_send(cg.FilterQuery(crtc = crtc, coalesce = True), async)
+ g.get_gamma_send(cg.FilterQuery(crtc = crtc, coalesce = True), asynch)
except OSError as e:
flush(e)
-if g.synchronise([async]) != 0:
+if g.synchronise([asynch]) != 0:
sys.exit(7)
-table = g.get_gamma_recv(async)
+table = g.get_gamma_recv(asynch)
if table.red_size != table_c.red_size:
sys.exit(8)
if table.green_size != table_c.green_size:
@@ -296,10 +296,10 @@ fltr.ramps.red = list(reversed(redid))
fltr.ramps.green = list(reversed(greenid))
fltr.ramps.blue = list(reversed(blueid))
try:
- g.set_gamma_send(fltr, async)
+ g.set_gamma_send(fltr, asynch)
except OSError as e:
flush(e)
-if g.synchronise([async]) != 0:
+if g.synchronise([asynch]) != 0:
sys.exit(9)
g.skip_message()
time.sleep(0.5)
@@ -311,7 +311,7 @@ g.set_gamma_sync(fltr)
g.set_nonbreaking(True)
-async1 = async
+async1 = asynch
async2 = cg.AsyncContext()
async3 = cg.AsyncContext()
time.sleep(0.5)