Commit a31b67340c6cf7680407ccc4bb88993a462edfd8

Authored by perry.werneck@gmail.com
1 parent a98e1593

Tentando identificar mais segfaults em ntdll.dll

@@ -1682,8 +1682,7 @@ ansi_scroll(void) @@ -1682,8 +1682,7 @@ ansi_scroll(void)
1682 } 1682 }
1683 1683
1684 /* Callback for when we enter ANSI mode. */ 1684 /* Callback for when we enter ANSI mode. */
1685 -static void  
1686 -ansi_in3270(H3270 *session, int in3270, void *dunno) 1685 +void ansi_in3270(H3270 *session, int in3270, void *dunno)
1687 { 1686 {
1688 if (!in3270) 1687 if (!in3270)
1689 (void) ansi_reset(0, 0); 1688 (void) ansi_reset(0, 0);
@@ -1705,12 +1704,6 @@ trace_pending_mb(void) @@ -1705,12 +1704,6 @@ trace_pending_mb(void)
1705 /* 1704 /*
1706 * External entry points 1705 * External entry points
1707 */ 1706 */
1708 -  
1709 -void ansi_init(void)  
1710 -{  
1711 - lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,ansi_in3270,NULL);  
1712 -}  
1713 -  
1714 void 1707 void
1715 ansi_process(unsigned int c) 1708 ansi_process(unsigned int c)
1716 { 1709 {
@@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
19 19
20 #if defined(X3270_ANSI) /*[*/ 20 #if defined(X3270_ANSI) /*[*/
21 21
22 -LIB3270_INTERNAL void ansi_init(void);  
23 LIB3270_INTERNAL void ansi_process(unsigned int c); 22 LIB3270_INTERNAL void ansi_process(unsigned int c);
24 LIB3270_INTERNAL void ansi_send_clear(void); 23 LIB3270_INTERNAL void ansi_send_clear(void);
25 LIB3270_INTERNAL void ansi_send_down(void); 24 LIB3270_INTERNAL void ansi_send_down(void);
@@ -29,11 +28,12 @@ LIB3270_INTERNAL void ansi_send_pa(int nn); @@ -29,11 +28,12 @@ LIB3270_INTERNAL void ansi_send_pa(int nn);
29 LIB3270_INTERNAL void ansi_send_pf(int nn); 28 LIB3270_INTERNAL void ansi_send_pf(int nn);
30 LIB3270_INTERNAL void ansi_send_right(void); 29 LIB3270_INTERNAL void ansi_send_right(void);
31 LIB3270_INTERNAL void ansi_send_up(void); 30 LIB3270_INTERNAL void ansi_send_up(void);
  31 +LIB3270_INTERNAL void ansi_in3270(H3270 *session, int in3270, void *dunno);
  32 +
32 LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE type); 33 LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE type);
33 34
34 #else /*][*/ 35 #else /*][*/
35 36
36 -#define ansi_init()  
37 #define ansi_process(n) 37 #define ansi_process(n)
38 #define ansi_send_clear() 38 #define ansi_send_clear()
39 #define ansi_send_down() 39 #define ansi_send_down()
@@ -401,8 +401,6 @@ @@ -401,8 +401,6 @@
401 #define host_connect(n,wait) lib3270_connect(NULL,n,wait) 401 #define host_connect(n,wait) lib3270_connect(NULL,n,wait)
402 #define host_reconnect(w) lib3270_reconnect(NULL,w) 402 #define host_reconnect(w) lib3270_reconnect(NULL,w)
403 403
404 -// #define register_schange(tx,func) lib3270_register_schange(NULL,tx,func,NULL)  
405 -  
406 /* Console/Trace window */ 404 /* Console/Trace window */
407 // LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label); 405 // LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label);
408 // LOCAL_EXTERN void console_window_delete(HCONSOLE hwnd); 406 // LOCAL_EXTERN void console_window_delete(HCONSOLE hwnd);
@@ -34,6 +34,8 @@ @@ -34,6 +34,8 @@
34 #include "globals.h" 34 #include "globals.h"
35 #include "appres.h" 35 #include "appres.h"
36 #include "charsetc.h" 36 #include "charsetc.h"
  37 +#include "kybdc.h"
  38 +#include "ansic.h"
37 39
38 #include <malloc.h> 40 #include <malloc.h>
39 41
@@ -254,8 +256,15 @@ H3270 * lib3270_session_new(const char *model) @@ -254,8 +256,15 @@ H3270 * lib3270_session_new(const char *model)
254 (void) charset_init(hSession,CN); 256 (void) charset_init(hSession,CN);
255 } 257 }
256 258
257 - kybd_init();  
258 - ansi_init(); 259 + trace("%s: Initializing KYBD",__FUNCTION__);
  260 + lib3270_register_schange(hSession,LIB3270_STATE_CONNECT,kybd_connect,NULL);
  261 + lib3270_register_schange(hSession,LIB3270_STATE_3270_MODE,kybd_in3270,NULL);
  262 +
  263 +#if defined(X3270_ANSI)
  264 + trace("%s: Initializing ANSI",__FUNCTION__);
  265 + lib3270_register_schange(hSession,LIB3270_STATE_3270_MODE,ansi_in3270,NULL);
  266 +#endif // X3270_ANSI
  267 +
