From 775690db8282ad9a3bd4994af639336738f4de32 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Tue, 17 Jul 2012 12:26:35 +0000 Subject: [PATCH] Trabalhando na versão Android --- api.h | 14 -------------- kybd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++------------------------ kybdc.h | 6 +++++- sources.mak | 7 ++++--- 4 files changed, 55 insertions(+), 42 deletions(-) diff --git a/api.h b/api.h index ee176fa..4663319 100644 --- a/api.h +++ b/api.h @@ -331,20 +331,6 @@ #define find_field_attribute(s,a) lib3270_field_addr(s,a) #define find_field_length(s,a) find_field_length(s,a) - /** - * Find the buffer address of the field attribute for a given buffer address. - * - * @param h Session handle. - * @param addr Buffer address of the field. - * - * @return field address or -1 if the screen isn't formatted. - * - */ - LIB3270_EXPORT int lib3270_field_addr(H3270 *h, int baddr); - - LIB3270_EXPORT int lib3270_field_length(H3270 *session, int baddr); - - LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr); // LOCAL_EXTERN int screen_read(char *dest, int baddr, int count); LOCAL_EXTERN void Input_String(const unsigned char *str); diff --git a/kybd.c b/kybd.c index 643998c..49128e8 100644 --- a/kybd.c +++ b/kybd.c @@ -180,7 +180,7 @@ static struct ta static const char dxl[] = "0123456789abcdef"; #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl) -#define KYBDLOCK_IS_OERR (h3270.kybdlock && !(h3270.kybdlock & ~KL_OERR_MASK)) +#define KYBDLOCK_IS_OERR(hSession) (hSession->kybdlock && !(hSession->kybdlock & ~KL_OERR_MASK)) /* @@ -379,26 +379,26 @@ kybdlock_set(unsigned int bits, const char *cause unused) } } -/* Clear bits in the keyboard lock. */ -void -kybdlock_clr(H3270 *session, unsigned int bits, const char *cause unused) +/** + * Clear bits in the keyboard lock. + * + */ +void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits) { - unsigned int n; - - n = session->kybdlock & ~bits; + unsigned int n = hSession->kybdlock & ~( (unsigned int) bits); - if (n != session->kybdlock) + if (n != hSession->kybdlock) { #if defined(KYBDLOCK_TRACE) - trace_event(" %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n",cause, bits, kybdlock, n); + trace_event(" %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", __FUNCTION__, bits, kybdlock, n); #endif - if ((session->kybdlock ^ n) & KL_DEFERRED_UNLOCK) + if ((hSession->kybdlock ^ n) & KL_DEFERRED_UNLOCK) { /* Turned off deferred unlock. */ - session->unlock_delay_time = 0; + hSession->unlock_delay_time = 0; } - session->kybdlock = n; - status_changed(session,LIB3270_STATUS_KYBDLOCK); + hSession->kybdlock = n; + status_changed(hSession,LIB3270_STATUS_KYBDLOCK); } } @@ -1399,11 +1399,14 @@ LIB3270_KEY_ACTION( tab ) // reset_idle_timer(); - if (hSession->kybdlock) { - if (KYBDLOCK_IS_OERR) { + if (hSession->kybdlock) + { + if(KYBDLOCK_IS_OERR(hSession)) + { kybdlock_clr(hSession,KL_OERR_MASK, "Tab"); status_reset(hSession); - } else { + } else + { ENQUEUE_ACTION(lib3270_tab); return 0; } @@ -1418,6 +1421,20 @@ LIB3270_KEY_ACTION( tab ) return 0; } +LIB3270_EXPORT int lib3270_clear_operator_error(H3270 *hSession) +{ + if(!hSession->kybdlock) + return ENOENT; + + if(KYBDLOCK_IS_OERR(hSession)) + { + lib3270_kybdlock_clear(hSession,KL_OERR_MASK); + status_reset(hSession); + return 0; + } + return EINVAL; +} + /* * Tab backward to previous field. @@ -1429,11 +1446,15 @@ LIB3270_KEY_ACTION( backtab ) // reset_idle_timer(); - if (hSession->kybdlock) { - if (KYBDLOCK_IS_OERR) { + if (hSession->kybdlock) + { + if (KYBDLOCK_IS_OERR(hSession)) + { kybdlock_clr(hSession,KL_OERR_MASK, "BackTab"); status_reset(hSession); - } else { + } + else + { ENQUEUE_ACTION(lib3270_backtab); return 0; } @@ -1602,7 +1623,7 @@ LIB3270_CURSOR_ACTION( left ) { if (hSession->kybdlock) { - if (KYBDLOCK_IS_OERR) + if(KYBDLOCK_IS_OERR(hSession)) { kybdlock_clr(hSession,KL_OERR_MASK, "Left"); status_reset(&h3270); @@ -1865,7 +1886,7 @@ LIB3270_CURSOR_ACTION( right ) if (hSession->kybdlock) { - if (KYBDLOCK_IS_OERR) + if (KYBDLOCK_IS_OERR(hSession)) { kybdlock_clr(hSession,KL_OERR_MASK, "Right"); status_reset(hSession); @@ -2093,8 +2114,9 @@ LIB3270_CURSOR_ACTION( up ) register int baddr; // reset_idle_timer(); - if (hSession->kybdlock) { - if (KYBDLOCK_IS_OERR) + if (hSession->kybdlock) + { + if (KYBDLOCK_IS_OERR(hSession)) { kybdlock_clr(hSession,KL_OERR_MASK, "Up"); status_reset(hSession); @@ -2132,7 +2154,7 @@ LIB3270_CURSOR_ACTION( down ) // reset_idle_timer(); if (hSession->kybdlock) { - if (KYBDLOCK_IS_OERR) + if (KYBDLOCK_IS_OERR(hSession)) { kybdlock_clr(hSession,KL_OERR_MASK, "Down"); status_reset(hSession); diff --git a/kybdc.h b/kybdc.h index 6a26324..c072a8b 100644 --- a/kybdc.h +++ b/kybdc.h @@ -61,7 +61,11 @@ LIB3270_INTERNAL void clear_xks(void); LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit); LIB3270_INTERNAL void hex_input(char *s); - LIB3270_INTERNAL void kybdlock_clr(H3270 *session, unsigned int bits, const char *cause); + + #define kybdlock_clr(session, bits, cause) lib3270_kybdlock_clear(session, bits) + LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits); + + LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit); LIB3270_INTERNAL void kybd_init(void); LIB3270_INTERNAL int kybd_prime(void); diff --git a/sources.mak b/sources.mak index 0e4c83f..401c173 100644 --- a/sources.mak +++ b/sources.mak @@ -26,13 +26,14 @@ # Terminal only sources TERMINAL_SOURCES = bounds.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \ - host.c sf.c ansi.c resolver.c tables.c utf8.c charset.c \ - version.c session.c state.c html.c trace_ds.c see.c + host.c sf.c ansi.c resolver.c tables.c utf8.c charset.c \ + version.c session.c state.c html.c trace_ds.c see.c \ + paste.c # Network I/O Sources NETWORK_SOURCES = iocalls.c proxy.c # Full library sources SOURCES = $(TERMINAL_SOURCES) $(NETWORK_SOURCES) ft.c ft_cut.c ft_dft.c glue.c resources.c \ - rpq.c paste.c macros.c fallbacks.c log.c + rpq.c macros.c fallbacks.c log.c -- libgit2 0.21.2