From 8321d0f5097a7315c3ae7ccd665a88325e9e8447 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 19 Apr 2016 09:42:29 -0300 Subject: [PATCH] Updating version, changing timer management, adding setting for unlock delay. --- configure.ac | 2 +- src/include/lib3270.h | 33 ++++++++++++++++++++++----------- src/include/lib3270/session.h | 7 ++++--- src/lib3270/connect.c | 2 +- src/lib3270/ctlr.c | 6 ++++-- src/lib3270/iocalls.c | 61 ++++++++++++++++++++++++++++++++----------------------------- src/lib3270/kybd.c | 147 ++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------- src/lib3270/session.c | 4 ++++ src/lib3270/telnet.c | 4 ++-- src/lib3270/utilc.h | 4 ++-- src/pw3270/v3270/iocallback.c | 35 ++++++----------------------------- 11 files changed, 96 insertions(+), 209 deletions(-) diff --git a/configure.ac b/configure.ac index dbc44ce..834e3d8 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ m4_include([revision.m4]) dnl Initialise automake with the package name, version and dnl bug-reporting address. -AC_INIT([pw3270], [5.0], [perry.werneck@gmail.com]) +AC_INIT([pw3270], [5.1], [perry.werneck@gmail.com]) dnl Place auxilliary scripts here. AC_CONFIG_AUX_DIR([scripts]) diff --git a/src/include/lib3270.h b/src/include/lib3270.h index e36233a..6da6122 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -673,10 +673,10 @@ } LIB3270_IO_FLAG; LIB3270_EXPORT void * lib3270_add_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*call)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); - LIB3270_EXPORT void lib3270_remove_poll(void *id); + LIB3270_EXPORT void lib3270_remove_poll(H3270 *session, void *id); - LIB3270_EXPORT void lib3270_remove_poll_fd(int fd); - LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag); + LIB3270_EXPORT void lib3270_remove_poll_fd(H3270 *session, int fd); + LIB3270_EXPORT void lib3270_update_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag); /** Callback table * @@ -687,15 +687,15 @@ { unsigned short sz; - void * (*AddTimeOut)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); - void (*RemoveTimeOut)(void *timer); + void * (*AddTimeOut)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)); + void (*RemoveTimeOut)(H3270 *session, void *timer); void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata); - void (*remove_poll)(void *id); + void (*remove_poll)(H3270 *session, void *id); int (*Wait)(H3270 *hSession, int seconds); - int (*event_dispatcher)(H3270 *hSession, int wait); - void (*ring_bell)(H3270 *); + int (*event_dispatcher)(H3270 *session, int wait); + void (*ring_bell)(H3270 *session); }; @@ -716,9 +716,9 @@ * @param rm Callback for removing a timeout * */ - void LIB3270_EXPORT lib3270_register_time_handlers(void * (*add)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)), void (*rm)(void *timer)); + void LIB3270_EXPORT lib3270_register_time_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer)); - void lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(void *id)); + void LIB3270_EXPORT lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(H3270 *, void *id)); /** * Get program message. @@ -1011,7 +1011,6 @@ LIB3270_EXPORT int lib3270_get_word_bounds(H3270 *hSession, int baddr, int *start, int *end); -// LIB3270_EXPORT int lib3270_set_model(H3270 *session, int model); LIB3270_EXPORT int lib3270_set_model(H3270 *hSession, const char *name); LIB3270_EXPORT const char * lib3270_get_model(H3270 *session); @@ -1022,6 +1021,18 @@ LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name); + /** + * + * Overrides the default value for the unlock delay (the delay between the host unlocking the + * keyboard and lib3270 actually performing the unlock). + * The value is in milliseconds; use 0 to turn off the delay completely. + * + * @param session lib3270 session. + * @param Delay in milliseconds. + * + */ + LIB3270_EXPORT void lib3270_set_unlock_delay(H3270 *session, unsigned short delay); + /** * Alloc/Realloc memory buffer. diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h index 6e92272..19c5ff7 100644 --- a/src/include/lib3270/session.h +++ b/src/include/lib3270/session.h @@ -263,15 +263,16 @@ unsigned char hisopts[LIB3270_TELNET_N_OPTS]; // kybd.c - unsigned int kybdlock; /**< keyboard lock state */ - unsigned char aid; /**< current attention ID */ + unsigned int kybdlock; ///< @brief keyboard lock state + unsigned char aid; ///< @brief current attention ID void * unlock_id; time_t unlock_delay_time; + unsigned long unlock_delay_ms; ///< @brief Delay before actually unlocking the keyboard after the host permits it. LIB3270_TA * ta_head; LIB3270_TA * ta_tail; // ft_dft.c - int dft_buffersize; /**< Buffer size (LIMIN, LIMOUT) */ + int dft_buffersize; ///< @brief Buffer size (LIMIN, LIMOUT) // rpq.c int rpq_complained : 1; diff --git a/src/lib3270/connect.c b/src/lib3270/connect.c index 193c92f..3f4b8ed 100644 --- a/src/lib3270/connect.c +++ b/src/lib3270/connect.c @@ -84,7 +84,7 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d if(hSession->ns_write_id) { trace("%s write=%p",__FUNCTION__,hSession->ns_write_id); - lib3270_remove_poll(hSession->ns_write_id); + lib3270_remove_poll(hSession, hSession->ns_write_id); hSession->ns_write_id = NULL; } diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c index 3b21e79..569a798 100644 --- a/src/lib3270/ctlr.c +++ b/src/lib3270/ctlr.c @@ -2860,8 +2860,10 @@ void ticking_start(H3270 *hSession, Boolean anyway) return; status_untiming(hSession); + if (hSession->ticking) - RemoveTimeOut(hSession->tick_id); + RemoveTimeOut(hSession, hSession->tick_id); + hSession->ticking = 1; hSession->tick_id = AddTimeOut(1000, hSession, keep_ticking); hSession->t_want = hSession->t_start; @@ -2889,7 +2891,7 @@ static void ticking_stop(H3270 *hSession) if (!hSession->ticking) return; - RemoveTimeOut(hSession->tick_id); + RemoveTimeOut(hSession, hSession->tick_id); hSession->ticking = 0; status_timing(hSession,&hSession->t_start, &t1); } diff --git a/src/lib3270/iocalls.c b/src/lib3270/iocalls.c index f9bf97d..37613c5 100644 --- a/src/lib3270/iocalls.c +++ b/src/lib3270/iocalls.c @@ -45,34 +45,34 @@ /*---[ Standard calls ]-------------------------------------------------------------------------------------*/ // Timeout calls -static void internal_remove_timeout(void *timer); -static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); +static void internal_remove_timeout(H3270 *session, void *timer); +static void * internal_add_timeout(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)); static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata ); -static void internal_remove_poll(void *id); +static void internal_remove_poll(H3270 *session, void *id); -static int internal_wait(H3270 *hSession, int seconds); +static int internal_wait(H3270 *session, int seconds); -static void internal_ring_bell(H3270 *); +static void internal_ring_bell(H3270 *session); /*---[ Active callbacks ]-----------------------------------------------------------------------------------*/ - static void * (*add_timeout)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)) + static void * (*add_timeout)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)) = internal_add_timeout; - static void (*remove_timeout)(void *timer) + static void (*remove_timeout)(H3270 *session, void *timer) = internal_remove_timeout; static void * (*add_poll)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata) = internal_add_poll; - static void (*remove_poll)(void *id) + static void (*remove_poll)(H3270 *session, void *id) = internal_remove_poll; - static int (*wait)(H3270 *hSession, int seconds) + static int (*wait)(H3270 *session, int seconds) = internal_wait; - static int (*event_dispatcher)(H3270 *hSession,int wait) + static int (*event_dispatcher)(H3270 *session,int wait) = lib3270_default_event_dispatcher; static void (*ring_bell)(H3270 *) @@ -134,7 +134,7 @@ static void ms_ts(unsigned long long *u) } #endif -static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)) +static void * internal_add_timeout(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)) { timeout_t *t_new; timeout_t *t; @@ -199,7 +199,7 @@ static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, vo return t_new; } -static void internal_remove_timeout(void * timer) +static void internal_remove_timeout(H3270 *session, void * timer) { timeout_t *st = (timeout_t *)timer; timeout_t *t; @@ -243,7 +243,7 @@ static void * internal_add_poll(H3270 *session, int fd, LIB3270_IO_FLAG flag, vo return ip; } -static void internal_remove_poll(void *id) +static void internal_remove_poll(H3270 *session, void *id) { input_t *ip; input_t *prev = (input_t *)NULL; @@ -258,7 +258,7 @@ static void internal_remove_poll(void *id) if (ip == (input_t *)NULL) { - lib3270_write_log(NULL,"lib3270","Invalid call to (%s): Input %p wasnt found in the list",__FUNCTION__,id); + lib3270_write_log(session,"lib3270","Invalid call to (%s): Input %p wasnt found in the list",__FUNCTION__,id); return; } @@ -271,12 +271,12 @@ static void internal_remove_poll(void *id) inputs_changed = True; } -LIB3270_EXPORT void lib3270_remove_poll(void *id) { +LIB3270_EXPORT void lib3270_remove_poll(H3270 *session, void *id) { debug("%s %p",__FUNCTION__,id); - remove_poll(id); + remove_poll(session, id); } -LIB3270_EXPORT void lib3270_remove_poll_fd(int fd) +LIB3270_EXPORT void lib3270_remove_poll_fd(H3270 *session, int fd) { input_t *ip; @@ -285,7 +285,7 @@ LIB3270_EXPORT void lib3270_remove_poll_fd(int fd) { if(ip->fd == fd) { - remove_poll(ip); + remove_poll(session, ip); return; } } @@ -294,7 +294,7 @@ LIB3270_EXPORT void lib3270_remove_poll_fd(int fd) } -LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag) +LIB3270_EXPORT void lib3270_update_poll_fd(H3270 *session, int fd, LIB3270_IO_FLAG flag) { input_t *ip; @@ -308,7 +308,7 @@ LIB3270_EXPORT void lib3270_update_poll_fd(int fd, LIB3270_IO_FLAG flag) } } - lib3270_write_log(NULL,"iocalls","Invalid or unexpected FD on %s(%d)",__FUNCTION__,fd); + lib3270_write_log(session,"iocalls","Invalid or unexpected FD on %s(%d)",__FUNCTION__,fd); } @@ -612,15 +612,18 @@ void * AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 { void *timer; CHECK_SESSION_HANDLE(session); - timer = add_timeout(interval_ms,session,proc); + timer = add_timeout(session,interval_ms,proc); trace("Timeout %p created with %ld ms",timer,interval_ms); return timer; } -void RemoveTimeOut(void * timer) +void RemoveTimeOut(H3270 *session, void * timer) { + if(!timer) + return; + trace("Removing timeout %p",timer); - return remove_timeout(timer); + return remove_timeout(session, timer); } void x_except_on(H3270 *h) @@ -632,7 +635,7 @@ void x_except_on(H3270 *h) return; if(reading) - lib3270_remove_poll(h->ns_read_id); + lib3270_remove_poll(h,h->ns_read_id); h->ns_exception_id = lib3270_add_poll_fd(h,h->sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0); @@ -646,22 +649,22 @@ void remove_input_calls(H3270 *session) { if(session->ns_read_id) { - lib3270_remove_poll(session->ns_read_id); + lib3270_remove_poll(session,session->ns_read_id); session->ns_read_id = NULL; } if(session->ns_exception_id) { - lib3270_remove_poll(session->ns_exception_id); + lib3270_remove_poll(session,session->ns_exception_id); session->ns_exception_id = NULL; } if(session->ns_write_id) { - lib3270_remove_poll(session->ns_write_id); + lib3270_remove_poll(session,session->ns_write_id); session->ns_write_id = NULL; } } -LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)), void (*rm)(void *timer)) +LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)), void (*rm)(H3270 *session, void *timer)) { if(add) add_timeout = add; @@ -671,7 +674,7 @@ LIB3270_EXPORT void lib3270_register_time_handlers(void * (*add)(unsigned long i } -LIB3270_EXPORT void lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(void *id)) { +LIB3270_EXPORT void lib3270_register_fd_handlers(void * (*add)(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata), void (*rm)(H3270 *, void *id)) { if(add) add_poll = add; diff --git a/src/lib3270/kybd.c b/src/lib3270/kybd.c index f3d0345..a3a779c 100644 --- a/src/lib3270/kybd.c +++ b/src/lib3270/kybd.c @@ -124,27 +124,6 @@ static int flush_ta(H3270 *hSession); static void key_AID(H3270 *session, unsigned char aid_code); static void kybdlock_set(H3270 *session, unsigned int bits); -/* -#if defined(X3270_DBCS) -Boolean key_WCharacter(unsigned char code[], Boolean *skipped); -#endif -*/ - -/* -static int nxk = 0; -static struct xks -{ - KeySym key; - KeySym assoc; -} *xk; -*/ - -// static Boolean reverse = False; /* reverse-input mode */ - -/* Globals */ -// unsigned int kybdlock = KL_NOT_CONNECTED; -//unsigned char aid = AID_NO; /* current attention ID */ - /* Composite key mappings. */ struct akeysym @@ -152,14 +131,6 @@ struct akeysym KeySym keysym; enum keytype keytype; }; -/* -static struct akeysym cc_first; -static struct composite { - struct akeysym k1, k2; - struct akeysym translation; -} *composites = NULL; -static int n_composites = 0; -*/ #define ak_eq(k1, k2) (((k1).keysym == (k2).keysym) && \ ((k1).keytype == (k2).keytype)) @@ -180,12 +151,6 @@ struct ta unsigned char aid_code; }; -/* -*ta_head = (struct ta *) NULL, - *ta_tail = (struct ta *) NULL; -*/ - - #if defined(DEBUG) #define ENQUEUE_ACTION(x) enq_ta(hSession, (void (*)(H3270 *, const char *, const char *)) x, NULL, NULL, #x) #else @@ -445,7 +410,7 @@ void kybd_inhibit(H3270 *session, Boolean inhibit) void kybd_connect(H3270 *session, int connected, void *dunno) { if (session->kybdlock & KL_DEFERRED_UNLOCK) - RemoveTimeOut(session->unlock_id); + RemoveTimeOut(session, session->unlock_id); lib3270_kybdlock_clear(session, -1); @@ -467,7 +432,8 @@ void kybd_connect(H3270 *session, int connected, void *dunno) void kybd_in3270(H3270 *hSession, int in3270 unused, void *dunno) { if (hSession->kybdlock & KL_DEFERRED_UNLOCK) - RemoveTimeOut(hSession->unlock_id); + RemoveTimeOut(hSession, hSession->unlock_id); + lib3270_kybdlock_clear(hSession,~KL_AWAITING_FIRST); /* There might be a macro pending. */ @@ -1185,7 +1151,7 @@ void do_reset(H3270 *hSession, Boolean explicit) * keyboard now, or want to defer further into the future. */ if (hSession->kybdlock & KL_DEFERRED_UNLOCK) - RemoveTimeOut(hSession->unlock_id); + RemoveTimeOut(hSession, hSession->unlock_id); /* * If explicit (from the keyboard), unlock the keyboard now. @@ -1199,7 +1165,17 @@ void do_reset(H3270 *hSession, Boolean explicit) { lib3270_kybdlock_clear(hSession,~KL_DEFERRED_UNLOCK); kybdlock_set(hSession,KL_DEFERRED_UNLOCK); - hSession->unlock_id = AddTimeOut(UNLOCK_MS, hSession, defer_unlock); + + if(hSession->unlock_delay_ms) + { + hSession->unlock_id = AddTimeOut(hSession->unlock_delay_ms, hSession, defer_unlock); + } + else + { + hSession->unlock_id = 0; + defer_unlock(hSession); + } + } /* Clean up other modes. */ @@ -2998,95 +2974,8 @@ int kybd_prime(H3270 *hSession) } #endif /*]*/ -/* - * Translate a keysym name to a keysym, including APL and extended - * characters. - */ /* -static KeySym -MyStringToKeysym(char *s, enum keytype *keytypep) +LIB3270_EXPORT void lib3270_set_unlock_delay(H3270 *session, unsigned short delay) { - KeySym k; - int cc; - char *ptr; - unsigned char xc; - - -#if defined(X3270_APL) - if (!strncmp(s, "apl_", 4)) { - int is_ge; - - k = APLStringToKeysym(s, &is_ge); - if (is_ge) - *keytypep = KT_GE; - else - *keytypep = KT_STD; - } else -#endif - { - k = StringToKeysym(s); - *keytypep = KT_STD; - } - if (k == NoSymbol && ((xc = utf8_lookup(s, NULL, NULL)) != 0)) - k = xc; - if (k == NoSymbol && !strcasecmp(s, "euro")) - k = 0xa4; - if (k == NoSymbol && strlen(s) == 1) - k = s[0] & 0xff; - if (k < ' ') - k = NoSymbol; - else if (k > 0xff) { - int i; - - for (i = 0; i < nxk; i++) - if (xk[i].key == k) { - k = xk[i].assoc; - break; - } - if (k > 0xff) - k &= 0xff; - } - - // Allow arbitrary values, e.g., 0x03 for ^C. - if (k == NoSymbol && - (cc = strtoul(s, &ptr, 0)) > 0 && - cc < 0xff && - ptr != s && - *ptr == '\0') - k = cc; - - return k; -} -*/ - -/* Add a key to the extended association table. */ -/* -void -add_xk(KeySym key, KeySym assoc) -{ - int i; - - for (i = 0; i < nxk; i++) - if (xk[i].key == key) { - xk[i].assoc = assoc; - return; - } - xk = (struct xks *) Realloc(xk, (nxk + 1) * sizeof(struct xks)); - xk[nxk].key = key; - xk[nxk].assoc = assoc; - nxk++; -} -*/ - -/* Clear the extended association table. */ -/* -void clear_xks(void) -{ - if (nxk) { - lib3270_free(xk); - xk = (struct xks *)NULL; - nxk = 0; - } + CHECK_SESSION_HANDLE(session); + session->unlock_delay_ms = delay; } -*/ - - diff --git a/src/lib3270/session.c b/src/lib3270/session.c index 3bfa2e3..1a9946b 100644 --- a/src/lib3270/session.c +++ b/src/lib3270/session.c @@ -242,6 +242,10 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char hSession->colors = 16; hSession->m3279 = 1; + // Keyboard unlock + hSession->unlock_delay_ms = 350; /* 0.35s after last unlock */ + + // CSD for(f=0;f<4;f++) hSession->csd[f] = hSession->saved_csd[f] = LIB3270_ANSI_CSD_US; diff --git a/src/lib3270/telnet.c b/src/lib3270/telnet.c index f13248c..7121fe9 100644 --- a/src/lib3270/telnet.c +++ b/src/lib3270/telnet.c @@ -909,7 +909,7 @@ LIB3270_INTERNAL void lib3270_sock_disconnect(H3270 *hSession) if(hSession->ns_write_id) { - lib3270_remove_poll(hSession->ns_write_id); + lib3270_remove_poll(hSession, hSession->ns_write_id); hSession->ns_write_id = 0; } @@ -1961,7 +1961,7 @@ void net_exception(H3270 *session, int fd, LIB3270_IO_FLAG flag, void *dunno) if(session->ns_exception_id) { - lib3270_remove_poll(session->ns_exception_id); + lib3270_remove_poll(session, session->ns_exception_id); session->ns_exception_id = NULL; } } diff --git a/src/lib3270/utilc.h b/src/lib3270/utilc.h index 3a268be..b4808a4 100644 --- a/src/lib3270/utilc.h +++ b/src/lib3270/utilc.h @@ -40,9 +40,9 @@ LIB3270_INTERNAL void * AddInput(int, H3270 *session, void (*fn)(H3270 *session LIB3270_INTERNAL void * AddOutput(int, H3270 *session, void (*fn)(H3270 *session)); LIB3270_INTERNAL void * AddExcept(int, H3270 *session, void (*fn)(H3270 *session)); -LIB3270_INTERNAL void RemoveSource(void *); +LIB3270_INTERNAL void RemoveSource(H3270 *session, void *cookie); LIB3270_INTERNAL void * AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session)); -LIB3270_INTERNAL void RemoveTimeOut(void *cookie); +LIB3270_INTERNAL void RemoveTimeOut(H3270 *session, void *cookie); LIB3270_INTERNAL const char * KeysymToString(KeySym k); diff --git a/src/pw3270/v3270/iocallback.c b/src/pw3270/v3270/iocallback.c index 0ce6a6d..eb67e67 100644 --- a/src/pw3270/v3270/iocallback.c +++ b/src/pw3270/v3270/iocallback.c @@ -43,14 +43,11 @@ #include #include "../globals.h" -// static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); -static void static_RemoveSource(void *id); - static void * static_AddSource(H3270 *session, int fd, LIB3270_IO_FLAG flag, void(*proc)(H3270 *, int, LIB3270_IO_FLAG, void *), void *userdata); -static void static_RemoveSource(void *id); +static void static_RemoveSource(H3270 *session, void *id); -static void * static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); -static void static_RemoveTimeOut(void * timer); +static void * static_AddTimeOut(H3270 *session, unsigned long interval_ms, void (*proc)(H3270 *session)); +static void static_RemoveTimeOut(H3270 *session, void * timer); static int static_Sleep(H3270 *hSession, int seconds); static int static_RunPendingEvents(H3270 *hSession, int wait); @@ -116,32 +113,12 @@ static void * static_AddSource(H3270 *session, int fd, LIB3270_IO_FLAG flag, voi return src; } -/* -static void * static_AddOutput(int source, H3270 *session, void (*fn)(H3270 *session)) -{ - return AddSource(source,session,G_IO_OUT|G_IO_HUP|G_IO_ERR,fn); -} - - -static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) -{ - return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn); -} -*/ - -static void static_RemoveSource(void *id) +static void static_RemoveSource(H3270 *session, void *id) { if(id) g_source_destroy((GSource *) id); } -/* -static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)) -{ - return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn); -} -*/ - static gboolean do_timer(TIMER *t) { if(!t->remove) @@ -149,7 +126,7 @@ static gboolean do_timer(TIMER *t) return FALSE; } -static void * static_AddTimeOut(unsigned long interval, H3270 *session, void (*call)(H3270 *session)) +static void * static_AddTimeOut(H3270 *session, unsigned long interval, void (*call)(H3270 *session)) { TIMER *t = g_malloc0(sizeof(TIMER)); @@ -162,7 +139,7 @@ static void * static_AddTimeOut(unsigned long interval, H3270 *session, void (*c return t; } -static void static_RemoveTimeOut(void * timer) +static void static_RemoveTimeOut(H3270 *session, void * timer) { ((TIMER *) timer)->remove++; } -- libgit2 0.21.2