259 268
260 #if defined(X3270_FT) 269 #if defined(X3270_FT)
261 ft_init(hSession); 270 ft_init(hSession);
@@ -407,7 +407,7 @@ kybd_inhibit(Boolean inhibit) @@ -407,7 +407,7 @@ kybd_inhibit(Boolean inhibit)
407 /* 407 /*
408 * Called when a host connects or disconnects. 408 * Called when a host connects or disconnects.
409 */ 409 */
410 -static void kybd_connect(H3270 *session, int connected, void *dunno) 410 +void kybd_connect(H3270 *session, int connected, void *dunno)
411 { 411 {
412 if (kybdlock & KL_DEFERRED_UNLOCK) 412 if (kybdlock & KL_DEFERRED_UNLOCK)
413 RemoveTimeOut(unlock_id); 413 RemoveTimeOut(unlock_id);
@@ -426,8 +426,7 @@ static void kybd_connect(H3270 *session, int connected, void *dunno) @@ -426,8 +426,7 @@ static void kybd_connect(H3270 *session, int connected, void *dunno)
426 /* 426 /*
427 * Called when we switch between 3270 and ANSI modes. 427 * Called when we switch between 3270 and ANSI modes.
428 */ 428 */
429 -static void  
430 -kybd_in3270(H3270 *session, int in3270 unused, void *dunno) 429 +void kybd_in3270(H3270 *session, int in3270 unused, void *dunno)
431 { 430 {
432 if (kybdlock & KL_DEFERRED_UNLOCK) 431 if (kybdlock & KL_DEFERRED_UNLOCK)
433 RemoveTimeOut(unlock_id); 432 RemoveTimeOut(unlock_id);
@@ -440,13 +439,15 @@ kybd_in3270(H3270 *session, int in3270 unused, void *dunno) @@ -440,13 +439,15 @@ kybd_in3270(H3270 *session, int in3270 unused, void *dunno)
440 439
441 /* 440 /*
442 * Called to initialize the keyboard logic. 441 * Called to initialize the keyboard logic.
443 - */ 442 + */ /*
444 void kybd_init(void) 443 void kybd_init(void)
445 { 444 {
446 - /* Register interest in connect and disconnect events. */ 445 + // Register kybd interest in connect and disconnect events.
  446 + trace("%s",__FUNCTION__);
447 lib3270_register_schange(NULL,LIB3270_STATE_CONNECT,kybd_connect,NULL); 447 lib3270_register_schange(NULL,LIB3270_STATE_CONNECT,kybd_connect,NULL);
448 lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,kybd_in3270,NULL); 448 lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,kybd_in3270,NULL);
449 } 449 }
  450 +*/
