Commit 775690db8282ad9a3bd4994af639336738f4de32

Authored by perry.werneck@gmail.com
1 parent 66abe7e5

Trabalhando na versão Android

Showing 4 changed files with 55 additions and 42 deletions   Show diff stats
@@ -331,20 +331,6 @@ @@ -331,20 +331,6 @@
331 #define find_field_attribute(s,a) lib3270_field_addr(s,a) 331 #define find_field_attribute(s,a) lib3270_field_addr(s,a)
332 #define find_field_length(s,a) find_field_length(s,a) 332 #define find_field_length(s,a) find_field_length(s,a)
333 333
334 - /**  
335 - * Find the buffer address of the field attribute for a given buffer address.  
336 - *  
337 - * @param h Session handle.  
338 - * @param addr Buffer address of the field.  
339 - *  
340 - * @return field address or -1 if the screen isn't formatted.  
341 - *  
342 - */  
343 - LIB3270_EXPORT int lib3270_field_addr(H3270 *h, int baddr);  
344 -  
345 - LIB3270_EXPORT int lib3270_field_length(H3270 *session, int baddr);  
346 -  
347 -  
348 LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr); 334 LOCAL_EXTERN unsigned char get_field_attribute(H3270 *session, int baddr);
349 // LOCAL_EXTERN int screen_read(char *dest, int baddr, int count); 335 // LOCAL_EXTERN int screen_read(char *dest, int baddr, int count);
350 LOCAL_EXTERN void Input_String(const unsigned char *str); 336 LOCAL_EXTERN void Input_String(const unsigned char *str);
@@ -180,7 +180,7 @@ static struct ta @@ -180,7 +180,7 @@ static struct ta
180 180
181 static const char dxl[] = "0123456789abcdef"; 181 static const char dxl[] = "0123456789abcdef";
182 #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl) 182 #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl)
183 -#define KYBDLOCK_IS_OERR (h3270.kybdlock && !(h3270.kybdlock & ~KL_OERR_MASK)) 183 +#define KYBDLOCK_IS_OERR(hSession) (hSession->kybdlock && !(hSession->kybdlock & ~KL_OERR_MASK))
184 184
185 185
186 /* 186 /*
@@ -379,26 +379,26 @@ kybdlock_set(unsigned int bits, const char *cause unused) @@ -379,26 +379,26 @@ kybdlock_set(unsigned int bits, const char *cause unused)
379 } 379 }
380 } 380 }
381 381
382 -/* Clear bits in the keyboard lock. */  
383 -void  
384 -kybdlock_clr(H3270 *session, unsigned int bits, const char *cause unused) 382 +/**
  383 + * Clear bits in the keyboard lock.
  384 + *
  385 + */
  386 +void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits)
