diff options
Diffstat (limited to 'libvxi11client/perlbits/perlglue.c')
-rw-r--r-- | libvxi11client/perlbits/perlglue.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/libvxi11client/perlbits/perlglue.c b/libvxi11client/perlbits/perlglue.c index 62d9748..551136e 100644 --- a/libvxi11client/perlbits/perlglue.c +++ b/libvxi11client/perlbits/perlglue.c @@ -1,31 +1,40 @@ -#include <stdbool.h> +#include <EXTERN.h> +#include <perl.h> #include <glib.h> #include "libvxi11client.h" -#define INTERRUPTHANDLE "libvxi11client" - -GAsyncQueue* interruptqueue; +static GAsyncQueue* interruptqueue; typedef struct { GTimeVal when; + char* handle; } Event; -static void interruptcallback(void) { +static void interruptcallback(char* handle) { Event* event = g_malloc(sizeof(Event)); g_get_current_time(&event->when); g_async_queue_push(interruptqueue, event); } -int glue_enable_srq(bool enable) { - if (enable) { - interruptqueue = g_async_queue_new(); - return vxi11_enable_srq(enable, INTERRUPTHANDLE, interruptcallback); - } - else { - int ret = vxi11_enable_srq(enable, NULL, NULL); - g_free(interruptqueue); - return ret; - } +VXI11Context* glue_open(char* address, char* device) { + VXI11Context* context = malloc(sizeof(VXI11Context)); + if (context == NULL) + return NULL; + + int err = vxi11_open(context, address, device); + + return context; +} + +int glue_start_interrupt_server() { + interruptqueue = g_async_queue_new(); + return vxi11_start_interrupt_server(interruptcallback); +} + +int glue_stop_interrupt_server() { + int ret = vxi11_stop_interrupt_server(); + g_free(interruptqueue); + return ret; } int glue_wait_for_interrupt() { |