diff --git a/ansi.c b/ansi.c index 770457c..07dda82 100644 --- a/ansi.c +++ b/ansi.c @@ -1682,8 +1682,7 @@ ansi_scroll(void) } /* Callback for when we enter ANSI mode. */ -static void -ansi_in3270(H3270 *session, int in3270, void *dunno) +void ansi_in3270(H3270 *session, int in3270, void *dunno) { if (!in3270) (void) ansi_reset(0, 0); @@ -1705,12 +1704,6 @@ trace_pending_mb(void) /* * External entry points */ - -void ansi_init(void) -{ - lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,ansi_in3270,NULL); -} - void ansi_process(unsigned int c) { diff --git a/ansic.h b/ansic.h index 9a2c19e..e872e95 100644 --- a/ansic.h +++ b/ansic.h @@ -19,7 +19,6 @@ #if defined(X3270_ANSI) /*[*/ -LIB3270_INTERNAL void ansi_init(void); LIB3270_INTERNAL void ansi_process(unsigned int c); LIB3270_INTERNAL void ansi_send_clear(void); LIB3270_INTERNAL void ansi_send_down(void); @@ -29,11 +28,12 @@ LIB3270_INTERNAL void ansi_send_pa(int nn); LIB3270_INTERNAL void ansi_send_pf(int nn); LIB3270_INTERNAL void ansi_send_right(void); LIB3270_INTERNAL void ansi_send_up(void); +LIB3270_INTERNAL void ansi_in3270(H3270 *session, int in3270, void *dunno); + LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE type); #else /*][*/ -#define ansi_init() #define ansi_process(n) #define ansi_send_clear() #define ansi_send_down() diff --git a/api.h b/api.h index 4d499ea..8e77970 100644 --- a/api.h +++ b/api.h @@ -401,8 +401,6 @@ #define host_connect(n,wait) lib3270_connect(NULL,n,wait) #define host_reconnect(w) lib3270_reconnect(NULL,w) -// #define register_schange(tx,func) lib3270_register_schange(NULL,tx,func,NULL) - /* Console/Trace window */ // LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label); // LOCAL_EXTERN void console_window_delete(HCONSOLE hwnd); diff --git a/init.c b/init.c index 56b2918..cb7055f 100644 --- a/init.c +++ b/init.c @@ -34,6 +34,8 @@ #include "globals.h" #include "appres.h" #include "charsetc.h" +#include "kybdc.h" +#include "ansic.h" #include @@ -254,8 +256,15 @@ H3270 * lib3270_session_new(const char *model) (void) charset_init(hSession,CN); } - kybd_init(); - ansi_init(); + trace("%s: Initializing KYBD",__FUNCTION__); + lib3270_register_schange(hSession,LIB3270_STATE_CONNECT,kybd_connect,NULL); + lib3270_register_schange(hSession,LIB3270_STATE_3270_MODE,kybd_in3270,NULL); + +#if defined(X3270_ANSI) + trace("%s: Initializing ANSI",__FUNCTION__); + lib3270_register_schange(hSession,LIB3270_STATE_3270_MODE,ansi_in3270,NULL); +#endif // X3270_ANSI + #if defined(X3270_FT) ft_init(hSession); diff --git a/kybd.c b/kybd.c index 6d3c31c..6774ae2 100644 --- a/kybd.c +++ b/kybd.c @@ -407,7 +407,7 @@ kybd_inhibit(Boolean inhibit) /* * Called when a host connects or disconnects. */ -static void kybd_connect(H3270 *session, int connected, void *dunno) +void kybd_connect(H3270 *session, int connected, void *dunno) { if (kybdlock & KL_DEFERRED_UNLOCK) RemoveTimeOut(unlock_id); @@ -426,8 +426,7 @@ static void kybd_connect(H3270 *session, int connected, void *dunno) /* * Called when we switch between 3270 and ANSI modes. */ -static void -kybd_in3270(H3270 *session, int in3270 unused, void *dunno) +void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) { if (kybdlock & KL_DEFERRED_UNLOCK) RemoveTimeOut(unlock_id); @@ -440,13 +439,15 @@ kybd_in3270(H3270 *session, int in3270 unused, void *dunno) /* * Called to initialize the keyboard logic. - */ + */ /* void kybd_init(void) { - /* Register interest in connect and disconnect events. */ + // Register kybd interest in connect and disconnect events. + trace("%s",__FUNCTION__); lib3270_register_schange(NULL,LIB3270_STATE_CONNECT,kybd_connect,NULL); lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,kybd_in3270,NULL); } +*/ /* * Toggle reverse mode. diff --git a/kybdc.h b/kybdc.h index ce6664e..576267f 100644 --- a/kybdc.h +++ b/kybdc.h @@ -142,16 +142,19 @@ extern void Up_action(Widget w, XEvent *event, String *params, Cardinal *num_ */ /* other functions */ -extern void add_xk(KeySym key, KeySym assoc); -extern void clear_xks(void); -extern void do_reset(Boolean explicit); -extern void hex_input(char *s); -extern void kybdlock_clr(unsigned int bits, const char *cause); -extern void kybd_inhibit(Boolean inhibit); -extern void kybd_init(void); -extern int kybd_prime(void); -extern void kybd_scroll_lock(Boolean lock); -extern Boolean run_ta(void); -extern int state_from_keymap(char keymap[32]); +LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc); +LIB3270_INTERNAL void clear_xks(void); +LIB3270_INTERNAL void do_reset(Boolean explicit); +LIB3270_INTERNAL void hex_input(char *s); +LIB3270_INTERNAL void kybdlock_clr(unsigned int bits, const char *cause); +LIB3270_INTERNAL void kybd_inhibit(Boolean inhibit); +LIB3270_INTERNAL void kybd_init(void); +LIB3270_INTERNAL int kybd_prime(void); +LIB3270_INTERNAL void kybd_scroll_lock(Boolean lock); +LIB3270_INTERNAL Boolean run_ta(void); +LIB3270_INTERNAL int state_from_keymap(char keymap[32]); +LIB3270_INTERNAL void kybd_connect(H3270 *session, int connected, void *dunno); +LIB3270_INTERNAL void kybd_in3270(H3270 *session, int in3270 unused, void *dunno); + #endif /* KYBDC_H_INCLUDED */ diff --git a/screen.c b/screen.c index 34344d6..2388438 100644 --- a/screen.c +++ b/screen.c @@ -303,6 +303,8 @@ static void screen_update(H3270 *session, int bstart, int bend) a = color_from_fa(fa); fa_addr = find_field_attribute(session,bstart); // may be -1, that's okay + trace("%s start=%d end=%d",__FUNCTION__,bstart,bend); + for(baddr = bstart; baddr < bend; baddr++) { if(session->ea_buf[baddr].fa) @@ -361,6 +363,8 @@ static void screen_update(H3270 *session, int bstart, int bend) session->changed(session,first,len); } + + trace("%s ends",__FUNCTION__); } void screen_disp(H3270 *session) diff --git a/telnet.c b/telnet.c index 136eba1..8708743 100644 --- a/telnet.c +++ b/telnet.c @@ -473,13 +473,9 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr { struct connect_parm p = { sizeof(struct connect_parm), sockfd, addr, addrlen, -1 }; -#ifdef _WIN32 - do_connect_sock(hSession,&p); -#else trace("%s: Connect begin sock=%d",__FUNCTION__,p.sockfd); lib3270_call_thread((int (*)(H3270 *, void *)) do_connect_sock,hSession,&p); trace("%s: Connect ends, rc=%d",__FUNCTION__,p.err); -#endif // _WIN32 return p.err; } -- libgit2 0.21.2