diff options
Diffstat (limited to 'portland/dapi/lib/callbacks.c')
-rw-r--r-- | portland/dapi/lib/callbacks.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/portland/dapi/lib/callbacks.c b/portland/dapi/lib/callbacks.c deleted file mode 100644 index 62f402d..0000000 --- a/portland/dapi/lib/callbacks.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "callbacks.h" - -#include <stdio.h> -#include <stdlib.h> - -#include "comm_internal.h" - -#include <dapi/callbacks_generated.c> - -DapiGenericCallback dapi_setGenericCallback( DapiConnection* conn, DapiGenericCallback callback ) - { - DapiGenericCallback ret = conn->generic_callback; - conn->generic_callback = callback; - return ret; - } - -void dapi_processData( DapiConnection* conn ) - { - while( dapi_hasData( conn )) - { - int command; - int seq; - if( !dapi_readCommand( conn, &command, &seq )) - return; /* TODO error-handling? */ - conn->generic_callback( conn, command, seq ); - } - } - -void dapi_genericCallback( DapiConnection* conn, int command, int seq ) - { - DapiCallbackData* pos; - DapiCallbackData* prev = NULL; - for( pos = conn->callbacks; - pos != NULL; - prev = pos, pos = pos->next ) - { - if( pos->seq == seq ) - { - if( pos->callback != NULL ) - genericCallbackDispatch( conn, pos, command, seq ); - if( prev != NULL ) - prev = pos->next; - else - conn->callbacks = pos->next; - free( pos ); - return; - } - } -/* TODO handle unhandled */ - } |