450 451
451 /* 452 /*
452 * Toggle reverse mode. 453 * Toggle reverse mode.
@@ -142,16 +142,19 @@ extern void Up_action(Widget w, XEvent *event, String *params, Cardinal *num_ @@ -142,16 +142,19 @@ extern void Up_action(Widget w, XEvent *event, String *params, Cardinal *num_
142 */ 142 */
143 143
144 /* other functions */ 144 /* other functions */
145 -extern void add_xk(KeySym key, KeySym assoc);  
146 -extern void clear_xks(void);  
147 -extern void do_reset(Boolean explicit);  
148 -extern void hex_input(char *s);  
149 -extern void kybdlock_clr(unsigned int bits, const char *cause);  
150 -extern void kybd_inhibit(Boolean inhibit);  
151 -extern void kybd_init(void);  
152 -extern int kybd_prime(void);  
153 -extern void kybd_scroll_lock(Boolean lock);  
154 -extern Boolean run_ta(void);  
155 -extern int state_from_keymap(char keymap[32]); 145 +LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc);
  146 +LIB3270_INTERNAL void clear_xks(void);
  147 +LIB3270_INTERNAL void do_reset(Boolean explicit);
  148 +LIB3270_INTERNAL void hex_input(char *s);
  149 +LIB3270_INTERNAL void kybdlock_clr(unsigned int bits, const char *cause);
  150 +LIB3270_INTERNAL void kybd_inhibit(Boolean inhibit);
  151 +LIB3270_INTERNAL void kybd_init(void);
  152 +LIB3270_INTERNAL int kybd_prime(void);
  153 +LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock);
  154 +LIB3270_INTERNAL Boolean run_ta(void);
  155 +LIB3270_INTERNAL int state_from_keymap(char keymap[32]);
  156 +LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno);
  157 +LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270 unused, void *dunno);
  158 +
156 159
157 #endif /* KYBDC_H_INCLUDED */ 160 #endif /* KYBDC_H_INCLUDED */
@@ -303,6 +303,8 @@ static void screen_update(H3270 *session, int bstart, int bend) @@ -303,6 +303,8 @@ static void screen_update(H3270 *session, int bstart, int bend)
303 a = color_from_fa(fa); 303 a = color_from_fa(fa);
304 fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay 304 fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay
305 305
  306 + trace("%s start=%d end=%d",__FUNCTION__,bstart,bend);
  307 +
306 for(baddr = bstart; baddr < bend; baddr++) 308 for(baddr = bstart; baddr < bend; baddr++)
307 { 309 {
308 if(session->ea_buf[baddr].fa) 310 if(session->ea_buf[baddr].fa)
@@ -361,6 +363,8 @@ static void screen_update(H3270 *session, int bstart, int bend) @@ -361,6 +363,8 @@ static void screen_update(H3270 *session, int bstart, int bend)
361 363
362 session->changed(session,first,len); 364 session->changed(session,first,len);
363 } 365 }
  366 +
  367 + trace("%s ends",__FUNCTION__);
364 } 368 }
365 369
366 void screen_disp(H3270 *session) 370 void screen_disp(H3270 *session)
@@ -473,13 +473,9 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr @@ -473,13 +473,9 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr
473 { 473 {
474 struct connect_parm p = { sizeof(struct connect_parm), sockfd, addr, addrlen, -1 }; 474 struct connect_parm p = { sizeof(struct connect_parm), sockfd, addr, addrlen, -1 };
475 475
476 -#ifdef _WIN32  
477 - do_connect_sock(hSession,&p);  
478 -#else  
479 trace("%s: Connect begin sock=%d",__FUNCTION__,p.sockfd); 476 trace("%s: Connect begin sock=%d",__FUNCTION__,p.sockfd);
480 lib3270_call_thread((int (*)(H3270 *, void *)) do_connect_sock,hSession,&p); 477 lib3270_call_thread((int (*)(H3270 *, void *)) do_connect_sock,hSession,&p);
481 trace("%s: Connect ends, rc=%d",__FUNCTION__,p.err); 478 trace("%s: Connect ends, rc=%d",__FUNCTION__,p.err);
482 -#endif // _WIN32  
483 479
484 return p.err; 480 return p.err;
485 } 481 }