diff --git a/ansi.c b/ansi.c index 91b5b5f..fe8d552 100644 --- a/ansi.c +++ b/ansi.c @@ -618,7 +618,7 @@ static enum lib3270_ansi_state ansi_reset(H3270 *hSession, int ig1 unused, int i ctlr_aclear(hSession, 0, hSession->rows * hSession->cols, 1); ctlr_altbuffer(hSession,False); ctlr_clear(hSession,False); - hSession->set_width(hSession,80); + hSession->cbk.set_width(hSession,80); hSession->ansi_reset = 1; } hSession->pmi = 0; @@ -1459,7 +1459,7 @@ dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) if(hSession->allow_wide_mode) { hSession->wide_mode = 1; - hSession->set_width(hSession,132); + hSession->cbk.set_width(hSession,132); } break; case 7: /* wraparound mode */ @@ -1493,7 +1493,7 @@ dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) if (hSession->allow_wide_mode) { hSession->wide_mode = 0; - hSession->set_width(hSession,80); + hSession->cbk.set_width(hSession,80); } break; case 7: /* no wraparound mode */ @@ -1556,7 +1556,7 @@ dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) if (hSession->allow_wide_mode) { hSession->wide_mode = hSession->saved_wide_mode; - hSession->set_width(hSession,hSession->wide_mode ? 132 : 80); + hSession->cbk.set_width(hSession,hSession->wide_mode ? 132 : 80); } break; case 7: /* wraparound mode */ diff --git a/charset.c b/charset.c index 3373c33..162e1f3 100644 --- a/charset.c +++ b/charset.c @@ -401,7 +401,7 @@ LIB3270_ACTION( charsettable ) baddr++; } - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } diff --git a/ctlr.c b/ctlr.c index 569a798..a07d6c5 100644 --- a/ctlr.c +++ b/ctlr.c @@ -95,9 +95,9 @@ static const unsigned char code_table[64] = #define IsBlank(c) ((c == EBC_null) || (c == EBC_space)) -#define ALL_CHANGED(h) if(lib3270_in_ansi(h)) (h)->changed(h,0,(h)->rows*(h)->cols); -#define REGION_CHANGED(h, f, l) if(lib3270_in_ansi(h)) (h)->changed(h,f,l) -#define ONE_CHANGED(h,n) if(lib3270_in_ansi(h)) (h)->changed(h,n,n+1); +#define ALL_CHANGED(h) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,0,(h)->rows*(h)->cols); +#define REGION_CHANGED(h, f, l) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,f,l) +#define ONE_CHANGED(h,n) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,n,n+1); #define DECODE_BADDR(c1, c2) \ ((((c1) & 0xC0) == 0x00) ? \ @@ -379,16 +379,6 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) static void set_formatted(H3270 *hSession, int state) { hSession->formatted = state; -/* - int last = (int) hSession->formatted; - hSession->formatted = state; - - if( ((int) hSession->formatted) != last) - { - trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); - hSession->update_formatted(hSession,hSession->formatted); - } -*/ } /** @@ -640,7 +630,7 @@ void ctlr_erase(H3270 *session, int alt) kybd_inhibit(session,False); ctlr_clear(session,True); - session->erase(session); + session->cbk.erase(session); if(alt == session->screen_alt) return; @@ -648,7 +638,7 @@ void ctlr_erase(H3270 *session, int alt) if (alt) { /* Going from 24x80 to maximum. */ - session->display(session); + session->cbk.display(session); set_viewsize(session,session->maxROWS,session->maxCOLS); } @@ -660,7 +650,7 @@ void ctlr_erase(H3270 *session, int alt) if(session->vcontrol) { ctlr_blanks(session); - session->display(session); + session->cbk.display(session); } if(lib3270_get_toggle(session,LIB3270_TOGGLE_ALTSCREEN)) @@ -2465,7 +2455,7 @@ void ctlr_clear(H3270 *session, Boolean can_snap) session->sscp_start = 0; // ALL_CHANGED; - session->erase(session); + session->cbk.erase(session); } /** @@ -2700,7 +2690,7 @@ void ctlr_scroll(H3270 *hSession) /* Clear the last line. */ (void) memset((char *) &hSession->ea_buf[qty], 0, hSession->cols * sizeof(struct lib3270_ea)); - hSession->display(hSession); + hSession->cbk.display(hSession); } #endif /*]*/ @@ -2845,10 +2835,10 @@ void ticking_start(H3270 *hSession, Boolean anyway) { CHECK_SESSION_HANDLE(hSession); - if(hSession->set_timer) + if(hSession->cbk.set_timer) { if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SHOW_TIMING) || anyway) - hSession->set_timer(hSession,1); + hSession->cbk.set_timer(hSession,1); } else { @@ -2875,9 +2865,9 @@ static void ticking_stop(H3270 *hSession) { CHECK_SESSION_HANDLE(hSession); - if(hSession->set_timer) + if(hSession->cbk.set_timer) { - hSession->set_timer(hSession,0); + hSession->cbk.set_timer(hSession,0); } else { diff --git a/host.c b/host.c index 08ae110..b371c54 100644 --- a/host.c +++ b/host.c @@ -125,8 +125,8 @@ void lib3270_set_connected(H3270 *hSession) hSession->starting = 1; // Enable autostart lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); - if(hSession->update_connect) - hSession->update_connect(hSession,1); + if(hSession->cbk.update_connect) + hSession->cbk.update_connect(hSession,1); } void lib3270_set_disconnected(H3270 *hSession) @@ -143,10 +143,10 @@ void lib3270_set_disconnected(H3270 *hSession) status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); - if(hSession->update_connect) - hSession->update_connect(hSession,0); + if(hSession->cbk.update_connect) + hSession->cbk.update_connect(hSession,0); - hSession->update_ssl(hSession,hSession->secure); + hSession->cbk.update_ssl(hSession,hSession->secure); } diff --git a/kybd.c b/kybd.c index a2d42c9..2ffb146 100644 --- a/kybd.c +++ b/kybd.c @@ -1396,7 +1396,7 @@ LIB3270_ACTION( delete ) if (!hSession->ea_buf[baddr].fa) cursor_move(hSession,baddr); } - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } @@ -1428,7 +1428,7 @@ LIB3270_ACTION( backspace ) DEC_BA(baddr); cursor_move(hSession,baddr); } - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } @@ -1495,7 +1495,7 @@ static void do_erase(H3270 *hSession) cursor_move(hSession,baddr); (void) do_delete(hSession); } - hSession->display(hSession); + hSession->cbk.display(hSession); } LIB3270_ACTION( erase ) @@ -1876,7 +1876,7 @@ LIB3270_ACTION( dup ) #endif if (key_Character(hSession, EBC_dup, False, False, NULL)) { - hSession->display(hSession); + hSession->cbk.display(hSession); cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr)); } @@ -2036,7 +2036,7 @@ LIB3270_ACTION( eraseeol ) hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; } (void) ctlr_dbcs_postprocess(hSession); - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } @@ -2093,7 +2093,7 @@ LIB3270_ACTION( eraseeof ) hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; } (void) ctlr_dbcs_postprocess(hSession); - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } @@ -2149,7 +2149,7 @@ LIB3270_ACTION( eraseinput ) ctlr_clear(hSession,True); cursor_move(hSession,0); } - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } @@ -2218,7 +2218,7 @@ LIB3270_ACTION( deleteword ) else do_erase(hSession); } - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } @@ -2264,7 +2264,7 @@ LIB3270_ACTION( deletefield ) ctlr_add(hSession,baddr, EBC_null, 0); INC_BA(baddr); } - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } @@ -2909,7 +2909,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len break; } - hSession->display(hSession); + hSession->cbk.display(hSession); return len; } diff --git a/paste.c b/paste.c index 49af3db..32fe51f 100644 --- a/paste.c +++ b/paste.c @@ -238,12 +238,12 @@ LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, cons if(row >= 0 && col >= 0 && row <= hSession->rows && col <= hSession->cols) { - hSession->suspend(hSession); + hSession->cbk.suspend(hSession); hSession->cursor_addr = (row * hSession->cols) + col; rc = set_string(hSession, str); - hSession->resume(hSession); + hSession->cbk.resume(hSession); } return rc; @@ -268,9 +268,9 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *hSession, const unsigned char *str) if(hSession->kybdlock) return -EINVAL; - hSession->suspend(hSession); + hSession->cbk.suspend(hSession); rc = set_string(hSession, str); - hSession->resume(hSession); + hSession->cbk.resume(hSession); return rc; } diff --git a/private.h b/private.h index 607bf3e..1c6ec61 100644 --- a/private.h +++ b/private.h @@ -114,11 +114,6 @@ #undef X3270_MENUS #endif /*]*/ -/* Functions we may need to supply. */ -#if defined(NEED_STRTOK_R) /*[*/ - extern char *strtok_r(char *str, const char *sep, char **last); -#endif /*]*/ - /* types of internal actions */ enum iaction { IA_STRING, IA_PASTE, IA_REDRAW, @@ -141,16 +136,6 @@ LIB3270_INTERNAL const char * build_rpq_revision; #endif /*]*/ -#if defined(X3270_DBCS) /*[*/ - LIB3270_INTERNAL char *full_efontname_dbcs; -#endif /*]*/ - - -/* keyboard modifer bitmap */ -#define ShiftKeyDown 0x01 -#define MetaKeyDown 0x02 -#define AltKeyDown 0x04 - /* toggle names */ struct toggle_name { const char *name; @@ -226,6 +211,28 @@ LIB3270_INTERNAL struct _ansictl char vlnext; } ansictl; +/** extended attributes */ +struct lib3270_ea +{ + unsigned char cc; ///< @brief EBCDIC or ASCII character code + unsigned char fa; ///< @brief field attribute, it nonzero + unsigned char fg; ///< @brief foreground color (0x00 or 0xf) + unsigned char bg; ///< @brief background color (0x00 or 0xf) + unsigned char gr; ///< @brief ANSI graphics rendition bits + unsigned char cs; ///< @brief character set (GE flag, or 0..2) + unsigned char ic; ///< @brief input control (DBCS) + unsigned char db; ///< @brief DBCS state +}; + +struct lib3270_text +{ + unsigned char chr; ///< @brief ASCII character code + unsigned short attr; ///< @brief Converted character attribute (color & etc) +}; + + + + /* default charset translation tables */ // LIB3270_INTERNAL const unsigned short ebc2asc0[256]; // LIB3270_INTERNAL const unsigned short asc2ft0[256]; diff --git a/screen.c b/screen.c index 5ef8ed3..6f04f7e 100644 --- a/screen.c +++ b/screen.c @@ -104,7 +104,7 @@ static void addch(H3270 *session, int baddr, unsigned char c, unsigned short att session->text[baddr].chr = c; session->text[baddr].attr = attr; - session->update(session,baddr,c,attr,baddr == session->cursor_addr); + session->cbk.update(session,baddr,c,attr,baddr == session->cursor_addr); } LIB3270_EXPORT int lib3270_get_element(H3270 *h, int baddr, unsigned char *c, unsigned short *attr) @@ -140,7 +140,7 @@ int screen_init(H3270 *session) ctlr_reinit(session,-1); /* Finish screen initialization. */ - session->suspend(session); + session->cbk.suspend(session); return 0; } @@ -259,8 +259,8 @@ void update_model_info(H3270 *session, int model, int cols, int rows) /* Update the model name. */ (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,session->extended ? "-E" : ""); - trace("%s: %p",__FUNCTION__,session->update_model); - session->update_model(session, session->model_name,session->model_num,rows,cols); + trace("%s: %p",__FUNCTION__,session->cbk.update_model); + session->cbk.update_model(session, session->model_name,session->model_num,rows,cols); } LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr) @@ -355,7 +355,7 @@ void screen_update(H3270 *session, int bstart, int bend) len++; } - session->changed(session,first,len); + session->cbk.changed(session,first,len); } if(session->starting && session->formatted && !session->kybdlock && lib3270_in_3270(session)) @@ -364,7 +364,7 @@ void screen_update(H3270 *session, int bstart, int bend) // cursor_move(session,next_unprotected(session,0)); // lib3270_emulate_input(session,"\\n",-1,0); - session->autostart(session); + session->cbk.autostart(session); #ifdef DEBUG { @@ -416,7 +416,7 @@ LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *h, int row, int col) if(baddr != h->cursor_addr) { h->cursor_addr = baddr; - h->update_cursor(h,(unsigned short) row,(unsigned short) col,h->text[baddr].chr,h->text[baddr].attr); + h->cbk.update_cursor(h,(unsigned short) row,(unsigned short) col,h->text[baddr].chr,h->text[baddr].attr); } } @@ -434,7 +434,7 @@ int cursor_move(H3270 *h, int baddr) if(baddr >= 0) { h->cursor_addr = baddr; - h->update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); + h->cbk.update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); } return ret; @@ -447,7 +447,7 @@ void set_status(H3270 *session, LIB3270_FLAG id, Boolean on) CHECK_SESSION_HANDLE(session); session->oia_flag[id] = (on != 0); - session->update_oia(session,id,session->oia_flag[id]); + session->cbk.update_oia(session,id,session->oia_flag[id]); } @@ -455,7 +455,7 @@ void status_ctlr_done(H3270 *session) { CHECK_SESSION_HANDLE(session); set_status(session,OIA_FLAG_UNDERA,True); - session->ctlr_done(session); + session->cbk.ctlr_done(session); } void status_oerr(H3270 *session, int error_type) @@ -486,8 +486,8 @@ void status_oerr(H3270 *session, int error_type) void status_connecting(H3270 *session, Boolean on) { - if(session->cursor) - session->cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); + if(session->cbk.cursor) + session->cbk.cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); status_changed(session, on ? LIB3270_MESSAGE_CONNECTING : LIB3270_MESSAGE_NONE); } @@ -506,12 +506,12 @@ void status_reset(H3270 *session) } else { - if(session->cursor) - session->cursor(session,CURSOR_MODE_NORMAL); + if(session->cbk.cursor) + session->cbk.cursor(session,CURSOR_MODE_NORMAL); status_changed(session,LIB3270_MESSAGE_NONE); } - session->display(session); + session->cbk.display(session); } @@ -573,7 +573,7 @@ void status_changed(H3270 *session, LIB3270_STATUS id) session->oia_status = id; - session->update_status(session,id); + session->cbk.update_status(session,id); } void status_twait(H3270 *session) @@ -593,8 +593,8 @@ void set_viewsize(H3270 *session, int rows, int cols) session->rows = rows; session->cols = cols; - if(session->configure) - session->configure(session,session->rows,session->cols); + if(session->cbk.configure) + session->cbk.configure(session,session->rows,session->cols); } @@ -602,8 +602,8 @@ void status_lu(H3270 *session, const char *lu) { CHECK_SESSION_HANDLE(session); - if(session->update_luname) - session->update_luname(session,lu); + if(session->cbk.update_luname) + session->cbk.update_luname(session,lu); } @@ -660,8 +660,8 @@ void status_untiming(H3270 *session) { CHECK_SESSION_HANDLE(session); - if(session->set_timer) - session->set_timer(session,0); + if(session->cbk.set_timer) + session->cbk.set_timer(session,0); } static int logpopup(H3270 *session, void *widget, LIB3270_NOTIFY type, const char *title, const char *msg, const char *fmt, va_list arg) @@ -740,8 +740,8 @@ void mcursor_set(H3270 *session,LIB3270_CURSOR m) { CHECK_SESSION_HANDLE(session); - if(session->cursor) - session->cursor(session,m); + if(session->cbk.cursor) + session->cbk.cursor(session,m); } LIB3270_ACTION( testpattern ) @@ -832,7 +832,7 @@ LIB3270_ACTION( testpattern ) hSession->ea_buf[f].gr = gr[grpos]; } - hSession->display(hSession); + hSession->cbk.display(hSession); return 0; } diff --git a/selection.c b/selection.c index de2b4f7..ac3f99a 100644 --- a/selection.c +++ b/selection.c @@ -104,7 +104,7 @@ static void update_selected_rectangle(H3270 *session) if(!(row >= p[0].row && row <= p[1].row && col >= p[0].col && col <= p[1].col) && (session->text[baddr].attr & LIB3270_ATTR_SELECTED)) { session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); } baddr++; } @@ -119,7 +119,7 @@ static void update_selected_rectangle(H3270 *session) if((row >= p[0].row && row <= p[1].row && col >= p[0].col && col <= p[1].col) && !(session->text[baddr].attr & LIB3270_ATTR_SELECTED)) { session->text[baddr].attr |= LIB3270_ATTR_SELECTED; - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); } baddr++; } @@ -140,7 +140,7 @@ static void update_selected_region(H3270 *session) if(session->text[baddr].attr & LIB3270_ATTR_SELECTED) { session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); } } @@ -149,7 +149,7 @@ static void update_selected_region(H3270 *session) if(session->text[baddr].attr & LIB3270_ATTR_SELECTED) { session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); } } @@ -159,7 +159,7 @@ static void update_selected_region(H3270 *session) if(!(session->text[baddr].attr & LIB3270_ATTR_SELECTED)) { session->text[baddr].attr |= LIB3270_ATTR_SELECTED; - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); } } @@ -191,13 +191,13 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession) if(hSession->text[a].attr & LIB3270_ATTR_SELECTED) { hSession->text[a].attr &= ~LIB3270_ATTR_SELECTED; - if(hSession->update) - hSession->update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); + if(hSession->cbk.update) + hSession->cbk.update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); } } - hSession->set_selection(hSession,0); - hSession->update_selection(hSession,-1,-1); + hSession->cbk.set_selection(hSession,0); + hSession->cbk.update_selection(hSession,-1,-1); } return 0; @@ -268,10 +268,10 @@ static void do_select(H3270 *h, int start, int end, int rect) if(!h->selected) { h->selected = 1; - h->set_selection(h,1); + h->cbk.set_selection(h,1); } - h->update_selection(h,start,end); + h->cbk.update_selection(h,start,end); } @@ -602,11 +602,11 @@ static void copy_chr(H3270 *hSession, int from, int to) memcpy(&hSession->ea_buf[to], &hSession->ea_buf[from],sizeof(struct lib3270_ea)); hSession->ea_buf[from].fa = 0; - hSession->update( hSession, - to, - hSession->text[to].chr, - hSession->text[to].attr, - to == hSession->cursor_addr ); + hSession->cbk.update( hSession, + to, + hSession->text[to].chr, + hSession->text[to].attr, + to == hSession->cursor_addr ); } static void clear_chr(H3270 *hSession, int baddr) @@ -616,11 +616,11 @@ static void clear_chr(H3270 *hSession, int baddr) hSession->ea_buf[baddr].cc = EBC_null; hSession->ea_buf[baddr].cs = 0; - hSession->update( hSession, - baddr, - hSession->text[baddr].chr, - hSession->text[baddr].attr, - baddr == hSession->cursor_addr ); + hSession->cbk.update( hSession, + baddr, + hSession->text[baddr].chr, + hSession->text[baddr].attr, + baddr == hSession->cursor_addr ); } int cut_addr(H3270 *hSession, int daddr, int saddr, int maxlen, int *sattr) @@ -727,7 +727,7 @@ char * cut_text(H3270 *hSession, char tok) if(!hSession->ea_buf[daddr].fa) clear_chr(hSession,daddr); - hSession->changed(hSession,0,maxlen); + hSession->cbk.changed(hSession,0,maxlen); lib3270_unselect(hSession); return text; diff --git a/session.c b/session.c index 1a9946b..664e0ec 100644 --- a/session.c +++ b/session.c @@ -192,28 +192,28 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char lib3270_set_host_charset(hSession,charset); // Default calls - hSession->write = lib3270_sock_send; - hSession->disconnect = lib3270_sock_disconnect; - hSession->update = update_char; - hSession->update_model = update_model; - hSession->update_cursor = update_cursor; - hSession->set_selection = nop_char; - hSession->ctlr_done = nop; - hSession->changed = changed; - hSession->erase = screen_disp; - hSession->suspend = nop; - hSession->resume = screen_disp; - hSession->update_oia = update_oia; - hSession->update_selection = update_selection; - hSession->cursor = set_cursor; - hSession->message = message; - hSession->update_ssl = update_ssl; - hSession->display = screen_disp; - hSession->set_width = nop_int; - hSession->update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; - hSession->autostart = nop; - hSession->set_timer = set_timer; - hSession->print = print; + hSession->cbk.write = lib3270_sock_send; + hSession->cbk.disconnect = lib3270_sock_disconnect; + hSession->cbk.update = update_char; + hSession->cbk.update_model = update_model; + hSession->cbk.update_cursor = update_cursor; + hSession->cbk.set_selection = nop_char; + hSession->cbk.ctlr_done = nop; + hSession->cbk.changed = changed; + hSession->cbk.erase = screen_disp; + hSession->cbk.suspend = nop; + hSession->cbk.resume = screen_disp; + hSession->cbk.update_oia = update_oia; + hSession->cbk.update_selection = update_selection; + hSession->cbk.cursor = set_cursor; + hSession->cbk.message = message; + hSession->cbk.update_ssl = update_ssl; + hSession->cbk.display = screen_disp; + hSession->cbk.set_width = nop_int; + hSession->cbk.update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; + hSession->cbk.autostart = nop; + hSession->cbk.set_timer = set_timer; + hSession->cbk.print = print; // Set the defaults. hSession->extended = 1; diff --git a/ssl.c b/ssl.c index 1a9c168..44e9539 100644 --- a/ssl.c +++ b/ssl.c @@ -450,5 +450,5 @@ void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state) session->secure = state; trace_dsn(session,"SSL state changes to %d\n",(int) state); - session->update_ssl(session,session->secure); + session->cbk.update_ssl(session,session->secure); } diff --git a/telnet.c b/telnet.c index 7121fe9..1e1844f 100644 --- a/telnet.c +++ b/telnet.c @@ -931,7 +931,7 @@ void net_disconnect(H3270 *session) set_ssl_state(session,LIB3270_SSL_UNSECURE); #endif // HAVE_LIBSSL - session->disconnect(session); + session->cbk.disconnect(session); trace_dsn(session,"SENT disconnect\n"); @@ -1032,7 +1032,7 @@ void net_input(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno) { (void) ERR_error_string(e, err_buf); trace_dsn(hSession,"RCVD SSL_read error %ld (%s)\n", e,err_buf); - hSession->message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); + hSession->cbk.message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); } else { @@ -2054,7 +2054,7 @@ static void net_rawout(H3270 *hSession, unsigned const char *buf, size_t len) while (len) { - int nw = hSession->write(hSession,buf,len); + int nw = hSession->cbk.write(hSession,buf,len); if (nw > 0) { diff --git a/toggles.c b/toggles.c index 1f94296..b9b5758 100644 --- a/toggles.c +++ b/toggles.c @@ -240,8 +240,8 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall); t->upcall(session, t, TT_INTERACTIVE); - if(session->update_toggle) - session->update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); + if(session->cbk.update_toggle) + session->cbk.update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); } @@ -291,7 +291,7 @@ static void toggle_altscreen(H3270 *session, struct lib3270_toggle *t, LIB3270_T static void toggle_redraw(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) { - session->display(session); + session->cbk.display(session); } /* diff --git a/util.c b/util.c index 6ea3399..1703899 100644 --- a/util.c +++ b/util.c @@ -1009,7 +1009,7 @@ int gettimeofday(struct timeval *tv, void *ignored) { CHECK_SESSION_HANDLE(h); trace("%s(%p)",__FUNCTION__,h); - return h->print(h); + return h->cbk.print(h); } -- libgit2 0.21.2