385 { 387 {
386 - unsigned int n;  
387 -  
388 - n = session->kybdlock & ~bits; 388 + unsigned int n = hSession->kybdlock & ~( (unsigned int) bits);
389 389
390 - if (n != session->kybdlock) 390 + if (n != hSession->kybdlock)
391 { 391 {
392 #if defined(KYBDLOCK_TRACE) 392 #if defined(KYBDLOCK_TRACE)
393 - trace_event(" %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n",cause, bits, kybdlock, n); 393 + trace_event(" %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", __FUNCTION__, bits, kybdlock, n);
394 #endif 394 #endif
395 - if ((session->kybdlock ^ n) & KL_DEFERRED_UNLOCK) 395 + if ((hSession->kybdlock ^ n) & KL_DEFERRED_UNLOCK)
396 { 396 {
397 /* Turned off deferred unlock. */ 397 /* Turned off deferred unlock. */
398 - session->unlock_delay_time = 0; 398 + hSession->unlock_delay_time = 0;
399 } 399 }
400 - session->kybdlock = n;  
401 - status_changed(session,LIB3270_STATUS_KYBDLOCK); 400 + hSession->kybdlock = n;
  401 + status_changed(hSession,LIB3270_STATUS_KYBDLOCK);
402 } 402 }
403 } 403 }
404 404
@@ -1399,11 +1399,14 @@ LIB3270_KEY_ACTION( tab ) @@ -1399,11 +1399,14 @@ LIB3270_KEY_ACTION( tab )
1399 1399
1400 // reset_idle_timer(); 1400 // reset_idle_timer();
1401 1401
1402 - if (hSession->kybdlock) {  
1403 - if (KYBDLOCK_IS_OERR) { 1402 + if (hSession->kybdlock)
  1403 + {
  1404 + if(KYBDLOCK_IS_OERR(hSession))
  1405 + {
1404 kybdlock_clr(hSession,KL_OERR_MASK, "Tab"); 1406 kybdlock_clr(hSession,KL_OERR_MASK, "Tab");
1405 status_reset(hSession); 1407 status_reset(hSession);
1406 - } else { 1408 + } else
  1409 + {
1407 ENQUEUE_ACTION(lib3270_tab); 1410 ENQUEUE_ACTION(lib3270_tab);
1408 return 0; 1411 return 0;
1409 } 1412 }
@@ -1418,6 +1421,20 @@ LIB3270_KEY_ACTION( tab ) @@ -1418,6 +1421,20 @@ LIB3270_KEY_ACTION( tab )
1418 return 0; 1421 return 0;
1419 } 1422 }
1420 1423
  1424 +LIB3270_EXPORT int lib3270_clear_operator_error(H3270 *hSession)
  1425 +{
  1426 + if(!hSession->kybdlock)
  1427 + return ENOENT;
  1428 +
  1429 + if(KYBDLOCK_IS_OERR(hSession))
  1430 + {
  1431 + lib3270_kybdlock_clear(hSession,KL_OERR_MASK);
  1432 + status_reset(hSession);
  1433 + return 0;
  1434 + }
  1435 + return EINVAL;
  1436 +}
  1437 +
