=== modified file 'driver-csi.c' --- driver-csi.c 2008-10-06 22:36:14 +0000 +++ driver-csi.c 2008-10-06 22:27:19 +0000 @@ -24,7 +24,7 @@ struct keyinfo *csifuncs; } termkey_csi; -static void *new_driver(termkey_t *tk) +void *termkeycsi_new_driver(termkey_t *tk) { termkey_csi *csi = malloc(sizeof *csi); @@ -50,7 +50,7 @@ return csi; } -static void free_driver(void *private) +void termkeycsi_free_driver(void *private) { termkey_csi *csi = private; @@ -324,7 +324,7 @@ return TERMKEY_RES_KEY; } -static termkey_result getkey(termkey_t *tk, termkey_key *key) +termkey_result termkeycsi_getkey(termkey_t *tk, termkey_key *key) { if(tk->buffcount == 0) return tk->is_closed ? TERMKEY_RES_EOF : TERMKEY_RES_NONE; @@ -580,10 +580,3 @@ return sym; } - -struct termkey_driver termkey_driver_csi = { - .new_driver = new_driver, - .free_driver = free_driver, - - .getkey = getkey, -}; === modified file 'termkey-internal.h' --- termkey-internal.h 2008-10-06 22:36:14 +0000 +++ termkey-internal.h 2008-10-06 22:27:19 +0000 @@ -8,9 +8,8 @@ struct termkey_driver { - void *(*new_driver)(termkey_t *tk); - void (*free_driver)(void *); - termkey_result (*getkey)(termkey_t *tk, termkey_key *key); + void *(*new_driver)(void); + void (*free_driver)(void *); }; struct termkey { @@ -35,6 +34,6 @@ void *driver_info; }; -extern struct termkey_driver termkey_driver_csi; +void *termkeycsi_new_driver(termkey_t *t); #endif === modified file 'termkey.c' --- termkey.c 2008-10-06 22:36:14 +0000 +++ termkey.c 2008-10-06 22:27:19 +0000 @@ -8,6 +8,12 @@ #include +// TODO: Move these into t->driver +void *termkeycsi_new_driver(termkey_t *tk); +void termkeycsi_free_driver(void *private); +termkey_result termkeycsi_getkey(termkey_t *tk, termkey_key *key); +// END TODO + termkey_t *termkey_new_full(int fd, int flags, size_t buffsize, int waittime) { termkey_t *tk = malloc(sizeof(*tk)); @@ -59,9 +65,7 @@ for(i = 0; i < tk->nkeynames; i++) tk->keynames[i] = NULL; - tk->driver = termkey_driver_csi; - - tk->driver_info = (*tk->driver.new_driver)(tk); + tk->driver_info = termkeycsi_new_driver(tk); // Special built-in names termkey_register_keyname(tk, TERMKEY_SYM_NONE, "NONE"); @@ -164,7 +168,7 @@ free(tk->buffer); tk->buffer = NULL; free(tk->keynames); tk->keynames = NULL; - (*tk->driver.free_driver)(tk->driver_info); + termkeycsi_free_driver(tk->driver_info); tk->driver_info = NULL; /* Be nice to GC'ers, etc */ free(tk); @@ -190,7 +194,7 @@ termkey_result termkey_getkey(termkey_t *tk, termkey_key *key) { - return (*tk->driver.getkey)(tk, key); + return termkeycsi_getkey(tk, key); } termkey_result termkey_getkey_force(termkey_t *tk, termkey_key *key)