Commit 47203aff7513963687c1d338eb9dc2d6a8760398
1 parent
360022bc
Exists in
master
and in
3 other branches
Isolando callbacks da estrutura principal.
Showing
14 changed files
with
135 additions
and
138 deletions
Show diff stats
ansi.c
| ... | ... | @@ -618,7 +618,7 @@ static enum lib3270_ansi_state ansi_reset(H3270 *hSession, int ig1 unused, int i |
| 618 | 618 | ctlr_aclear(hSession, 0, hSession->rows * hSession->cols, 1); |
| 619 | 619 | ctlr_altbuffer(hSession,False); |
| 620 | 620 | ctlr_clear(hSession,False); |
| 621 | - hSession->set_width(hSession,80); | |
| 621 | + hSession->cbk.set_width(hSession,80); | |
| 622 | 622 | hSession->ansi_reset = 1; |
| 623 | 623 | } |
| 624 | 624 | hSession->pmi = 0; |
| ... | ... | @@ -1459,7 +1459,7 @@ dec_set(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1459 | 1459 | if(hSession->allow_wide_mode) |
| 1460 | 1460 | { |
| 1461 | 1461 | hSession->wide_mode = 1; |
| 1462 | - hSession->set_width(hSession,132); | |
| 1462 | + hSession->cbk.set_width(hSession,132); | |
| 1463 | 1463 | } |
| 1464 | 1464 | break; |
| 1465 | 1465 | case 7: /* wraparound mode */ |
| ... | ... | @@ -1493,7 +1493,7 @@ dec_reset(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1493 | 1493 | if (hSession->allow_wide_mode) |
| 1494 | 1494 | { |
| 1495 | 1495 | hSession->wide_mode = 0; |
| 1496 | - hSession->set_width(hSession,80); | |
| 1496 | + hSession->cbk.set_width(hSession,80); | |
| 1497 | 1497 | } |
| 1498 | 1498 | break; |
| 1499 | 1499 | case 7: /* no wraparound mode */ |
| ... | ... | @@ -1556,7 +1556,7 @@ dec_restore(H3270 *hSession, int ig1 unused, int ig2 unused) |
| 1556 | 1556 | if (hSession->allow_wide_mode) |
| 1557 | 1557 | { |
| 1558 | 1558 | hSession->wide_mode = hSession->saved_wide_mode; |
| 1559 | - hSession->set_width(hSession,hSession->wide_mode ? 132 : 80); | |
| 1559 | + hSession->cbk.set_width(hSession,hSession->wide_mode ? 132 : 80); | |
| 1560 | 1560 | } |
| 1561 | 1561 | break; |
| 1562 | 1562 | case 7: /* wraparound mode */ | ... | ... |
charset.c
ctlr.c
| ... | ... | @@ -95,9 +95,9 @@ static const unsigned char code_table[64] = |
| 95 | 95 | #define IsBlank(c) ((c == EBC_null) || (c == EBC_space)) |
| 96 | 96 | |
| 97 | 97 | |
| 98 | -#define ALL_CHANGED(h) if(lib3270_in_ansi(h)) (h)->changed(h,0,(h)->rows*(h)->cols); | |
| 99 | -#define REGION_CHANGED(h, f, l) if(lib3270_in_ansi(h)) (h)->changed(h,f,l) | |
| 100 | -#define ONE_CHANGED(h,n) if(lib3270_in_ansi(h)) (h)->changed(h,n,n+1); | |
| 98 | +#define ALL_CHANGED(h) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,0,(h)->rows*(h)->cols); | |
| 99 | +#define REGION_CHANGED(h, f, l) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,f,l) | |
| 100 | +#define ONE_CHANGED(h,n) if(lib3270_in_ansi(h)) (h)->cbk.changed(h,n,n+1); | |
| 101 | 101 | |
| 102 | 102 | #define DECODE_BADDR(c1, c2) \ |
| 103 | 103 | ((((c1) & 0xC0) == 0x00) ? \ |
| ... | ... | @@ -379,16 +379,6 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) |
| 379 | 379 | static void set_formatted(H3270 *hSession, int state) |
| 380 | 380 | { |
| 381 | 381 | hSession->formatted = state; |
| 382 | -/* | |
| 383 | - int last = (int) hSession->formatted; | |
| 384 | - hSession->formatted = state; | |
| 385 | - | |
| 386 | - if( ((int) hSession->formatted) != last) | |
| 387 | - { | |
| 388 | - trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); | |
| 389 | - hSession->update_formatted(hSession,hSession->formatted); | |
| 390 | - } | |
| 391 | -*/ | |
| 392 | 382 | } |
| 393 | 383 | |
| 394 | 384 | /** |
| ... | ... | @@ -640,7 +630,7 @@ void ctlr_erase(H3270 *session, int alt) |
| 640 | 630 | |
| 641 | 631 | kybd_inhibit(session,False); |
| 642 | 632 | ctlr_clear(session,True); |
| 643 | - session->erase(session); | |
| 633 | + session->cbk.erase(session); | |
| 644 | 634 | |
| 645 | 635 | if(alt == session->screen_alt) |
| 646 | 636 | return; |
| ... | ... | @@ -648,7 +638,7 @@ void ctlr_erase(H3270 *session, int alt) |
| 648 | 638 | if (alt) |
| 649 | 639 | { |
| 650 | 640 | /* Going from 24x80 to maximum. */ |
| 651 | - session->display(session); | |
| 641 | + session->cbk.display(session); | |
| 652 | 642 | |
| 653 | 643 | set_viewsize(session,session->maxROWS,session->maxCOLS); |
| 654 | 644 | } |
| ... | ... | @@ -660,7 +650,7 @@ void ctlr_erase(H3270 *session, int alt) |
| 660 | 650 | if(session->vcontrol) |
| 661 | 651 | { |
| 662 | 652 | ctlr_blanks(session); |
| 663 | - session->display(session); | |
| 653 | + session->cbk.display(session); | |
| 664 | 654 | } |
| 665 | 655 | |
| 666 | 656 | if(lib3270_get_toggle(session,LIB3270_TOGGLE_ALTSCREEN)) |
| ... | ... | @@ -2465,7 +2455,7 @@ void ctlr_clear(H3270 *session, Boolean can_snap) |
| 2465 | 2455 | session->sscp_start = 0; |
| 2466 | 2456 | |
| 2467 | 2457 | // ALL_CHANGED; |
| 2468 | - session->erase(session); | |
| 2458 | + session->cbk.erase(session); | |
| 2469 | 2459 | } |
| 2470 | 2460 | |
| 2471 | 2461 | /** |
| ... | ... | @@ -2700,7 +2690,7 @@ void ctlr_scroll(H3270 *hSession) |
| 2700 | 2690 | /* Clear the last line. */ |
| 2701 | 2691 | (void) memset((char *) &hSession->ea_buf[qty], 0, hSession->cols * sizeof(struct lib3270_ea)); |
| 2702 | 2692 | |
| 2703 | - hSession->display(hSession); | |
| 2693 | + hSession->cbk.display(hSession); | |
| 2704 | 2694 | |
| 2705 | 2695 | } |
| 2706 | 2696 | #endif /*]*/ |
| ... | ... | @@ -2845,10 +2835,10 @@ void ticking_start(H3270 *hSession, Boolean anyway) |
| 2845 | 2835 | { |
| 2846 | 2836 | CHECK_SESSION_HANDLE(hSession); |
| 2847 | 2837 | |
| 2848 | - if(hSession->set_timer) | |
| 2838 | + if(hSession->cbk.set_timer) | |
| 2849 | 2839 | { |
| 2850 | 2840 | if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SHOW_TIMING) || anyway) |
| 2851 | - hSession->set_timer(hSession,1); | |
| 2841 | + hSession->cbk.set_timer(hSession,1); | |
| 2852 | 2842 | } |
| 2853 | 2843 | else |
| 2854 | 2844 | { |
| ... | ... | @@ -2875,9 +2865,9 @@ static void ticking_stop(H3270 *hSession) |
| 2875 | 2865 | { |
| 2876 | 2866 | CHECK_SESSION_HANDLE(hSession); |
| 2877 | 2867 | |
| 2878 | - if(hSession->set_timer) | |
| 2868 | + if(hSession->cbk.set_timer) | |
| 2879 | 2869 | { |
| 2880 | - hSession->set_timer(hSession,0); | |
| 2870 | + hSession->cbk.set_timer(hSession,0); | |
| 2881 | 2871 | } |
| 2882 | 2872 | else |
| 2883 | 2873 | { | ... | ... |
host.c
| ... | ... | @@ -125,8 +125,8 @@ void lib3270_set_connected(H3270 *hSession) |
| 125 | 125 | hSession->starting = 1; // Enable autostart |
| 126 | 126 | |
| 127 | 127 | lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); |
| 128 | - if(hSession->update_connect) | |
| 129 | - hSession->update_connect(hSession,1); | |
| 128 | + if(hSession->cbk.update_connect) | |
| 129 | + hSession->cbk.update_connect(hSession,1); | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | void lib3270_set_disconnected(H3270 *hSession) |
| ... | ... | @@ -143,10 +143,10 @@ void lib3270_set_disconnected(H3270 *hSession) |
| 143 | 143 | |
| 144 | 144 | status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); |
| 145 | 145 | |
| 146 | - if(hSession->update_connect) | |
| 147 | - hSession->update_connect(hSession,0); | |
| 146 | + if(hSession->cbk.update_connect) | |
| 147 | + hSession->cbk.update_connect(hSession,0); | |
| 148 | 148 | |
| 149 | - hSession->update_ssl(hSession,hSession->secure); | |
| 149 | + hSession->cbk.update_ssl(hSession,hSession->secure); | |
| 150 | 150 | |
| 151 | 151 | } |
| 152 | 152 | ... | ... |
kybd.c
| ... | ... | @@ -1396,7 +1396,7 @@ LIB3270_ACTION( delete ) |
| 1396 | 1396 | if (!hSession->ea_buf[baddr].fa) |
| 1397 | 1397 | cursor_move(hSession,baddr); |
| 1398 | 1398 | } |
| 1399 | - hSession->display(hSession); | |
| 1399 | + hSession->cbk.display(hSession); | |
| 1400 | 1400 | return 0; |
| 1401 | 1401 | } |
| 1402 | 1402 | |
| ... | ... | @@ -1428,7 +1428,7 @@ LIB3270_ACTION( backspace ) |
| 1428 | 1428 | DEC_BA(baddr); |
| 1429 | 1429 | cursor_move(hSession,baddr); |
| 1430 | 1430 | } |
| 1431 | - hSession->display(hSession); | |
| 1431 | + hSession->cbk.display(hSession); | |
| 1432 | 1432 | return 0; |
| 1433 | 1433 | } |
| 1434 | 1434 | |
| ... | ... | @@ -1495,7 +1495,7 @@ static void do_erase(H3270 *hSession) |
| 1495 | 1495 | cursor_move(hSession,baddr); |
| 1496 | 1496 | (void) do_delete(hSession); |
| 1497 | 1497 | } |
| 1498 | - hSession->display(hSession); | |
| 1498 | + hSession->cbk.display(hSession); | |
| 1499 | 1499 | } |
| 1500 | 1500 | |
| 1501 | 1501 | LIB3270_ACTION( erase ) |
| ... | ... | @@ -1876,7 +1876,7 @@ LIB3270_ACTION( dup ) |
| 1876 | 1876 | #endif |
| 1877 | 1877 | if (key_Character(hSession, EBC_dup, False, False, NULL)) |
| 1878 | 1878 | { |
| 1879 | - hSession->display(hSession); | |
| 1879 | + hSession->cbk.display(hSession); | |
| 1880 | 1880 | cursor_move(hSession,next_unprotected(hSession,hSession->cursor_addr)); |
| 1881 | 1881 | } |
| 1882 | 1882 | |
| ... | ... | @@ -2036,7 +2036,7 @@ LIB3270_ACTION( eraseeol ) |
| 2036 | 2036 | hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; |
| 2037 | 2037 | } |
| 2038 | 2038 | (void) ctlr_dbcs_postprocess(hSession); |
| 2039 | - hSession->display(hSession); | |
| 2039 | + hSession->cbk.display(hSession); | |
| 2040 | 2040 | return 0; |
| 2041 | 2041 | } |
| 2042 | 2042 | |
| ... | ... | @@ -2093,7 +2093,7 @@ LIB3270_ACTION( eraseeof ) |
| 2093 | 2093 | hSession->ea_buf[hSession->cursor_addr].cc = EBC_si; |
| 2094 | 2094 | } |
| 2095 | 2095 | (void) ctlr_dbcs_postprocess(hSession); |
| 2096 | - hSession->display(hSession); | |
| 2096 | + hSession->cbk.display(hSession); | |
| 2097 | 2097 | return 0; |
| 2098 | 2098 | } |
| 2099 | 2099 | |
| ... | ... | @@ -2149,7 +2149,7 @@ LIB3270_ACTION( eraseinput ) |
| 2149 | 2149 | ctlr_clear(hSession,True); |
| 2150 | 2150 | cursor_move(hSession,0); |
| 2151 | 2151 | } |
| 2152 | - hSession->display(hSession); | |
| 2152 | + hSession->cbk.display(hSession); | |
| 2153 | 2153 | return 0; |
| 2154 | 2154 | } |
| 2155 | 2155 | |
| ... | ... | @@ -2218,7 +2218,7 @@ LIB3270_ACTION( deleteword ) |
| 2218 | 2218 | else |
| 2219 | 2219 | do_erase(hSession); |
| 2220 | 2220 | } |
| 2221 | - hSession->display(hSession); | |
| 2221 | + hSession->cbk.display(hSession); | |
| 2222 | 2222 | return 0; |
| 2223 | 2223 | } |
| 2224 | 2224 | |
| ... | ... | @@ -2264,7 +2264,7 @@ LIB3270_ACTION( deletefield ) |
| 2264 | 2264 | ctlr_add(hSession,baddr, EBC_null, 0); |
| 2265 | 2265 | INC_BA(baddr); |
| 2266 | 2266 | } |
| 2267 | - hSession->display(hSession); | |
| 2267 | + hSession->cbk.display(hSession); | |
| 2268 | 2268 | return 0; |
| 2269 | 2269 | } |
| 2270 | 2270 | |
| ... | ... | @@ -2909,7 +2909,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len |
| 2909 | 2909 | break; |
| 2910 | 2910 | } |
| 2911 | 2911 | |
| 2912 | - hSession->display(hSession); | |
| 2912 | + hSession->cbk.display(hSession); | |
| 2913 | 2913 | return len; |
| 2914 | 2914 | } |
| 2915 | 2915 | ... | ... |
paste.c
| ... | ... | @@ -238,12 +238,12 @@ LIB3270_EXPORT int lib3270_set_string_at(H3270 *hSession, int row, int col, cons |
| 238 | 238 | |
| 239 | 239 | if(row >= 0 && col >= 0 && row <= hSession->rows && col <= hSession->cols) |
| 240 | 240 | { |
| 241 | - hSession->suspend(hSession); | |
| 241 | + hSession->cbk.suspend(hSession); | |
| 242 | 242 | |
| 243 | 243 | hSession->cursor_addr = (row * hSession->cols) + col; |
| 244 | 244 | rc = set_string(hSession, str); |
| 245 | 245 | |
| 246 | - hSession->resume(hSession); | |
| 246 | + hSession->cbk.resume(hSession); | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | return rc; |
| ... | ... | @@ -268,9 +268,9 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *hSession, const unsigned char *str) |
| 268 | 268 | if(hSession->kybdlock) |
| 269 | 269 | return -EINVAL; |
| 270 | 270 | |
| 271 | - hSession->suspend(hSession); | |
| 271 | + hSession->cbk.suspend(hSession); | |
| 272 | 272 | rc = set_string(hSession, str); |
| 273 | - hSession->resume(hSession); | |
| 273 | + hSession->cbk.resume(hSession); | |
| 274 | 274 | |
| 275 | 275 | return rc; |
| 276 | 276 | } | ... | ... |
private.h
| ... | ... | @@ -114,11 +114,6 @@ |
| 114 | 114 | #undef X3270_MENUS |
| 115 | 115 | #endif /*]*/ |
| 116 | 116 | |
| 117 | -/* Functions we may need to supply. */ | |
| 118 | -#if defined(NEED_STRTOK_R) /*[*/ | |
| 119 | - extern char *strtok_r(char *str, const char *sep, char **last); | |
| 120 | -#endif /*]*/ | |
| 121 | - | |
| 122 | 117 | /* types of internal actions */ |
| 123 | 118 | enum iaction { |
| 124 | 119 | IA_STRING, IA_PASTE, IA_REDRAW, |
| ... | ... | @@ -141,16 +136,6 @@ LIB3270_INTERNAL const char * build_rpq_revision; |
| 141 | 136 | #endif /*]*/ |
| 142 | 137 | |
| 143 | 138 | |
| 144 | -#if defined(X3270_DBCS) /*[*/ | |
| 145 | - LIB3270_INTERNAL char *full_efontname_dbcs; | |
| 146 | -#endif /*]*/ | |
| 147 | - | |
| 148 | - | |
| 149 | -/* keyboard modifer bitmap */ | |
| 150 | -#define ShiftKeyDown 0x01 | |
| 151 | -#define MetaKeyDown 0x02 | |
| 152 | -#define AltKeyDown 0x04 | |
| 153 | - | |
| 154 | 139 | /* toggle names */ |
| 155 | 140 | struct toggle_name { |
| 156 | 141 | const char *name; |
| ... | ... | @@ -226,6 +211,28 @@ LIB3270_INTERNAL struct _ansictl |
| 226 | 211 | char vlnext; |
| 227 | 212 | } ansictl; |
| 228 | 213 | |
| 214 | +/** extended attributes */ | |
| 215 | +struct lib3270_ea | |
| 216 | +{ | |
| 217 | + unsigned char cc; ///< @brief EBCDIC or ASCII character code | |
| 218 | + unsigned char fa; ///< @brief field attribute, it nonzero | |
| 219 | + unsigned char fg; ///< @brief foreground color (0x00 or 0xf<n>) | |
| 220 | + unsigned char bg; ///< @brief background color (0x00 or 0xf<n>) | |
| 221 | + unsigned char gr; ///< @brief ANSI graphics rendition bits | |
| 222 | + unsigned char cs; ///< @brief character set (GE flag, or 0..2) | |
| 223 | + unsigned char ic; ///< @brief input control (DBCS) | |
| 224 | + unsigned char db; ///< @brief DBCS state | |
| 225 | +}; | |
| 226 | + | |
| 227 | +struct lib3270_text | |
| 228 | +{ | |
| 229 | + unsigned char chr; ///< @brief ASCII character code | |
| 230 | + unsigned short attr; ///< @brief Converted character attribute (color & etc) | |
| 231 | +}; | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 229 | 236 | /* default charset translation tables */ |
| 230 | 237 | // LIB3270_INTERNAL const unsigned short ebc2asc0[256]; |
| 231 | 238 | // LIB3270_INTERNAL const unsigned short asc2ft0[256]; | ... | ... |
screen.c
| ... | ... | @@ -104,7 +104,7 @@ static void addch(H3270 *session, int baddr, unsigned char c, unsigned short att |
| 104 | 104 | session->text[baddr].chr = c; |
| 105 | 105 | session->text[baddr].attr = attr; |
| 106 | 106 | |
| 107 | - session->update(session,baddr,c,attr,baddr == session->cursor_addr); | |
| 107 | + session->cbk.update(session,baddr,c,attr,baddr == session->cursor_addr); | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | 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) |
| 140 | 140 | ctlr_reinit(session,-1); |
| 141 | 141 | |
| 142 | 142 | /* Finish screen initialization. */ |
| 143 | - session->suspend(session); | |
| 143 | + session->cbk.suspend(session); | |
| 144 | 144 | |
| 145 | 145 | return 0; |
| 146 | 146 | } |
| ... | ... | @@ -259,8 +259,8 @@ void update_model_info(H3270 *session, int model, int cols, int rows) |
| 259 | 259 | /* Update the model name. */ |
| 260 | 260 | (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,session->extended ? "-E" : ""); |
| 261 | 261 | |
| 262 | - trace("%s: %p",__FUNCTION__,session->update_model); | |
| 263 | - session->update_model(session, session->model_name,session->model_num,rows,cols); | |
| 262 | + trace("%s: %p",__FUNCTION__,session->cbk.update_model); | |
| 263 | + session->cbk.update_model(session, session->model_name,session->model_num,rows,cols); | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | 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) |
| 355 | 355 | len++; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - session->changed(session,first,len); | |
| 358 | + session->cbk.changed(session,first,len); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | if(session->starting && session->formatted && !session->kybdlock && lib3270_in_3270(session)) |
| ... | ... | @@ -364,7 +364,7 @@ void screen_update(H3270 *session, int bstart, int bend) |
| 364 | 364 | |
| 365 | 365 | // cursor_move(session,next_unprotected(session,0)); |
| 366 | 366 | // lib3270_emulate_input(session,"\\n",-1,0); |
| 367 | - session->autostart(session); | |
| 367 | + session->cbk.autostart(session); | |
| 368 | 368 | |
| 369 | 369 | #ifdef DEBUG |
| 370 | 370 | { |
| ... | ... | @@ -416,7 +416,7 @@ LIB3270_EXPORT int lib3270_set_cursor_position(H3270 *h, int row, int col) |
| 416 | 416 | if(baddr != h->cursor_addr) |
| 417 | 417 | { |
| 418 | 418 | h->cursor_addr = baddr; |
| 419 | - h->update_cursor(h,(unsigned short) row,(unsigned short) col,h->text[baddr].chr,h->text[baddr].attr); | |
| 419 | + h->cbk.update_cursor(h,(unsigned short) row,(unsigned short) col,h->text[baddr].chr,h->text[baddr].attr); | |
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| ... | ... | @@ -434,7 +434,7 @@ int cursor_move(H3270 *h, int baddr) |
| 434 | 434 | if(baddr >= 0) |
| 435 | 435 | { |
| 436 | 436 | h->cursor_addr = baddr; |
| 437 | - h->update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); | |
| 437 | + h->cbk.update_cursor(h,(unsigned short) (baddr/h->cols),(unsigned short) (baddr%h->cols),h->text[baddr].chr,h->text[baddr].attr); | |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | return ret; |
| ... | ... | @@ -447,7 +447,7 @@ void set_status(H3270 *session, LIB3270_FLAG id, Boolean on) |
| 447 | 447 | CHECK_SESSION_HANDLE(session); |
| 448 | 448 | |
| 449 | 449 | session->oia_flag[id] = (on != 0); |
| 450 | - session->update_oia(session,id,session->oia_flag[id]); | |
| 450 | + session->cbk.update_oia(session,id,session->oia_flag[id]); | |
| 451 | 451 | |
| 452 | 452 | } |
| 453 | 453 | |
| ... | ... | @@ -455,7 +455,7 @@ void status_ctlr_done(H3270 *session) |
| 455 | 455 | { |
| 456 | 456 | CHECK_SESSION_HANDLE(session); |
| 457 | 457 | set_status(session,OIA_FLAG_UNDERA,True); |
| 458 | - session->ctlr_done(session); | |
| 458 | + session->cbk.ctlr_done(session); | |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | void status_oerr(H3270 *session, int error_type) |
| ... | ... | @@ -486,8 +486,8 @@ void status_oerr(H3270 *session, int error_type) |
| 486 | 486 | |
| 487 | 487 | void status_connecting(H3270 *session, Boolean on) |
| 488 | 488 | { |
| 489 | - if(session->cursor) | |
| 490 | - session->cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | |
| 489 | + if(session->cbk.cursor) | |
| 490 | + session->cbk.cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | |
| 491 | 491 | |
| 492 | 492 | status_changed(session, on ? LIB3270_MESSAGE_CONNECTING : LIB3270_MESSAGE_NONE); |
| 493 | 493 | } |
| ... | ... | @@ -506,12 +506,12 @@ void status_reset(H3270 *session) |
| 506 | 506 | } |
| 507 | 507 | else |
| 508 | 508 | { |
| 509 | - if(session->cursor) | |
| 510 | - session->cursor(session,CURSOR_MODE_NORMAL); | |
| 509 | + if(session->cbk.cursor) | |
| 510 | + session->cbk.cursor(session,CURSOR_MODE_NORMAL); | |
| 511 | 511 | status_changed(session,LIB3270_MESSAGE_NONE); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - session->display(session); | |
| 514 | + session->cbk.display(session); | |
| 515 | 515 | |
| 516 | 516 | } |
| 517 | 517 | |
| ... | ... | @@ -573,7 +573,7 @@ void status_changed(H3270 *session, LIB3270_STATUS id) |
| 573 | 573 | |
| 574 | 574 | session->oia_status = id; |
| 575 | 575 | |
| 576 | - session->update_status(session,id); | |
| 576 | + session->cbk.update_status(session,id); | |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | void status_twait(H3270 *session) |
| ... | ... | @@ -593,8 +593,8 @@ void set_viewsize(H3270 *session, int rows, int cols) |
| 593 | 593 | session->rows = rows; |
| 594 | 594 | session->cols = cols; |
| 595 | 595 | |
| 596 | - if(session->configure) | |
| 597 | - session->configure(session,session->rows,session->cols); | |
| 596 | + if(session->cbk.configure) | |
| 597 | + session->cbk.configure(session,session->rows,session->cols); | |
| 598 | 598 | |
| 599 | 599 | } |
| 600 | 600 | |
| ... | ... | @@ -602,8 +602,8 @@ void status_lu(H3270 *session, const char *lu) |
| 602 | 602 | { |
| 603 | 603 | CHECK_SESSION_HANDLE(session); |
| 604 | 604 | |
| 605 | - if(session->update_luname) | |
| 606 | - session->update_luname(session,lu); | |
| 605 | + if(session->cbk.update_luname) | |
| 606 | + session->cbk.update_luname(session,lu); | |
| 607 | 607 | |
| 608 | 608 | } |
| 609 | 609 | |
| ... | ... | @@ -660,8 +660,8 @@ void status_untiming(H3270 *session) |
| 660 | 660 | { |
| 661 | 661 | CHECK_SESSION_HANDLE(session); |
| 662 | 662 | |
| 663 | - if(session->set_timer) | |
| 664 | - session->set_timer(session,0); | |
| 663 | + if(session->cbk.set_timer) | |
| 664 | + session->cbk.set_timer(session,0); | |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | 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) |
| 740 | 740 | { |
| 741 | 741 | CHECK_SESSION_HANDLE(session); |
| 742 | 742 | |
| 743 | - if(session->cursor) | |
| 744 | - session->cursor(session,m); | |
| 743 | + if(session->cbk.cursor) | |
| 744 | + session->cbk.cursor(session,m); | |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | LIB3270_ACTION( testpattern ) |
| ... | ... | @@ -832,7 +832,7 @@ LIB3270_ACTION( testpattern ) |
| 832 | 832 | hSession->ea_buf[f].gr = gr[grpos]; |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | - hSession->display(hSession); | |
| 835 | + hSession->cbk.display(hSession); | |
| 836 | 836 | |
| 837 | 837 | return 0; |
| 838 | 838 | } | ... | ... |
selection.c
| ... | ... | @@ -104,7 +104,7 @@ static void update_selected_rectangle(H3270 *session) |
| 104 | 104 | if(!(row >= p[0].row && row <= p[1].row && col >= p[0].col && col <= p[1].col) && (session->text[baddr].attr & LIB3270_ATTR_SELECTED)) |
| 105 | 105 | { |
| 106 | 106 | session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; |
| 107 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 107 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 108 | 108 | } |
| 109 | 109 | baddr++; |
| 110 | 110 | } |
| ... | ... | @@ -119,7 +119,7 @@ static void update_selected_rectangle(H3270 *session) |
| 119 | 119 | if((row >= p[0].row && row <= p[1].row && col >= p[0].col && col <= p[1].col) && !(session->text[baddr].attr & LIB3270_ATTR_SELECTED)) |
| 120 | 120 | { |
| 121 | 121 | session->text[baddr].attr |= LIB3270_ATTR_SELECTED; |
| 122 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 122 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 123 | 123 | } |
| 124 | 124 | baddr++; |
| 125 | 125 | } |
| ... | ... | @@ -140,7 +140,7 @@ static void update_selected_region(H3270 *session) |
| 140 | 140 | if(session->text[baddr].attr & LIB3270_ATTR_SELECTED) |
| 141 | 141 | { |
| 142 | 142 | session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; |
| 143 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 143 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
| ... | ... | @@ -149,7 +149,7 @@ static void update_selected_region(H3270 *session) |
| 149 | 149 | if(session->text[baddr].attr & LIB3270_ATTR_SELECTED) |
| 150 | 150 | { |
| 151 | 151 | session->text[baddr].attr &= ~LIB3270_ATTR_SELECTED; |
| 152 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 152 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| ... | ... | @@ -159,7 +159,7 @@ static void update_selected_region(H3270 *session) |
| 159 | 159 | if(!(session->text[baddr].attr & LIB3270_ATTR_SELECTED)) |
| 160 | 160 | { |
| 161 | 161 | session->text[baddr].attr |= LIB3270_ATTR_SELECTED; |
| 162 | - session->update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 162 | + session->cbk.update(session,baddr,session->text[baddr].chr,session->text[baddr].attr,baddr == session->cursor_addr); | |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| ... | ... | @@ -191,13 +191,13 @@ LIB3270_EXPORT int lib3270_unselect(H3270 *hSession) |
| 191 | 191 | if(hSession->text[a].attr & LIB3270_ATTR_SELECTED) |
| 192 | 192 | { |
| 193 | 193 | hSession->text[a].attr &= ~LIB3270_ATTR_SELECTED; |
| 194 | - if(hSession->update) | |
| 195 | - hSession->update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); | |
| 194 | + if(hSession->cbk.update) | |
| 195 | + hSession->cbk.update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); | |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - hSession->set_selection(hSession,0); | |
| 200 | - hSession->update_selection(hSession,-1,-1); | |
| 199 | + hSession->cbk.set_selection(hSession,0); | |
| 200 | + hSession->cbk.update_selection(hSession,-1,-1); | |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return 0; |
| ... | ... | @@ -268,10 +268,10 @@ static void do_select(H3270 *h, int start, int end, int rect) |
| 268 | 268 | if(!h->selected) |
| 269 | 269 | { |
| 270 | 270 | h->selected = 1; |
| 271 | - h->set_selection(h,1); | |
| 271 | + h->cbk.set_selection(h,1); | |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - h->update_selection(h,start,end); | |
| 274 | + h->cbk.update_selection(h,start,end); | |
| 275 | 275 | |
| 276 | 276 | } |
| 277 | 277 | |
| ... | ... | @@ -602,11 +602,11 @@ static void copy_chr(H3270 *hSession, int from, int to) |
| 602 | 602 | memcpy(&hSession->ea_buf[to], &hSession->ea_buf[from],sizeof(struct lib3270_ea)); |
| 603 | 603 | hSession->ea_buf[from].fa = 0; |
| 604 | 604 | |
| 605 | - hSession->update( hSession, | |
| 606 | - to, | |
| 607 | - hSession->text[to].chr, | |
| 608 | - hSession->text[to].attr, | |
| 609 | - to == hSession->cursor_addr ); | |
| 605 | + hSession->cbk.update( hSession, | |
| 606 | + to, | |
| 607 | + hSession->text[to].chr, | |
| 608 | + hSession->text[to].attr, | |
| 609 | + to == hSession->cursor_addr ); | |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | static void clear_chr(H3270 *hSession, int baddr) |
| ... | ... | @@ -616,11 +616,11 @@ static void clear_chr(H3270 *hSession, int baddr) |
| 616 | 616 | hSession->ea_buf[baddr].cc = EBC_null; |
| 617 | 617 | hSession->ea_buf[baddr].cs = 0; |
| 618 | 618 | |
| 619 | - hSession->update( hSession, | |
| 620 | - baddr, | |
| 621 | - hSession->text[baddr].chr, | |
| 622 | - hSession->text[baddr].attr, | |
| 623 | - baddr == hSession->cursor_addr ); | |
| 619 | + hSession->cbk.update( hSession, | |
| 620 | + baddr, | |
| 621 | + hSession->text[baddr].chr, | |
| 622 | + hSession->text[baddr].attr, | |
| 623 | + baddr == hSession->cursor_addr ); | |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | int cut_addr(H3270 *hSession, int daddr, int saddr, int maxlen, int *sattr) |
| ... | ... | @@ -727,7 +727,7 @@ char * cut_text(H3270 *hSession, char tok) |
| 727 | 727 | if(!hSession->ea_buf[daddr].fa) |
| 728 | 728 | clear_chr(hSession,daddr); |
| 729 | 729 | |
| 730 | - hSession->changed(hSession,0,maxlen); | |
| 730 | + hSession->cbk.changed(hSession,0,maxlen); | |
| 731 | 731 | |
| 732 | 732 | lib3270_unselect(hSession); |
| 733 | 733 | return text; | ... | ... |
session.c
| ... | ... | @@ -192,28 +192,28 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char |
| 192 | 192 | lib3270_set_host_charset(hSession,charset); |
| 193 | 193 | |
| 194 | 194 | // Default calls |
| 195 | - hSession->write = lib3270_sock_send; | |
| 196 | - hSession->disconnect = lib3270_sock_disconnect; | |
| 197 | - hSession->update = update_char; | |
| 198 | - hSession->update_model = update_model; | |
| 199 | - hSession->update_cursor = update_cursor; | |
| 200 | - hSession->set_selection = nop_char; | |
| 201 | - hSession->ctlr_done = nop; | |
| 202 | - hSession->changed = changed; | |
| 203 | - hSession->erase = screen_disp; | |
| 204 | - hSession->suspend = nop; | |
| 205 | - hSession->resume = screen_disp; | |
| 206 | - hSession->update_oia = update_oia; | |
| 207 | - hSession->update_selection = update_selection; | |
| 208 | - hSession->cursor = set_cursor; | |
| 209 | - hSession->message = message; | |
| 210 | - hSession->update_ssl = update_ssl; | |
| 211 | - hSession->display = screen_disp; | |
| 212 | - hSession->set_width = nop_int; | |
| 213 | - hSession->update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; | |
| 214 | - hSession->autostart = nop; | |
| 215 | - hSession->set_timer = set_timer; | |
| 216 | - hSession->print = print; | |
| 195 | + hSession->cbk.write = lib3270_sock_send; | |
| 196 | + hSession->cbk.disconnect = lib3270_sock_disconnect; | |
| 197 | + hSession->cbk.update = update_char; | |
| 198 | + hSession->cbk.update_model = update_model; | |
| 199 | + hSession->cbk.update_cursor = update_cursor; | |
| 200 | + hSession->cbk.set_selection = nop_char; | |
| 201 | + hSession->cbk.ctlr_done = nop; | |
| 202 | + hSession->cbk.changed = changed; | |
| 203 | + hSession->cbk.erase = screen_disp; | |
| 204 | + hSession->cbk.suspend = nop; | |
| 205 | + hSession->cbk.resume = screen_disp; | |
| 206 | + hSession->cbk.update_oia = update_oia; | |
| 207 | + hSession->cbk.update_selection = update_selection; | |
| 208 | + hSession->cbk.cursor = set_cursor; | |
| 209 | + hSession->cbk.message = message; | |
| 210 | + hSession->cbk.update_ssl = update_ssl; | |
| 211 | + hSession->cbk.display = screen_disp; | |
| 212 | + hSession->cbk.set_width = nop_int; | |
| 213 | + hSession->cbk.update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; | |
| 214 | + hSession->cbk.autostart = nop; | |
| 215 | + hSession->cbk.set_timer = set_timer; | |
| 216 | + hSession->cbk.print = print; | |
| 217 | 217 | |
| 218 | 218 | // Set the defaults. |
| 219 | 219 | hSession->extended = 1; | ... | ... |
| ... | ... | @@ -450,5 +450,5 @@ void set_ssl_state(H3270 *session, LIB3270_SSL_STATE state) |
| 450 | 450 | session->secure = state; |
| 451 | 451 | trace_dsn(session,"SSL state changes to %d\n",(int) state); |
| 452 | 452 | |
| 453 | - session->update_ssl(session,session->secure); | |
| 453 | + session->cbk.update_ssl(session,session->secure); | |
| 454 | 454 | } | ... | ... |
telnet.c
| ... | ... | @@ -931,7 +931,7 @@ void net_disconnect(H3270 *session) |
| 931 | 931 | set_ssl_state(session,LIB3270_SSL_UNSECURE); |
| 932 | 932 | #endif // HAVE_LIBSSL |
| 933 | 933 | |
| 934 | - session->disconnect(session); | |
| 934 | + session->cbk.disconnect(session); | |
| 935 | 935 | |
| 936 | 936 | trace_dsn(session,"SENT disconnect\n"); |
| 937 | 937 | |
| ... | ... | @@ -1032,7 +1032,7 @@ void net_input(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *dunno) |
| 1032 | 1032 | { |
| 1033 | 1033 | (void) ERR_error_string(e, err_buf); |
| 1034 | 1034 | trace_dsn(hSession,"RCVD SSL_read error %ld (%s)\n", e,err_buf); |
| 1035 | - hSession->message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); | |
| 1035 | + hSession->cbk.message(hSession,LIB3270_NOTIFY_ERROR,_( "SSL Error" ),_( "SSL Read error" ),err_buf ); | |
| 1036 | 1036 | } |
| 1037 | 1037 | else |
| 1038 | 1038 | { |
| ... | ... | @@ -2054,7 +2054,7 @@ static void net_rawout(H3270 *hSession, unsigned const char *buf, size_t len) |
| 2054 | 2054 | |
| 2055 | 2055 | while (len) |
| 2056 | 2056 | { |
| 2057 | - int nw = hSession->write(hSession,buf,len); | |
| 2057 | + int nw = hSession->cbk.write(hSession,buf,len); | |
| 2058 | 2058 | |
| 2059 | 2059 | if (nw > 0) |
| 2060 | 2060 | { | ... | ... |
toggles.c
| ... | ... | @@ -240,8 +240,8 @@ static void toggle_notify(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGG |
| 240 | 240 | trace("%s: ix=%d upcall=%p",__FUNCTION__,ix,t->upcall); |
| 241 | 241 | t->upcall(session, t, TT_INTERACTIVE); |
| 242 | 242 | |
| 243 | - if(session->update_toggle) | |
| 244 | - session->update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); | |
| 243 | + if(session->cbk.update_toggle) | |
| 244 | + session->cbk.update_toggle(session,ix,t->value,TT_INTERACTIVE,toggle_info[ix].name); | |
| 245 | 245 | |
| 246 | 246 | } |
| 247 | 247 | |
| ... | ... | @@ -291,7 +291,7 @@ static void toggle_altscreen(H3270 *session, struct lib3270_toggle *t, LIB3270_T |
| 291 | 291 | |
| 292 | 292 | static void toggle_redraw(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) |
| 293 | 293 | { |
| 294 | - session->display(session); | |
| 294 | + session->cbk.display(session); | |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /* | ... | ... |
util.c