Commit a31b67340c6cf7680407ccc4bb88993a462edfd8

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

Tentando identificar mais segfaults em ntdll.dll

ansi.c
... ... @@ -1682,8 +1682,7 @@ ansi_scroll(void)
1682 1682 }
1683 1683  
1684 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 1687 if (!in3270)
1689 1688 (void) ansi_reset(0, 0);
... ... @@ -1705,12 +1704,6 @@ trace_pending_mb(void)
1705 1704 /*
1706 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 1707 void
1715 1708 ansi_process(unsigned int c)
1716 1709 {
... ...
ansic.h
... ... @@ -19,7 +19,6 @@
19 19  
20 20 #if defined(X3270_ANSI) /*[*/
21 21  
22   -LIB3270_INTERNAL void ansi_init(void);
23 22 LIB3270_INTERNAL void ansi_process(unsigned int c);
24 23 LIB3270_INTERNAL void ansi_send_clear(void);
25 24 LIB3270_INTERNAL void ansi_send_down(void);
... ... @@ -29,11 +28,12 @@ LIB3270_INTERNAL void ansi_send_pa(int nn);
29 28 LIB3270_INTERNAL void ansi_send_pf(int nn);
30 29 LIB3270_INTERNAL void ansi_send_right(void);
31 30 LIB3270_INTERNAL void ansi_send_up(void);
  31 +LIB3270_INTERNAL void ansi_in3270(H3270 *session, int in3270, void *dunno);
  32 +
32 33 LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE type);
33 34  
34 35 #else /*][*/
35 36  
36   -#define ansi_init()
37 37 #define ansi_process(n)
38 38 #define ansi_send_clear()
39 39 #define ansi_send_down()
... ...
api.h
... ... @@ -401,8 +401,6 @@
401 401 #define host_connect(n,wait) lib3270_connect(NULL,n,wait)
402 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 404 /* Console/Trace window */
407 405 // LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label);
408 406 // LOCAL_EXTERN void console_window_delete(HCONSOLE hwnd);
... ...
init.c
... ... @@ -34,6 +34,8 @@
34 34 #include "globals.h"
35 35 #include "appres.h"
36 36 #include "charsetc.h"
  37 +#include "kybdc.h"
  38 +#include "ansic.h"
37 39  
38 40 #include <malloc.h>
39 41  
... ... @@ -254,8 +256,15 @@ H3270 * lib3270_session_new(const char *model)
254 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 269 #if defined(X3270_FT)
261 270 ft_init(hSession);
... ...
kybd.c
... ... @@ -407,7 +407,7 @@ kybd_inhibit(Boolean inhibit)
407 407 /*
408 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 412 if (kybdlock & KL_DEFERRED_UNLOCK)
413 413 RemoveTimeOut(unlock_id);
... ... @@ -426,8 +426,7 @@ static void kybd_connect(H3270 *session, int connected, void *dunno)
426 426 /*
427 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 431 if (kybdlock & KL_DEFERRED_UNLOCK)
433 432 RemoveTimeOut(unlock_id);
... ... @@ -440,13 +439,15 @@ kybd_in3270(H3270 *session, int in3270 unused, void *dunno)
440 439  
441 440 /*
442 441 * Called to initialize the keyboard logic.
443   - */
  442 + */ /*
444 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 447 lib3270_register_schange(NULL,LIB3270_STATE_CONNECT,kybd_connect,NULL);
448 448 lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,kybd_in3270,NULL);
449 449 }
  450 +*/
450 451  
451 452 /*
452 453 * Toggle reverse mode.
... ...
kybdc.h
... ... @@ -142,16 +142,19 @@ extern void Up_action(Widget w, XEvent *event, String *params, Cardinal *num_
142 142 */
143 143  
144 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 160 #endif /* KYBDC_H_INCLUDED */
... ...
screen.c
... ... @@ -303,6 +303,8 @@ static void screen_update(H3270 *session, int bstart, int bend)
303 303 a = color_from_fa(fa);
304 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 308 for(baddr = bstart; baddr < bend; baddr++)
307 309 {
308 310 if(session->ea_buf[baddr].fa)
... ... @@ -361,6 +363,8 @@ static void screen_update(H3270 *session, int bstart, int bend)
361 363  
362 364 session->changed(session,first,len);
363 365 }
  366 +
  367 + trace("%s ends",__FUNCTION__);
364 368 }
365 369  
366 370 void screen_disp(H3270 *session)
... ...
telnet.c
... ... @@ -473,13 +473,9 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr
473 473 {
474 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 476 trace("%s: Connect begin sock=%d",__FUNCTION__,p.sockfd);
480 477 lib3270_call_thread((int (*)(H3270 *, void *)) do_connect_sock,hSession,&p);
481 478 trace("%s: Connect ends, rc=%d",__FUNCTION__,p.err);
482   -#endif // _WIN32
483 479  
484 480 return p.err;
485 481 }
... ...