1421 1438
1422 /* 1439 /*
1423 * Tab backward to previous field. 1440 * Tab backward to previous field.
@@ -1429,11 +1446,15 @@ LIB3270_KEY_ACTION( backtab ) @@ -1429,11 +1446,15 @@ LIB3270_KEY_ACTION( backtab )
1429 1446
1430 // reset_idle_timer(); 1447 // reset_idle_timer();
1431 1448
1432 - if (hSession->kybdlock) {  
1433 - if (KYBDLOCK_IS_OERR) { 1449 + if (hSession->kybdlock)
  1450 + {
  1451 + if (KYBDLOCK_IS_OERR(hSession))
  1452 + {
1434 kybdlock_clr(hSession,KL_OERR_MASK, "BackTab"); 1453 kybdlock_clr(hSession,KL_OERR_MASK, "BackTab");
1435 status_reset(hSession); 1454 status_reset(hSession);
1436 - } else { 1455 + }
  1456 + else
  1457 + {
1437 ENQUEUE_ACTION(lib3270_backtab); 1458 ENQUEUE_ACTION(lib3270_backtab);
1438 return 0; 1459 return 0;
1439 } 1460 }
@@ -1602,7 +1623,7 @@ LIB3270_CURSOR_ACTION( left ) @@ -1602,7 +1623,7 @@ LIB3270_CURSOR_ACTION( left )
1602 { 1623 {
1603 if (hSession->kybdlock) 1624 if (hSession->kybdlock)
1604 { 1625 {
1605 - if (KYBDLOCK_IS_OERR) 1626 + if(KYBDLOCK_IS_OERR(hSession))
1606 { 1627 {
1607 kybdlock_clr(hSession,KL_OERR_MASK, "Left"); 1628 kybdlock_clr(hSession,KL_OERR_MASK, "Left");
1608 status_reset(&h3270); 1629 status_reset(&h3270);
@@ -1865,7 +1886,7 @@ LIB3270_CURSOR_ACTION( right ) @@ -1865,7 +1886,7 @@ LIB3270_CURSOR_ACTION( right )
1865 1886
1866 if (hSession->kybdlock) 1887 if (hSession->kybdlock)
1867 { 1888 {
1868 - if (KYBDLOCK_IS_OERR) 1889 + if (KYBDLOCK_IS_OERR(hSession))
1869 { 1890 {
1870 kybdlock_clr(hSession,KL_OERR_MASK, "Right"); 1891 kybdlock_clr(hSession,KL_OERR_MASK, "Right");
1871 status_reset(hSession); 1892 status_reset(hSession);
@@ -2093,8 +2114,9 @@ LIB3270_CURSOR_ACTION( up ) @@ -2093,8 +2114,9 @@ LIB3270_CURSOR_ACTION( up )
2093 register int baddr; 2114 register int baddr;
2094 2115
2095 // reset_idle_timer(); 2116 // reset_idle_timer();
2096 - if (hSession->kybdlock) {  
2097 - if (KYBDLOCK_IS_OERR) 2117 + if (hSession->kybdlock)
  2118 + {
  2119 + if (KYBDLOCK_IS_OERR(hSession))
2098 { 2120 {
2099 kybdlock_clr(hSession,KL_OERR_MASK, "Up"); 2121 kybdlock_clr(hSession,KL_OERR_MASK, "Up");
2100 status_reset(hSession); 2122 status_reset(hSession);
@@ -2132,7 +2154,7 @@ LIB3270_CURSOR_ACTION( down ) @@ -2132,7 +2154,7 @@ LIB3270_CURSOR_ACTION( down )
2132 // reset_idle_timer(); 2154 // reset_idle_timer();
2133 if (hSession->kybdlock) 2155 if (hSession->kybdlock)
2134 { 2156 {
2135 - if (KYBDLOCK_IS_OERR) 2157 + if (KYBDLOCK_IS_OERR(hSession))
2136 { 2158 {
2137 kybdlock_clr(hSession,KL_OERR_MASK, "Down"); 2159 kybdlock_clr(hSession,KL_OERR_MASK, "Down");
2138 status_reset(hSession); 2160 status_reset(hSession);
@@ -61,7 +61,11 @@ @@ -61,7 +61,11 @@
61 LIB3270_INTERNAL void clear_xks(void); 61 LIB3270_INTERNAL void clear_xks(void);
62 LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit); 62 LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit);
63 LIB3270_INTERNAL void hex_input(char *s); 63 LIB3270_INTERNAL void hex_input(char *s);
64 - LIB3270_INTERNAL void kybdlock_clr(H3270 *session, unsigned int bits, const char *cause); 64 +
  65 + #define kybdlock_clr(session, bits, cause) lib3270_kybdlock_clear(session, bits)
  66 + LIB3270_INTERNAL void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits);
  67 +
  68 +
65 LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit); 69 LIB3270_INTERNAL void kybd_inhibit(H3270 *session, Boolean inhibit);
66 LIB3270_INTERNAL void kybd_init(void); 70 LIB3270_INTERNAL void kybd_init(void);
67 LIB3270_INTERNAL int kybd_prime(void); 71 LIB3270_INTERNAL int kybd_prime(void);
@@ -26,13 +26,14 @@ @@ -26,13 +26,14 @@
26 26
27 # Terminal only sources 27 # Terminal only sources
28 TERMINAL_SOURCES = bounds.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \ 28 TERMINAL_SOURCES = bounds.c ctlr.c util.c toggles.c screen.c selection.c kybd.c telnet.c \
29 - host.c sf.c ansi.c resolver.c tables.c utf8.c charset.c \  
30 - version.c session.c state.c html.c trace_ds.c see.c 29 + host.c sf.c ansi.c resolver.c tables.c utf8.c charset.c \
  30 + version.c session.c state.c html.c trace_ds.c see.c \
  31 + paste.c
31 32
32 # Network I/O Sources 33 # Network I/O Sources
33 NETWORK_SOURCES = iocalls.c proxy.c 34 NETWORK_SOURCES = iocalls.c proxy.c
34 35
35 # Full library sources 36 # Full library sources
36 SOURCES = $(TERMINAL_SOURCES) $(NETWORK_SOURCES) ft.c ft_cut.c ft_dft.c glue.c resources.c \ 37 SOURCES = $(TERMINAL_SOURCES) $(NETWORK_SOURCES) ft.c ft_cut.c ft_dft.c glue.c resources.c \
37 - rpq.c paste.c macros.c fallbacks.c log.c 38 + rpq.c macros.c fallbacks.c log.c
38 39